NOTE: Your Relational Algebra Expressionsand Query Trees Mustbe Optimized
Total Page:16
File Type:pdf, Size:1020Kb
Name
Advanced Management Information Systems (MIS 408) Exam #1 (October 8, 2015) 100 points
Write relational algebra expressions (or draw query trees) and SQL commands to answer the following questions
NOTE: Your relational algebra expressions and Query Trees must be optimized!!
PART I – Use the Company Database (40 points)
1) For each employee who worked on more than two projects and do not have any dependents, list the name, department name, and the supervisor’s name of that employee. 2) For employee who worked a total of hours lower than every other employees in the company, list the name of that employee, the total number of hours he/she worked, and the department he/she work for. 3) List the name of each employee who work on every project that have department located in “Stafford.” -- Use division 4) For each employee who does not have any dependents, list his/her name and the total numbers of hours he/she worked. Part II. Use the very small airline database: (60 points)
1) For each passenger who travelled two or more times, list that passenger’s name and the departure and arrival city names . 2) For the passenger who travelled more times than all other passengers; list the name, departure and arrival city names, and the number of trips he/she travelled. 3) List the names of passengers who travel from “Memphis” two or more times or who have NEVER travelled from “Chicago (Midway).” 4) For each passenger who travelled from “Memphis” to all of the destination airports from there (so they travelled to all three of ATL, MDW, and DAL, in this example), list his/her name and the reservation numbers – Use division
Airlines Database Passenger P_ID Fname Lname Phone email P101 Mary Rodriguez 123-4567 [email protected] P102 Patricia Smith 111-2222 [email protected] P103 Linda Johnson 222-5555 [email protected] P104 Barbara Williams 333-7777 [email protected] P105 Elizabeth Brown 156-6789 [email protected] P106 Jennifer Jones 111-7777 [email protected] P107 Maria Miller 212-9999 [email protected] P108 Susan Davis 222-7878 [email protected]
Flight Flight# Depart_Airport Arrival_Airport Dep_Time Arv_Time F111 MEM ATL 8:00 AM 10:00 AM F222 MEM MDW 10:00 AM 1:00 PM F333 MDW BNA 11:00 AM 1:00 PM F444 ATL DAL 10:00 AM 1:00 PM F555 LAX MDW 1:00 PM 2:00 PM F666 MEM DAL 1:00 PM 4:00 PM
Airport A_Code City State MEM Memhis TN MDW Chicago (Midway) IL BNA Nashville-International TN ATL Atlanta GA LAX Los Angeles (LAX) CA DAL Dallas TX
Reservation Reservation# Flight# P_ID R101 F111 P101 R102 F222 P102 R103 F333 P103 R104 F555 P107 R105 F555 P108 R106 F222 P101 R107 F444 P102 R108 F666 P101 R109 F444 P102 R110 F666 P101