task 1
List the customer name, routeID and departure location for the booking with the largest cost value. You will need 2 queries.
Task 2
task 2 (challenge)
a Using the booking table, list customerID and departure date showing the most recent flight for each date.
b Now include the earliest or first flight in the same query.
c Now calculate the interval between the two flight dates for each customer.
Display the total seat capacity used for each route with the highest total capacity first.
Include the total capacity, the departure point, arrival point and number of flights on the route
part 2a SQL
select customerid, min(departuredate) as "1st Flight"
from booking, flight
where booking.flightid = flight.flightid
group by customerid
part 2a sample output (there are more than 10 rows)
part 2b SQL
select customerid, min(departuredate) as "1st Flight", max(departuredate) as "Latest Flight"
from booking, flight
where booking.flightid = flight.flightid
group by customerid
part 2b sample output (there are more than 10 rows)
first and latest flight per customer
part 2c SQL
select customerid, max(departuredate) - min(departuredate) as "Interval"
from booking, flight
where booking.flightid = flight.flightid
group by customerid
part 2c sample output (there are more than 10 rows)
Interval between first and last flight dates