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
  • $\begingroup$ A join operator will be necessary, at some point. $\endgroup$ Nov 23, 2016 at 20:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.