human
Schema:
Rooms (RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor)
Reservations (Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the names of rooms that have been reserved for more than 60 times.
assistant
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING count(*) > 60
human
What kind of decor has the least number of reservations?
assistant
SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY count(T2.decor) ASC LIMIT 1;
human
What is the total number of people who could stay in the modern rooms in this inn?
assistant
SELECT sum(maxOccupancy) FROM Rooms WHERE decor = 'modern';
human
Return the name and number of reservations made for each of the rooms.
assistant
SELECT T2.roomName , count(*) , T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room
human
How many rooms are there?
assistant
SELECT count(*) FROM Rooms;
human
How many rooms have not had any reservation yet?
assistant
SELECT COUNT( * ) FROM rooms WHERE roomid NOT IN ( SELECT DISTINCT room FROM reservations ) ;