Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ok we\'ve been given the following tables Hotel (hno,name,address) Room (rno,hno

ID: 3828216 • Letter: O

Question

Ok we've been given the following tables

Hotel (hno,name,address)
Room (rno,hno,type,price)
Booking (hno,gno,dateFrom,dateTo,rno)
Guest (gno,name,address)

and a few SQL queries to write,(stuck on these for a while now, please help out)

For the date 26 March 1997, perform the following queries

(a)calculate the total income for the Grosvenor hotel

(b)List the unoccupied rooms in the Grosvenor Hotel

(c)Calculate the lost income from unoccupied rooms at the Grosvenor Hotel

(d)List the details of all rooms in all hotels, including the name of any guests who were staying in the room

Explanation / Answer

a)

SELECT SUM(price) FROM Booking b, Room r, Hotel h
WHERE r.hno = h.hno AND r.rno = b.rno;

b)


SELECT * FROM room r
WHERE rno NOT IN
(SELECT rno FROM Booking b, Hotel h
WHERE b.hno = h.hno AND h.name = 'Grosvenor');


c)

SELECT SUM(price) FROM Room r
WHERE rno NOT IN
(SELECT rno FROM booking b, hotel h
WHERE b.hno = h.hno AND h.name = 'Grosvenor');

d)

SELECT * FROM Guest
WHERE gno=
(SELECT gno FROM Booking
WHERE hno = (SELECT hno FROM Hotel));

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote