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
What is the maximum capacity of each room?
assistant
SELECT maxOccupancy FROM Rooms;
human
What is the number of people who actually stayed for each room reservation? The number of people include adults and kids.
assistant
SELECT T1.Adults + T1.Kids FROM Reservations AS T1;
human
How many times the number reached the maximum capacity?
assistant
SELECT COUNT( * ) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids ;