Question: In SQL using MAMP Submission: Type all your SQL code for each step AND output, then save it in a .pdf file. Submit the PDF


Submission: Type all your SQL code for each step AND output, then save it in a .pdf file. Submit the PDF file to the dropbox on D2L All your work should be unique and done by yourself. DO NOT copy answers from other students or from the internet, plagiarism is NOT tolerated. Part 1: Updates: You realized that all the dates in your tables are incorrect, every date is 2 years behind 1. Write the update statements that increment each date in your tables by 2 years. 2. Show all the updated fields. Part 2: Inserts and Selects: 1. Write two insert statements to insert two additional bookings for Guest 101. Both of them should take place in the year 2021. Have one price $250 and the other price $1000 2. Please write the statement to view the updated Booking table. 3. Paste the results of the above statement. Part 3: Aggregates 1. Write the select statement to COUNT how many bookings there are in the Bookings table? 2. Paste the results of the above stated at 3. Write the select statement to count how many bookings belong to guest 101. 4. Paste the results of the above statement. 5. Write the select statement to count how many bookings belong to guest 101 after an arrival date of 2021. 6. Paste the results of the above statement. 7. What is the AVERAGE price, MINIMUM price, MAXIMUM price, and SUM of all prices for all of the bookings? 8. Paste the results of the above statement. Part 4: GROUP BY 1. Select the guest number, and the average price. Group the results by guestNo and order the results by the guest number DESCENDING. Hint. In addition to Group By you will need to use above aggregates. 2. Paste the results of the above statement. 3. Select the guest number, and the average price, grouped by guestNo, but ONLY display it when the average price is greater than or equal to 500. Hint: You cannot use where' in Group By when using Aggregates - use Having 4. Paste the results of the above statement. 3. Do the same as the previous step but display the sum instead of average. Write the statement and show the output Part 3: Subqueries 1. Use a subquery to select the arrival and departure attributes where the guest number is the guest number whose last name is Washington (Note: To receive credit this must be done using a subquery'). 2 Paste the results of the above statement ho Part 6: Joins 1. Select the guest number, guest first name, last name, and the arrival and departure dates for those guests that have bookings. 2. Paste the results. 3. Select the guest number, guest first name, last name, and arrival and departure dates whether or not there is a booking. (All guests in the guest table should appear) Hint: Use Left or Right Join 4. Paste the results. Options guestNo dateArrive date Depart 101 2019-06-01 2019-06-30 102 2019-07-28 2019-08-07 104 2019-08-07 2019-08-21 105 2019-01-04 2019-01-15 price 500.00 500.00 500.00 500.00 + Options 1 Edit Copy Edit Copy Edit Copy Edit Copy Edit Copy guestNo lastName firstName phoneNo Delete 105 E Adam 9587481 Delete 103 Lee Derrick 47932 Delete 101 Washington George 2222222 Delete 104 D Jack 450982 Delete 102 Johnson Jane 75842 email adame@yahoo.com dlee@yahoo.com gwash@yahoo.com jdaniels@yahoo.com jsmith@yahoo.com
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
