Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
996 views

Dbms SQL Ex4

The document describes several database relations that store information about airline flights, aircrafts, employee certifications, and employees. It includes 24 queries to run against these relations, such as finding pilot IDs certified for Boeing aircraft, names of pilots certified for long-range Boeing aircraft, and flight routes that can be piloted by high-paid employees.

Uploaded by

Ram Srivatsa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
996 views

Dbms SQL Ex4

The document describes several database relations that store information about airline flights, aircrafts, employee certifications, and employees. It includes 24 queries to run against these relations, such as finding pilot IDs certified for Boeing aircraft, names of pilots certified for long-range Boeing aircraft, and flight routes that can be piloted by high-paid employees.

Uploaded by

Ram Srivatsa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

The following relations keep track of airline flight information:

Flights(flno: integer, from: string, to: string, distance: integer, departs: time, arrives: time, price:
real)
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.

1. Find the eids of pilots certified for some Boeing aircraft.


2. Find the names of pilots certified for some Boeing aircraft.
3. Find the aids of all aircraft that can be used on non-stop flights from Bonn to Madras.
4. Identify the flights that can be piloted by every pilot whose salary is more than $100,000.
5. Find the names of pilots who can operate planes with a range greater than 3,000 miles but
are not certified on any Boeing aircraft.
6. Find the eids of employees who make the highest salary.
7. Find the eids of employees who make the second highest salary.
8. Find the eids of employees who are certified for the largest number of aircraft.
9. Find the eids of employees who are certified for exactly three aircraft.
10. Find the total amount paid to employees as salaries.

11. Find the names of aircraft such that all pilots certified to operate them have salaries more
than $80,000.
12. For each pilot who is certified for more than three aircraft, find the eid and the maximum
cruisingrange of the aircraft for which she or he is certified.
13. Find the names of pilots whose salary is less than the price of the cheapest route from
Los Angeles to Honolulu.
14. For all aircraft with cruisingrange over 1000 miles, find the name of the aircraft and the
average salary of all pilots certified for this aircraft.
15. Find the names of pilots certified for some Boeing aircraft.
16. Find the aids of all aircraft that can be used on routes from Los Angeles to Chicago.
17. Identify the routes that can be piloted by every pilot who makes more than $100,000.
18. Print the enames of pilots who can operate planes with cruisingrange greater than 3000
miles but are not certified on any Boeing aircraft.
19. A customer wants to travel from Madison to New York with no more than two changes
of flight. List the choice of departure times from Madison if the customer wants to arrive
in New York by 6 p.m.
20. Compute the difference between the average salary of a pilot and the average salary of
all employees (including pilots).
21. Print the name and salary of every nonpilot whose salary is more than the average salary
for pilots.
22. Print the names of employees who are certified only on aircrafts with cruising range
longer than 1000 miles.
23. Print the names of employees who are certified only on aircrafts with cruising range
longer than 1000 miles, but on at least two such aircrafts.
24. Print the names of employees who are certified only on aircrafts with cruising range
longer than 1000 miles and who are certified on some Boeing aircraft.

You might also like