Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following relations keep track of airline flight information: Flights(flno: integer, from: string, to: string, distance: integer, departs: time, arrives: time, price: integer) Aircraft(aid: integer,

The following relations keep track of airline flight information:

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

Create the required tables and upload the data into tables from the provided data:

Aircraft--

1,Boeing 747-400,84302,Boeing 737-800,33833,Airbus A340-300,71204,British Aerospace Jetstream 41,15025,Embraer ERJ-145,15306,SAAB 340,21287,Piper Archer III,5208,Tupolev 154,410316,Schwitzer 2-33,309,Lockheed L1011,690010,Boeing 757-300,401011,Boeing 777-300,644112,Boeing 767-400ER,647513,Airbus A320,260514,Airbus A319,180515,Boeing 727,1504

Certified--

567354612,1567354612,2567354612,10567354612,11567354612,12567354612,15567354612,7567354612,9567354612,3567354612,4242518965,10567354612,5 552455318,2 552455318,14 550156548,1 550156548,12 390487451,3 390487451,13 390487451,14 274878974,10 274878974,12 355548984,8 355548984,9 310454876,8 310454876,9 548977562,7 142519864,1 142519864,11 142519864,12 142519864,10 142519864,3 142519864,2 142519864,13 142519864,7 269734834,1 269734834,2 269734834,3 269734834,4 269734834,5 269734834,6 269734834,7 269734834,8 269734834,9 269734834,10 269734834,11 269734834,12 269734834,13 269734834,14 269734834,15 552455318,7 556784565,5 556784565,2 556784565,3 573284895,3 573284895,4 573284895,5 574489456,8 574489456,6 574489457,7 242518965,2 242518965,10 141582651,2 141582651,10 141582651,12 011564812,2 011564812,10 356187925,6 159542516,5 159542516,7090873519,6

Employees--

242518965,James Smith,120433141582651,Mary Johnson,178345011564812,John Williams,153972567354612,Lisa Walker,256481552455318,Larry West,101745550156548,Karen Scott,205187390487451,Lawrence Sperry,212156274878974,Michael Miller,99890254099823,Patricia Jones,24450356187925,Robert Brown,44740355548984,Angela Martinez,212156 310454876,Joseph Thompson,212156489456522,Linda Davis,127984489221823,Richard Jackson,23980548977562,William Ward,84476310454877,Chad Stewart,33546142519864,Betty Adams,227489269734834,George Wright,289950287321212,Michael Miller,48090552455348,Dorthy Lewis,92013248965255,Barbara Wilson,43723159542516,William Moore,48250348121549,Haywood Kelly,32899090873519,Elizabeth Taylor,32021486512566,David Anderson,743001619023588,Jennifer Thomas,54921015645489,Donald King,18050556784565,Mark Young,205187573284895,Eric Cooper,114323574489456,William Jones,105743574489457,Milo Brooks,20

Flights--

99,Los Angeles,Washington D.C.,2308,2005/04/12 09:30,2005/04/12 21:40,235.9813,Los Angeles,Chicago,1749,2005/04/12 08:45,2005/04/12 20:45,220.98346,Los Angeles,Dallas,1251,2005/04/12 11:50,2005/04/12 19:05,225.43387,Los Angeles,Boston,2606,2005/04/12 07:03,2005/04/12 17:03,261.567,Los Angeles,Sydney,7487,2005/04/12 22:30,2005/04/14 6:10,1278.562,Los Angeles,Tokyo,5478,2005/04/12 12:30,2005/04/13 15:55,780.9933,Los Angeles,Honolulu,2551,2005/04/12 09:15,2005/04/12 11:15,375.2334,Los Angeles,Honolulu,2551,2005/04/12 12:45,2005/04/12 15:18,425.9876,Chicago,Los Angeles,1749,2005/04/12 08:32,2005/04/12 10:03,220.9868,Chicago,New York,802,2005/04/12 09:00,2005/04/12 12:02,202.457789,Madison,Detroit,319,2005/04/12 06:15,2005/04/12 08:19,120.33701,Detroit,New York,470,2005/04/12 08:55,2005/04/12 10:26,180.56702,Madison,New York,789,2005/04/12 07:05,2005/04/12 10:12,202.344884,Madison,Chicago,84,2005/04/12 22:12,2005/04/12 23:02,112.45,2223,Madison,Pittsburgh,517,2005/04/12 08:02,2005/04/12 10:01,189.985694,Madison,Minneapolis,247,2005/04/12 08:32,2005/04/12 09:33,120.11304,Minneapolis,New York,991,2005/04/12 10:00,2005/04/12 1:39,101.56149,Pittsburgh,New York,303,2005/04/12 09:42,2005/04/12 12:09,116.50

Write SQL queries for each of the following:

  1. Find the names of aircraft where all pilots certified to operate them earn more than $80,000.
  2. 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.
  3. For all aircraft with cruisingrange over 1000 miles, find the names of the aircrafts and the average salary of all pilots certified for those aircrafts.
  4. Find the names of pilots certified for some Boeing aircraft.
  5. Compute the difference between the average salary of a pilot and the average salary of all employees (including pilots).
  6. Print the name and salary of every non-pilot whose salary is more than the average salary for pilots.

Expected Solution: You need to paste the SQL commands used.

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

Step: 3

blur-text-image

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

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions