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 number of rooms for each bed type.
assistant
SELECT bedType , count(*) FROM Rooms GROUP BY bedType;
human
How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010?
assistant
SELECT Adults FROM Reservations WHERE CheckIn = '2010-10-23' AND FirstName = 'CONRAD' AND LastName = 'SELBIG';
human
Find the name of the room with the maximum occupancy.
assistant
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1;
human
How many rooms are there?
assistant
SELECT count(*) FROM Rooms;
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
How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
assistant
SELECT COUNT( * ) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids ;