Skip to content

SQL query to find the concurrent sessions based on start and end time

Below is a sample dataset showing TV sessions of each TV set of each household. Household “111” switch on their TV “1” at 500 and switch it off at 570. However, this has been captured in the data as 2 separate rows. You will have to write a query to convert this into a single row. Similar modification needs t…

Combine two table with different column name using Union all

I have two tables T1 and T2 with column name proj in T1 and projectID in T2. I have to combine these two tables using Union all. As both column has similar kind of information. How it can done so that it is visible under one column name Answer if the datatype are same ,the column names for a UNION

In Oracle SQL is there a way to join on a value twice?

Lets say I have two tables, with the following columns: cars fuel_types In this case fuel_id and secondary fuel_id both refer to the fuel_types table. Is it possible to include both labels in an inner join? I want to join on the fuel_id but I want to be able to have the fuel label twice as a new column. So