Question: Do it on phpMyAdmin + SQL. You can make an example tables Part 1: Inserts and Selects: 1. Write two insert statements to insert two
Do it on phpMyAdmin + SQL. You can make an example tables
Part 1: 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 2023. 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 2: Aggregates 1. Write the select statement to COUNT how many bookings there are in the Bookings table? 2. Paste the results of the above statement. 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 2023. 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 3: 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. 5. Do the same as the previous step but display the sum instead of average. Write the statement and show the output. Part 4: 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. Part 5: 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
