Question: Using the property relational schema, ( repeated here for your convenience and as described on the previous page ) , write SQL queries to satisfy

Using the property relational schema, (repeated here for your convenience and as described on the previous page), write SQL queries to satisfy the following information needs:
property(pID, region, county, eircode, numBeds, numBaths, capacity, pricePerNight, petsAllowed, propAmens, ownrID)
owner(oID, oName, oAddress, oEmail, oPhone)
customer(cID, cName, cAddress, cEmail, cPhone)
propBooking (bID, startDate, endDate, numPpl, totalPrice, custID, propID)
(a) Choosing suitable data types, write the SQL code required to create the propBooking table, including all key constraints. You may assume the other tables already exist in the database. (5)
(b) List the property details (beds, baths, price, capacity) of all properties in the region Clifden, ordered by price per night. (5)
(c) Using the explicit join syntax, find the start date, end date and total price of the booking by the customer with the name Jenny Joyce.(5)
(d) Using the implicit join syntax, find the total amount of rental money earned by the property owner with the name Andy Walsh from bookings of his rental properties this year (since 2023-01-01).(5)
(e) List the addresses of properties whose price per night is greater than the average price per night of all properties. (5)
(f) Find the number of properties which do not have any bookings between the dates 2023-09-01 and 2023-10-01.(5)
(g) For each property, find the number of bookings associated with the property and the total amount earned in rental income per property, for properties in Co. Dublin. (5)
(h) List the names and email addresses of the owners whose properties have had more than 30 bookings this year (since 2023-01-01).(5)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!