Queries Based on the Aviaco Database from Database Systems (Rob and Coronel)

Queries Based on the Aviaco Database from Database Systems (Rob and Coronel)

<p>Queries based on the AviaCo database from Database Systems (Rob and Coronel)</p><p>Paste the SQL for queries below the problem statement. </p><p>1. Make a list of the Aircraft registration numbers as well as their model manufacturers and model names. </p><p>SELECT `AIRCRAFT`.`AC_NUMBER`, `MODEL`.`MOD_MANUFACTURER`, `MODEL`.`MOD_NAME` FROM `MODEL` LEFT JOIN `ROBOCOR`.`AIRCRAFT` ON `MODEL`.`MOD_CODE` = `AIRCRAFT`.`MOD_CODE`</p><p>2. Make a list of customers and the flights and dates flown on. Include customers that have never flown. </p><p>SELECT `CUSTOMER`.`CUST_FNAME`, `CUSTOMER`.`CUST_LNAME`, `CHARTER`.`CHAR_TRIP`, `CHARTER`.`CHAR_DATE` FROM `CHARTER` RIGHT JOIN `ROBOCOR`.`CUSTOMER` ON `CHARTER`.`CUST_NUM` = `CUSTOMER`.`CUST_NUM`</p><p>SELECT CONCAT(`CUSTOMER`.`CUST_FNAME`,' ', `CUSTOMER`.`CUST_LNAME`) fullname, `CHARTER`.`CHAR_TRIP`, `CHARTER`.`CHAR_DATE` FROM `CHARTER` RIGHT JOIN `ROBOCOR`.`CUSTOMER` ON `CHARTER`.`CUST_NUM` = `CUSTOMER`.`CUST_NUM`</p><p>3. Make a list that has both the customer names and the employee names. </p><p>SELECT `CUSTOMER`.`CUST_FNAME`, `CUSTOMER`.`CUST_LNAME` FROM `CUSTOMER` UNION SELECT `EMPLOYEE`.`EMP_FNAME`, `EMPLOYEE`.`EMP_LNAME` FROM `EMPLOYEE`</p><p>4. Make a list having customers and employees who flew on February 7, 2004.</p><p>SELECT `CUSTOMER`.`CUST_FNAME`, `CUSTOMER`.`CUST_LNAME` FROM `CHARTER`, `ROBOCOR`.`CUSTOMER` WHERE `CHARTER`.`CUST_NUM` = `CUSTOMER`.`CUST_NUM` AND `CHARTER`.`CHAR_DATE` ='2/7/2004' UNION SELECT `EMPLOYEE`.`EMP_FNAME`, `EMPLOYEE`.`EMP_LNAME` FROM `CHARTER`,`ROBOCOR`.`CREW`, EMPLOYEE WHERE `CHARTER`.`CHAR_TRIP` = `CREW`.`CHAR_TRIP` AND `CREW`.`EMP_NUM` = `EMPLOYEE`.`EMP_NUM` AND `CHARTER`.`CHAR_DATE` ='2/7/2004'</p><p>5. Count the number of charters to the various destinations. </p><p>SELECT `CHARTER`.`CHAR_DESTINATION`, COUNT(`CHARTER`.`CHAR_TRIP`) thecount FROM `CHARTER` GROUP BY CHAR_DESTINATION ORDER BY thecount DESC LIMIT 0,5</p><p>6. Calculate the fuel efficiency (number of miles per gallon) for all of the flights. Group the information by aircraft used for the trip. </p><p>7. Calculate the average fuel efficiency for each of the aircraft. Put them in order from most efficient to least efficient. </p><p>8. Customers are charged by the mile (the Charter table lists distances) depending on the model they fly (the Model table lists charge per mile). Make a list of the customers, their flights and the mileage charge. Group by customer. 9. Total up the mileage charge for each customer. </p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us