Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
a) For each flight, list the flight number, the departure airport for the first leg of the
flight, and the arrival airport for the last leg of the flight.
b) List the flight numbers and weekdays of all flights or flight legs that depart
from Houston Intercontinental Airport (airport code ‘iah’) and arrive in Los Angeles
International Airport (airport code ‘lax’).
c) List the flight number, departure airport code, scheduled departure time, arrival
airport code, scheduled arrival time, and weekdays of all flights or flight legs that
depart from some airport in the city of Houston and arrive at some airport in the city
of Los Angeles.
d) List all fare information for flight number ‘co197’.
e) Retrieve the number of available seats for flight number ‘co197’ on ‘2009-10-09’.
c) Q1 ← σDeparture_airport_code = 'IAH'(FLIGHT_LEG)
Q2 ← σArrival_airport_code = 'LAX'(FLIGHT_LEG)
Q3 ← Q1 × Q2
Result ← πFlight_number, Departure_airport_code, Scheduled_departure_time, Arrival_airport_code, Scheduled_arrival_time,
Weekdays(Q3 × FLIGHT)
d) Result ← σ Flight_number = ‘CO197’ (FARE)
8.23
Specify the following queries in relational algebra on the database schema in Exercise 5.17:
CAR(Serial_no, Model, Manufacturer, Price)
OPTION(Serial_no, Option_name, Price)
SALE(Salesperson_id, Serial_no, Date, Sale_price)
SALESPERSON(Salesperson_id, Name, Phone)
CAR
OPTION
SALE
Salesperson_id Serial_no Date Sale_price
SALESPERSON
Salesperson_id Name Phone
a) For the salesperson named ‘Jane Doe’, list the following information for all the cars
she sold: Serial#, Manufacturer, Sale_price.
b) List the Serial# and Model of cars that have no options.
c) Consider the NATURAL JOIN operation between SALESPERSON and SALE. What
is the meaning of a left outer join for these tables (do not change the order of
relations)? Explain with an example.
d) Write a query in relational algebra involving selection and one set operation and say
in words what the query does.
SALESPERSON
Salesperson_id Name Phone
1 Abdul 085
2 Qodir 089
3 Jaelani 081
SALE
Salesperson_id Serial_no Date Sale_price
1 123 20301028 900
2 456 20301026 1000
Result
Salesperson_id Name Phone Serial_no Date Sale_price
1 Abdul 085 123 20301028 900
2 Qodir 089 456 20301026 1000
3 Jaelani 081 NULL NULL NULL