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 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 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
List the name of all rooms sorted by their prices.
assistant
SELECT roomName FROM Rooms ORDER BY basePrice;
human
Which room has cheapest base price? List the room's name and the base price.
assistant
SELECT roomName , basePrice FROM Rooms ORDER BY basePrice ASC LIMIT 1;
human
Find the number of rooms with price higher than 120 for different decor.
assistant
SELECT decor , count(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor;
human
What is the average minimum and price of the rooms for each different decor.
assistant
SELECT decor , avg ( basePrice ) , MIN( basePrice ) FROM Rooms GROUP BY decor ;