Database: inn_1

Question: What are the names of modern rooms that have a base price lower than $160 and two beds.
SQL: SELECT roomName FROM Rooms WHERE basePrice  <  160 AND beds =  2 AND decor  =  'modern';

Question: What are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people.
SQL: SELECT roomName ,  RoomId FROM Rooms WHERE basePrice  >  160 AND maxOccupancy  >  2;

Question: Which room has the largest number of reservations?
SQL: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId GROUP BY T1.Room ORDER BY count(*) DESC LIMIT 1;

Question: Find the number of kids staying in the rooms reserved by a person called ROY SWEAZ.
SQL: SELECT kids FROM Reservations WHERE FirstName = "ROY" AND LastName  =  "SWEAZY";

Question: Find the number of times ROY SWEAZY has reserved a room.
SQL: SELECT count(*) FROM Reservations WHERE FirstName = "ROY" AND LastName  =  "SWEAZY";

Question: Return the name, rate, check in and check out date for the room with the highest rate.
SQL: SELECT T2.roomName ,  T1.Rate ,  T1.CheckIn ,  T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1;

Question: Find the number of adults for the room reserved and checked in by CONRAD SELBIG on Oct 23, 2010.
SQL: SELECT Adults FROM Reservations WHERE CheckIn  =  "2010-10-23" AND FirstName  =  "CONRAD" AND LastName  =  "SELBIG";

Question: Return the number of kids for the room reserved and checked in by DAMIEN TRACHSEL on  Sep 21, 2010.
SQL: SELECT Kids FROM Reservations WHERE CheckIn  =  "2010-09-21" AND FirstName  =  "DAMIEN" AND LastName  =  "TRACHSEL";

Question: Find the total number of king beds available.
SQL: SELECT sum(beds) FROM Rooms WHERE bedtype  =  'King';

Question: What are the names and decor of rooms with a king bed? Sort them by their price
SQL: SELECT roomName ,  decor FROM Rooms WHERE bedtype  =  'King' ORDER BY basePrice;

Question: What are the room name and base price of the room with the lowest base price?
SQL: SELECT roomName ,  basePrice FROM Rooms ORDER BY basePrice ASC LIMIT 1;

Question: Return the decor of the room named "Recluse and defiance".
SQL: SELECT decor FROM Rooms WHERE roomName  =  "Recluse and defiance";

Question: For each bed type, find the average base price of different bed type.
SQL: SELECT bedType ,  avg(basePrice) FROM Rooms GROUP BY bedType;

Question: How many people in total can stay in the modern rooms of this inn?
SQL: SELECT sum(maxOccupancy) FROM Rooms WHERE decor  =  'modern';

Question: What is the least popular kind of decor?
SQL: SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId GROUP BY T2.decor ORDER BY count(T2.decor) ASC LIMIT 1;

Question: How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
SQL: SELECT count(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room  =  T2.RoomId WHERE T2.maxOccupancy  =  T1.Adults + T1.Kids;