Question

The following relations keep track of airline flight information: Flight (flno: int, from: varchar(20), to: varchar(20),...

The following relations keep track of airline flight information:

Flight (flno: int, from: varchar(20), to: varchar(20), distance: real, departs: time, arrives: time, price: real)

Aircraft (aid: int, aname: varchar(20), cruisingrange: real)

Certified (eid: int, aid: int)

Employee (eid: int, ename: varchar(20), salary: real)

Note that the Employee 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. Create a view (called EMP_MID_SAL) that has all employee tuples in table Employee where the salary is between $40,000 and $50,000.

2.  Find the cheapest price, the highest price and the count of the flights that fly from New York City, NY to either San Jose, CA or Los Angeles, CA.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. CREATE VIEW EMP_MID_SAL AS SELECT * FROM Employee WHERE SALARY > 40000 and SALARY<50000

2. SELECT MIN(PRICE), MAX(PRICE), COUNT(*) FROM Flight WHERE from = 'NY' and (to = 'CA' or to = 'LA')

NOTE:Both San Jose and Los Angeles are given the same code CA in question, so considering Los Angeles code as LA, i have written the above query. Change it according to the correct question.

Add a comment
Know the answer?
Add Answer to:
The following relations keep track of airline flight information: Flight (flno: int, from: varchar(20), to: varchar(20),...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 1 Consider the following relations containing airline flight information, where the keys are underlined ghts(no:...

    Problem 1 Consider the following relations containing airline flight information, where the keys are underlined ghts(no: integer, from: string, to: string, distance: integer, departs: time, arrives: time) aircraftlaid: integer, aname: string, crusingrange: 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 (otherwise, he or she would not qualify as a pilot), and only pilots are certified to fly....

  • Consider the following relations for an airline company: Flights (flno: integer, from: string, to: string, distance:...

    Consider the following relations for an airline company: Flights (flno: integer, from: string, to: string, distance: integer, departs: time, arrives: time) Aircraft (aid: integer, aname: string, cruising_range: integer) Certifed (pid: integer, aid: integer) Pilots (pid: integer, pname: string, salary: integer) (word in bold are primary keys) Note that every pilot is certified for some aircraft. Write the following queries in relational algebra: 1- Find the flight numbers of flights departing from ‘Amsterdam’ or ‘London’ between 8:00am and 11:00am, and arriving...

  • Find flno of flights that can be piloted by every pilot whose salary is over $100,000...

    Find flno of flights that can be piloted by every pilot whose salary is over $100,000 without using the division operator. Flights (flno, from, to, distance, departs) Aircraft (aid, aname, range) Certified (eid, aid) Employees leid, ename, salary)

  • Consider the database consisting of the following relations: Flights(Fl#: integer, From: string, To: string, Distance: integer,...

    Consider the database consisting of the following relations: Flights(Fl#: integer, From: string, To: string, Distance: integer, departs: Time, Arrives: time) Flight Instance(Fl#: integer, Day: date, Aid: Integer) Aircraft(Aid: integer, Make: string, Model: string, CrusingRange: string) Certified(Eid: integer, Make: string, Model: string) Employee(Eid: integer, Ename: string, Salary: integer) Fight Attendant(Fl#: integer, Day: date, Eid:integer, Role: string) The Flight table contains general information about the flights whereas the Flight Instance is about a flight number on a specific date. Aircraft list the...

  • Any help appreciated! Question 1 (5 points). Answer each of the following questions briefly. The questions...

    Any help appreciated! Question 1 (5 points). Answer each of the following questions briefly. The questions are based on the following relational schema: Emp( eid: integer, ename: string, age: integer, sala1l1: real) Works( eid: integer, did: integer, pet_time: integer) Dept(did: integer, dname: string, budget: real, managerid: integer) 1. Give an example of a foreign key constraint that involves the Dept relation. 2. Write the SQL statements required to create the preceding relations, including appropriate versions of all primary and foreign...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT