Question: Consider the following flight database relations. Primary key attributes are underlined. The following relations keep track of airline flight information: Flights: ( flno: integer, origin:

Consider the following flight database relations. Primary key attributes are underlined.
The following relations keep track of airline flight information:
Flights: (flno: integer, origin: string, destination: string, distance, integer, departs:
timestamp, arrives: timestamp, price: integer)
Aircraft(aid: integer, aname: string, cruisingrange: integer)
Certified(eid: integer, aid: integer)
Employees(eid: integer, ename: string, salary: integer)
Note that the employees relation describes pilots and other kinds of employees as well;
every pilot is certified for some aircraft, and only pilots are certified to fly. Write each
of the following queries in SQL:
(a) List in reverse alphabetical order all pilots who are certified to fly some Airbus
plane.
(5 marks)
(b) Find the name(s) and salary(salaries) of the pilot(s) who is (are) certified to fly
the largest number of planes.
(5 marks)
(c) Compute the difference between the average salary of a pilot and the average
salary of all employees (including pilots).
(5 marks)
(d) For each plane that has at least six pilots, find the name of the plane and the
average salary of the pilots who are certified to fly it.
(5 marks)
(e) Find the set of origins and destinations that can be reached by two hops that
can't be reached by a direct flight (e.g., list "Pittsburgh" "Honolulu" if there's
no direct flight between Pittsburgh and Honolulu and there's a flight from
"Pittsburgh" to some city "X" and then a flight from "X" to "Honolulu").
 Consider the following flight database relations. Primary key attributes are underlined.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!