Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the relation FLIGHTFARES in Examination 1. The relation records the far

ID: 3839439 • Letter: C

Question

Consider the relation FLIGHTFARES in Examination 1. The relation records the fares of nonstop flights from one city A to another city B by various airlines. Note that the flights from city B to city A are independent from the flights from A to B. For example: Give a relational algebra tree-expression for a query that returns the cost of the cheapest nonstop flight or flights between each pair of the cities. Show the result for the instance table above. Give a relational algebra tree-expression for a query that returns the cost of the cheapest cost and flights for traveling between each pair of cities a customer is willing to stop once en-route. Show the result for the instance table above.

Explanation / Answer

a) Relational algebra Query

R1 = Pimin (fare)Flight_fare

R2 =Select(formcity,tocity)(R1)Flight_fare

Sample output

fromcity tocity

Memhis San francisco

Memhis San francisco

Memhis   Chicago

This Query will find the min cost of airline fare and then select the corresponding records accocaiate to the min fare.

For Query B also the above Relational algebra will work