1
$\begingroup$

I'm trying to write the relational algebra for a problem related to this schema:

I want to do the following: For each flight list the departure airport code for the first leg of the flight and the arrival airport code for the third leg.

I know how to do this for the individual parts, but I'm not sure how to select from multiple different instances of leg_instance.

This is what I have to start:

π airport.airport_code (flight) ⋈ flight.flight_number = leg_instance.flight_number (leg_instance) σ leg_instance.leg_number = 1
$\endgroup$
  • $\begingroup$ A join operator will be necessary, at some point. $\endgroup$ – André Souza Lemos Nov 23 '16 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.