Skip to content

Tricky SQL Exercise

Here is the database description: Company(ID_comp, name) Trip(trip_no, id_comp, plane, town_from, town_to, time_out, time_in) Passenger(ID_psg, name) Pass_in_trip(trip_no, date, ID_psg, place) …

connect by clause in regex_substr

I cant get the understanding of this statement – not eveN after googling around pv_no_list :=’23,34,45,56′; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list, …

Handling Null in Greatest function in Oracle

I want to compare two dates from two columns and get the greatest and then compare against a date value. The two column can hold NULL values too. For example I want the below OUTPUT. How do I use the greatest function or if there is anything else? I am again using the output to compare against another date. A…

Unpivot with column name

I have a table StudentMarks with columns Name, Maths, Science, English. Data is like I want to get it arranged like the following: With unpivot I am able to get Name, Marks properly, but not able to get the column name in the source table to the Subject column in the desired result set. How can I achieve this…