160 likes | 310 Views
Group 1. Brooke Sims Don Luna Alison Lee. Problem #7.20 (Part A). Figure 7.19. Using relational algebra we were to specify the query by listing each flight, the flight number, the departure airport for the first leg of the flight, and the arrival airport for the last leg of the flight.
E N D
Group 1 • Brooke Sims • Don Luna • Alison Lee
Problem #7.20 (Part A) • Figure 7.19. Using relational algebra we were to specify the query by listing each flight, the flight number, the departure airport for the first leg of the flight, and the arrival airport for the last leg of the flight.
Part A Relational Algebra One_Leg <-s Leg_Number = ‘1’ (Flight_Leg) One_Leg2 <-p Flight_Number, Leg_Number, Departure_Airport_Code, Arrival_Airport_Code (One_Leg) Leg_1<- r FNum1, Leg_Num, Dep_Air_Code1, Arrive_Air_Code1 (One_Leg2)
Part A Relational Algebra cont’d Leg_Max <-Flight_Number MAXIMUM Leg_Number (Flight_Leg) Leg_Max2 <-p Flight_Number, Leg_Number, Departure_Airport_Code, Arrival_Airport_Code (Leg_Max) Leg_Result <- r FNum Max, Leg Num Max, Dep Air Code1, Arrive Air Code Max (Leg_Max2)
Part A Relational Algebra cont’d Result - Leg_1 |><| FNum1 = FNum Max Leg_Result
Problem #7.20 (Part B) • Using relational algebra, we were to specify the query by listing the flight numbers and weekdays of all flights or flight legs that depart from Houston Intercontinental Airport (IAH) and arrive in Los Angeles International Airport (LAX).
Part B Relational Algebra One_Leg <-s Leg_Number = ‘1’ (Flight_Leg) One_Leg2 <-p Flight_Number, Leg_Number, Departure_Airport_Code, Arrival_Airport_Code (One_Leg) Leg_1<- r FNum1, Leg_Num, Dep_Air_Code1, Arrive_Air_Code1 (One_Leg2)
Part B Relational Algebra cont’d Leg_Max <-Flight_Number MAXIMUM Leg_Number (Flight_Leg) Leg_Max2 <-p Flight_Number, Leg_Number, Departure_Airport_Code, Arrival_Airport_Code (Leg_Max) Leg_Result <- r FNum Max, Leg Num Max, Dep Air Code1, Arrive Air Code Max (Leg_Max2)
Part B Relational Algebra cont’d Result1 - Leg_1 |><| FNum1 = FNum Max Leg_Result Temp1 - Departure Airport Code = ‘IAH’ AND Arrival Airport Code = ‘LAX’ (Flight_Leg) Temp2 - FNum Max, Dep Air Code1, Arrive Air Code Max (Result1)
Part B Relational Algebra cont’d Temp3 - Dep Air Code1 = ‘IAH’ AND Arrive Air Code Max = ‘LAX’ (Temp2) Result2 -FNum Max, Dep Air Code1, Arrive Air Code (Temp3) Flight Number, Departure Airport Code, Arrival Airport Code (Temp1) Result3 - Result2 |><| FNum Max = Number (Flight)
Part B Relational Algebra cont’d Final - Weekdays, Flight Number (Result3)
Problem #7.20 (Part C) • Using relational algebra, we were to specify the query by listing 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.
Part C Relational Algebra Houston - City = ‘Houston’ (Airport) Los_Angeles - s City = ‘Los Angeles’ (Airport) Houston_Flights - Flight_Leg |><| Departure Airport Code = Airport Code (Houston)
Part C Relational Algebra cont’d LA_Flights - Flight_Leg |><| Arrival Airport Code = Airport Code (Los_Angeles) Houston_Flights2 - Flight Number, Departure Airport Code, Scheduled Departure Time, Arrival Airport Code, Scheduled Arrival Time (Houston_Flights) Houston_Departs - FNum, DAC, SDT, AAC, SAT (Houston_Flights2)
Part C Relational Algebra cont’d LA_Arrives - Flight Number, Departure Airport Code, Scheduled Departure Time, Arrival Airport Code, Scheduled Arrival Time (LA_Flights) Result1 - Houston_Leave |><| FNum = Flight Number (LA_Arrives) Result2 - DAC, SDT, AAC, SAT, Flight Number (Result1)
Part C Relational Algebra cont’d Result3 - Result2 |><| Flight_Number = Number (Flight) Final - Weekdays, Flight Number, DAC, DAT, Arrival Airport Code, Scheduled Arrival Time (Result3)