The foreign key, depart and arrive for AIRPORT is for the airports name. Example
ID: 3753250 • Letter: T
Question
The foreign key, depart and arrive for AIRPORT is for the airports name. Example: depart='O'Hare' arrive='Cincinatti'
1. Assume a database with the following schema: AIRPORT(name.city,country,number-runaways) FLIGHT (flightid, depart,depart-time,arrive,arrive-time, pid, price) PLANE (planeid,type,number-passangers,radius,payload,mar-altitude,mar-speed) where AIRPORT gives information about airports, and name is the primary key; FLIGHT gives information for direct flights from depart to arrive, both of which are foreign keys to AIRPORT (and flightid is the primary key); and PLANE gives information about planes, with planeid the primary key (pid in FLIGHT is a foreign key to PLANE) Write the following questions in SQL: (a) List the flightids of flights from any airport in Chicago that uses Boeing 727s (a type of plane) and cost less than $1,000 (b) List the flightids of international flights (a flight is international if it goes from an airport in some country to another airport in a different country) (c) List the pair of flightids for flights that go from O'Hare airport to Standiford Field airport with one stop (i.e. in two legs) and the total cost (d) List the types of planes that are used in flights starting from O'Hare airport or Midway airport (e) List the types of planes that are used in flights starting from O'Hare airport and flights starting from Midway airport.Explanation / Answer
A. select flightid from flight f, airport a,plane p where f.depart=a.city and f.pid=p.planeid and a.city='chicago' and f.pid='boing' and p.type='727s' and f.price<1000
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.