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
How many different types of beds are there?
assistant
SELECT count(DISTINCT bedType) FROM Rooms;
human
Find the name of rooms whose price is higher than the average price.
assistant
SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );
human
Find the average and minimum price of the rooms in different decor.
assistant
SELECT decor , avg(basePrice) , min(basePrice) FROM Rooms GROUP BY decor;
human
Find the names of all modern rooms with a base price below $160 and two beds.
assistant
SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern';
human
Find the number of rooms for each bed type.
assistant
SELECT bedType , count(*) FROM Rooms GROUP BY bedType;
human
For each bed type, find the average base price of different bed type.
assistant
SELECT bedType , avg ( basePrice ) FROM Rooms GROUP BY bedType ;