question

harshil16 avatar image
harshil16 asked

Relational algebra help

Hi guys I am trying to do realtional algebra query for my assignment ... I have attached the schema in a file ... I have done the first query ... can you please tell me if it is correct ... Thanks Raj [Airline datbase schema ] [1]1. Find every flight for which there are no flight legs listed in the database. Π FLIGHT_NUMBER(FLIGHT) – [ Π FLIGHT_NUMBER (σ (FLIGHT_LEG))] (set of all flight numbers) - (Set of all flights that have atleast one flight leg) [1]: /storage/temp/1339-airline+database+schema+(1).pdf
queryhomework
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
ThomasRushton avatar image
ThomasRushton answered
Without looking at the schema, so you'll need to do some translation... You're looking for FLIGHTs where there are no flight legs? Or, to put it another way, where there are no records in the flight legs table? You could try something like: SELECT * FROM Flights WHERE FlightNumber NOT IN ( SELECT FlightNumber FROM FlightLegs)
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.