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
which rooms have reservations ?
assistant
SELECT DISTINCT room FROM reservations;
human
show me the average number of beds of the rooms with reservations.
assistant
SELECT AVG ( beds ) FROM rooms WHERE roomid IN ( SELECT DISTINCT room FROM reservations );
human
how about the rooms that do not have any reservations ?
assistant
SELECT AVG ( beds ) FROM rooms WHERE roomid NOT IN ( SELECT DISTINCT room FROM reservations );
human
what are the number of rooms that do not have any reservations ?
assistant
SELECT COUNT( * ) FROM rooms WHERE roomid NOT IN ( SELECT DISTINCT room FROM reservations ) ;