Database: inn_1

Question: What are the first and last names of people who payed more than the rooms' base prices?
SQL: SELECT T1.firstname ,  T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId WHERE T1.Rate - T2.basePrice  >  0

Question: What is the total number of rooms available in this inn?
SQL: SELECT count(*) FROM Rooms;

Question: How many rooms have a king bed?
SQL: SELECT count(*) FROM Rooms WHERE bedType  =  "King";

Question: What are the number of rooms for each bed type?
SQL: SELECT bedType ,  count(*) FROM Rooms GROUP BY bedType;

Question: What is the name of the room that can accommodate the most people?
SQL: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1;

Question: Which room has the highest base price?
SQL: SELECT RoomId ,  roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1;

Question: What are the bed type and name of all the rooms with traditional decor?
SQL: SELECT roomName ,  bedType FROM Rooms WHERE decor = "traditional";

Question: How many rooms have king beds? Report the number for each decor type.
SQL: SELECT decor ,  count(*) FROM Rooms WHERE bedType = "King" GROUP BY decor;

Question: What is the average minimum and price of the rooms for each different decor.
SQL: SELECT decor , avg(basePrice) ,  min(basePrice) FROM Rooms GROUP BY decor;

Question: Sort all the rooms according to the price. Just report the room names.
SQL: SELECT roomName FROM Rooms ORDER BY basePrice;

Question: How many rooms cost more than 120, for each different decor?
SQL: SELECT decor , count(*) FROM Rooms WHERE basePrice  >  120 GROUP BY decor;

Question: What is the average base price of rooms, for each bed type?
SQL: SELECT bedType ,  avg(basePrice) FROM Rooms GROUP BY bedType;

Question: What are the names of rooms that have either king or queen bed?
SQL: SELECT roomName FROM Rooms WHERE bedType  =  "King" OR bedType  =  "Queen";

Question: Find the number of distinct bed types available in this inn.
SQL: SELECT count(DISTINCT bedType) FROM Rooms;

Question: What are the name and id of the three highest priced rooms?
SQL: SELECT RoomId ,  roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3;

Question: What are the name of rooms that cost more than the average.
SQL: SELECT roomName FROM Rooms WHERE basePrice  >  ( SELECT avg(basePrice) FROM Rooms );

Question: How many rooms have not had any reservation yet?
SQL: SELECT count(*) FROM rooms WHERE roomid NOT IN (SELECT DISTINCT room FROM reservations)

Question: For each room, find its name and the number of times reservations were made for it.
SQL: SELECT T2.roomName ,  count(*) ,  T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId GROUP BY T1.Room

Question: What are the names of rooms whose reservation frequency exceeds 60 times?
SQL: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId GROUP BY T1.Room HAVING count(*)  >  60

Question: Which rooms cost between 120 and 150? Give me the room names.
SQL: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150