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
Aircraftaid: integer, aname: string, cruisingrange: integer
Certifiedeid: integer, aid: integer
Employeeseid: 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.
marks
b Find the names and salarysalaries of the pilots who is are certified to fly
the largest number of planes.
marks
c Compute the difference between the average salary of a pilot and the average
salary of all employees including pilots
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
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 eg 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"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
