Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. List all passengers (by name) who have no flights booked. 2. What's the earliest flight from 'Toronto' to 'Vancouver'? Report the departure time only.

image text in transcribed

1. List all passengers (by name) who have no flights booked.

2. What's the earliest flight from 'Toronto' to 'Vancouver'? Report the departure time only.

3. How much is the cheapest flight fare from Ottawa to Toronto? Report the fare price only.

4. 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.

5. 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.

6. How many seats are available for a flight from 'Ottawa' to 'Toronto' departing at noon (12)?

7. 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.

8. 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 invalidated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Draw a breakeven chart to illustrate a drop in labor costs.

Answered: 1 week ago