Multiple-Table Queries – Alexamara Marina Group

Alexamara Marina Group

Use SQL and the Alexamara Marina Group database (see Figures 1-8 through 1-12 in Chapter 1) to complete the following exercises. If directed to do so by your instructor, use the information pro- vided with the Chapter 3 Exercises to print your output.

  1. For every boat, list the marina number, slip number, boat name, owner number, owner’s first name, and owner’s last name.
  2. For every completed or open service request for routine engine maintenance, list the slip ID, description, and status.
  3. For every service request for routine engine maintenance, list the slip ID, marina number, slip number, estimated hours, spent hours, owner number, and owner’s last name.
  4. List the first and last names of all owners who have a boat in a 30-foot slip. Use the IN opera- tor in your query.
  5. Repeat Exercise 4, but this time use the EXISTS operator in your query.
  6. List the names of any pair of boats that have the same type. For example, one pair would beAnderson II and Escape, because the boat type for both boats is Sprite 4000. The first name listed should be the major sort key and the second name should be the minor sort key.
  7. List the boat name, owner number, owner last name, and owner first name for each boat in marina 1.
  8. Repeat Exercise 7, but this time only list boats in 40-foot slips.
  9. List the marina number, slip number, and boat name for boats whose owners live in Glander Bay or whose type is Sprite 4000.
  10. List the marina number, slip number, and boat name for boats whose owners live in Glander Bay and whose type is Sprite 4000.
  11. List the marina number, slip number, and boat name for boats whose owners live in Glander Bay but whose type is not Sprite 4000.
  12. Find the service ID and slip ID for each service request whose estimated hours is greater than the number of estimated hours of at least one service request on which the category number is 3.
  13. Find the service ID and slip ID for each service request whose estimated hours is greater than the number of estimated hours on every service request on which the category number is 3.
  14. List the slip ID, boat name, owner number, service ID, number of estimated hours, and num- ber of spent hours for each service request on which the category number is 2.
  15. Repeat Exercise 14, but this time be sure each slip is included regardless of whether the boat in the slip currently has any service requests for category 2.