I am new to Oracle SQL, and any help will be appreciated! I am trying to run this query: select ID, birthyear, substr(‘&Enter_Date’,7,4) Year, Case When birthday is not null Then (Year-birthyear) …
Issues with GROUP BY and NULL (SQL / BigQuery)
I have some bad data that I need to transform a bit and am struggling to do. Below is example data and desired output. What I’m hoping for is if PUNCHIN is NULL, but there is another value of PUNCHIN for that EmployeeNum and APPLY_DATE, then use the other value. Otherwise, use SHIFTSTARTTIME. And the sa…
SQL Join that finds non matches
I have two tables “SellerDetails” and “ANL” and both have key fields of “Seller Ref No” and “Sales Year”. This giving me where there is a match on Seller Ref …
Insert bulk data into two related tables with foreign keys from another table
I have imported some data to a temp SQL table from an Excel file. Then I have tried to insert all rows to two related tables. Simply like this: There are Events and Actors tables with many to many …
Counting and Joining in SQL (oracle)
My database contains 2 tables called products and product_categories. Product_categories contain category_id and category_name Products contain category_id and other irrelevant info for this question. …
Pivot table in alphabetical order
Am new to MySQL, I want to pivot a table Table contains two columns only Name and Occupation Where no null values are inserted I want to pivot the occupation column so that each Name is sorted …
How do I do conditional logic between rows of a bigquery table?
I’m trying to write a query that goes through a table row by row comparing the current row with the next. Then based on a condition being true will perform a calculation which is then output in a …
Numbering sequences from xml according element’s values
The PointNum attribute means the number of coordinates in the chain. The coordinate chain starts at 1 and ends at 1 as well (inside each Parcel element). However, within the sequences of these points, …
How to display a list of departments whose teachers teach DBMS department students?
I have a database in Access. The database has 4 tables: [DEPARTMENT], [TEACHER], [LECTURE], [SGROUP]. I need to display a list of departments whose teachers teach DBMS department students. The …
How to dynamically change sql query to add dates of the week and all week numbers?
I have a sql query where I need to provide three things dynamically: weekly_ads should have current week number. Since this week is 43 so it should have – ‘WEEKLY#2020#43%’ month should be current …