I am working on multi-table queries for my SQL class using a premade database, w
ID: 3736677 • Letter: I
Question
I am working on multi-table queries for my SQL class using a premade database, which I have included screenshots of. I received assistance and was able to complete a good number of the queries but the bolded ones seem absolutely impossible to do??
How do I write a query for the bolded questions?? I've scoured my textbook and notes and cannot get anything I try to successfully produce results.
1. List all current reservations with the trip ID, customer’s first name, last name and date of trip. List the reservations alphabetically by customer’s last name.
2. List the trip name of each of Glory Unser’s trips.
3. Create a list of all customers taking a trip on July 23, 2016. Include the customer’s first name, last name and the start location.
4. List the reservation ID, trip ID, and trip date for reservations for trips in ME. Run the query once using the IN operator and write the query and run it again using the EXISTS operator. Be sure and provide both screenshots.
5. List the first and last name of all guides that lead biking trips. Query results should have duplicate values.
6. Repeat the query from #5 without duplicates and sort the list by guide’s last name.
7. List the first name and last name of all customers that have reservations for a trip being led by Zach Gregory.
8. List the first name, last name, phone number of all customers that either live in NJ or have a current reservation.
9. List the first name, last name, phone number of all customers that either live in NJ and have a current reservation.
10. List the name of all trips and the trip date from the reservations. Trips that do not have reservations associated with them should also be in the list but trip date will be blank. (HINT: different kind of join to get records that do not have matches in the second table!)
Explanation / Answer
As any of the tables doesn't have GUIDE_NUM as foreign key, it is not possible to retrive the information that is asked in bold question.The table TRIP should contain GUIDE_NUM as one of its fields.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.