Write a query in relational algebra for the following reques

Write a query in ***********relational algebra********** for the following requests:

a. Find all airlines that fly to all Canadian airports.

b. Find all airlines that fly to a Canadian airport but not to any US Airport.

c. Find the locations of all airports with at least one flight to New York.

Consider the following relational schema. Flight(number:integer,aie string, from: string, to: string) CanAirport(code: string, location: string) USAirport(code: string, location: string) The \"from\" and \"to\" fields in the Flight table point to the \"code\" fields in the airport table. For example, a typical entry in the Flight table might be 56, AIRC, YEG, YYV and a typical entry in the CanAirport table might be YEG, Edmonton.

Solution

a. select airline from Flight where to in(select code from CanAirport);
b. select airline from Flight where to in(select code from CanAirport) AND to not in(select code from USAirport);
c. select location from CanAirport where code in(select from from Flight where to=\'New York\') UNION select location from USAirport where code in(select from from Flight where to=\'New York\')

Write a query in ***********relational algebra********** for the following requests: a. Find all airlines that fly to all Canadian airports. b. Find all airline

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site