Course Content
Intermediate SQL
2. Nested Subqueries
4. Left, Right, and Inner Joins
Intermediate SQL
Challenge: All Flights Information
Task
You have to join two tables: departure
and flights
.
- Select
departure_date
, anddeparture_time
from thedeparture
table; - Select
start_point_flight
,end_point_flight
,travel_time
fromflights
table; - Join these two tables using the
JOIN
statement byflight_number
column; - Order your results by
travel_time
column in ascending order; - Take the first 5 rows.
Here's a short example of the departure
table:
number_of_departure | flight_number | departure_date | departure_time |
1 | 3 | 2022-07-16 | 08:00:00 |
2 | 1 | 2022-07-18 | 13:15:00 |
... | ... | ... | ... |
6 | 3 | 2022-07-16 | 08:00:00 |
Here's a short example of the flights
table:
flight_number | start_point_flight | end_point_flight | travel_time |
1 | Paris | New York | 8 |
2 | Chicago | New Delhi | 15 |
3 | New York | Dubai | 12 |
4 | Los Angeles | Honolulu | 5 |
Everything was clear?
Section 3. Chapter 2