Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 3: Alter 1. First, write a statement to insert into Property a new entry with unique id 4 without specifying a phone number. You

Part 3: Alter 1. First, write a statement to insert into Property a new entry with unique id 4 without specifying a phone number. You will need to specify the columns you are inserting values into. 2. What happened? What do you see in the phone attribute for that row in the table? 3. Write the statement to alter the table Property to specify a default phone number. Remember you will need single quotes around the number. 4. Write a statement to insert another row into Property with id 5 without specifying a phone number. 5. What happened? What is now in the phone column? Paste the results of a select * from Property. 6. Write the statement to drop the attribute phone from the Property table. 7. Paste the result of select * from Property. 8. Write one statement to alter the table Booking to add a column, propertyNo, which: a. is an integer representing the propertyNo for each booking b. is a foreign key to the propertyNo in the Property table c. has a default value of 1 (i.e., your previous rental that all guests were subletting). 9. Paste the result of Select * from Booking. Check out the propertyNo attribute. What happened? 10. Guest 104 would like to sublet one of your new properties, property number 2 from September 1, 2022 until September 30, 2022 for a price of 650. Write the insert statement. 11. Paste the results of a select * from Booking. 12. Write another insert statement to insert a DIFFERENT date for 104 to rent a new property. But this time for a property number which does not exist in the Property table. 13. What error did you receive? Paste the error. Part 4: Joins again! 1. Write the SQL Statement to display the guestNo, dateArrive , dateDepart, propertyNo, city, and state for all Bookings. 2. Paste the results. 3. Write the SQL statement to display the guestNo, firstName, lastName, propertyNo, price, city, and state for all Bookings. 4. Paste the results. Part 5: Views You notice that you are constantly doing the above 2 joins. You decide to create views to easily have the above available, specifically: 1. Create a view called to BookingDetails which will display the guestNo, dateArrive, dateDepart, propertyNo, city, and state for all Bookings. 2. Paste the results of a Select * from BookingDetails. 3. Create a view called BookingComplete which will display the guestNo, firstName, lastName, propertyNo, price, city, and state for all Bookings. 4. Paste the results of a select * from BookingComplete. 5. Create a view called ExpensiveBooking which will display all the details only in the Booking table for those whose rent is greater than 500. 6. Paste the results select * from ExpensiveBooking. 7. Write the update statement to modify any one of the entries in Booking from a price of 500 to a price of 2000. 8. Paste the results select * from ExpensiveBooking. See what happened! 9. Create a view which will display the guestNo, dateArrive, dateDepart, propertyNo, city, and state for each Booking where the rent is greater than 500. You can name it whatever you want. 10. Paste the results of the view. 11. Create your own view that you feel would be helpful. 12. Paste the results. 13. Explain why you feel this view would be convenient! SELECT * FROM `Property`

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions