Question
1. List the flights that cost more than 800, reporting their ID, airport code, destination code, and fare. 2. What passengers do not have an
1. List the flights that cost more than 800, reporting their ID, airport code, destination code, and fare.
2. What passengers do not have an airport in their hometown? List their names and hometown.
3. What airlines fly from 'Toronto'? Report the airline name.
4. What airlines don't fly from 'Toronto'? Report the airline name.
5. What airlines fly from 'Toronto' to 'Vancouver'? Report the airline name.
6. List the passengers flying to 'Vancouver', reporting their name, origin and destination airport codes, and arrival time.
7. List all passengers (by name) who have no flights booked.
8. What's the earliest flight from 'Toronto' to 'Vancouver'? Report the departure time only.
9. How much is the cheapest flight fare from Ottawa to Toronto? Report the fare price only.
10. List all flights from 'Toronto' to 'Vancouver', sorted by fare price (lowest first). Report the airline name, origin and destination airport codes, departure time and fare.
11. List all passengers who have more than 2 flights booked, and the number of bookings each one has. Please report passenger name and the number of booked flights.
12. How many seats are available for a flight from 'Ottawa' to 'Toronto' departing at noon (12)?
13. List the names of all passengers arriving in 'Vancouver' after 13:00 (note that arrival time ranges from 0 to 23), the airport (by city) they are coming from, and their arrival time.
14. List all trips (with 1 stop, i.e, two flights) from 'Ottawa' to 'Vancouver' and sort by lowest total fare. Please list flight ID for both Ottawa-layover and layover-Vancouver flights, airline name (of first flight only), city of origin, layover city, destination city, total trip time (including layover), and total fare price.
Consider the relational schema below and write SQL queries for the next questions. This is a simplified flight booking database. In this database we have 5 relations (tables). You must assume you don't know airport codes, but only city names, unless otherwise mentioned in the question. For example, you can use 'Toronto' in a query, not 'YYZ'. If a question explicitly uses a PK value, e.g., "Where is airport 'YYZ' located?", then you can use it in a query like where code= 'YYZ'. Primary keys are used to uniquely identify tuples and also to 'link' tables with their corresponding foreign keys. Therefore, you must not use any primary key values explicitly, unless otherwise mentioned. If your query uses PK or FK values explicitly where it shouldn't, the answer will be invalidatedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started