Query_Solution - FROM FLIGHTS FLIGHT_ATTENDANCE WHERE...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Solution Querying Assignment 1. List the crew members of the flight 123 on May 5, 2007 SELECT FLIGHT_ATTENDANCE.EID, FLIGHT_ATTENDANCE.FLNO, FLIGHT_ATTENDANCE.DAY FROM FLIGHT_ATTENDANCE WHERE (((FLIGHT_ATTENDANCE.FLNO)=123) AND ((FLIGHT_ATTENDANCE.DAY)= '5/5/2007')); Query1 EID FLNO DAY 1 123 5/5/2007 5 123 5/5/2007 2. List the flight attendants who flew to Chicago at list once since January 1 st 2007. SELECT FLIGHT_ATTENDANCE.EID FROM FLIGHT_ATTENDANCE WHERE (((FLIGHT_ATTENDANCE.DAY)>= '1/1/2007')) AND FLIGHT_ATTENDANCE.FLNO IN (SELECT FLIGHTS.FLNO FROM FLIGHTS WHERE FLIGHTS.DESTINATION ='Chicago'); Query2 EID DAY 4 2/3/2007 2 3/6/2007 3. Find the employees who flew only to Chicago. SELECT FLIGHT_ATTENDANCE.EID FROM FLIGHT_ATTENDANCE WHERE FLIGHT_ATTENDANCE.EID NOT IN (SELECT FLIGHT_ATTENDANCE.EID
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: FROM FLIGHTS, FLIGHT_ATTENDANCE WHERE FLIGHTS.FLNO= FLIGHT_ATTENDANCE.FLNO AND FLIGHTS.DESTINATION<>'Chicago'); Query3 EID 4 6 4. List the employees who have been to all the cities. SELECT DISTINCT FA.EID FROM FLIGHT_ATTENDANCE FA WHERE NOT EXISTS (SELECT * FROM FLIGHTS FL WHERE NOT EXISTS (SELECT * FROM FLights FL2, FLIGHT_ATTENDANCE FA2 WHERE FL2.DESTINATION=FL.DESTINATION and FA2.EID=FA.EID and FL2.FLNO=FA2.FLNO)) Query4 EID 2 5. List pairs of employees who worked together on at least one flight. SELECT FL1.EID, FL2.EID FROM FLIGHT_ATTENDANCE FL1, FLIGHT_ATTENDANCE FL2 WHERE FL1.FLNO=FL2.FLNO AND FL1.DAY=FL2.DAY AND FL1.EID<>FL2.EID; Query5 FL1.EID FL2.EID 5 1 6 3 1 5 3 6...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern