database_id
stringlengths 4
31
| query
stringlengths 22
577
| question
stringlengths 19
224
|
---|---|---|
college_1 | SELECT dept_name FROM department ORDER BY dept_name | What are the names of all departments in alphabetical order? |
college_1 | SELECT class_code FROM CLASS WHERE class_room = 'KLR209' | What are the codes of all the courses that are located in room KLR209? |
college_1 | SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob | What are the first names of all employees that are professors ordered by date of birth? |
college_1 | SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname | What are the first names and office locations for all professors sorted alphabetically by first name? |
college_1 | SELECT emp_fname , emp_lname FROM employee ORDER BY emp_dob LIMIT 1 | What are the first and last names of the employee with the earliest date of birth? |
college_1 | SELECT stu_fname , stu_lname , stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1 | What is the first and last name of the youngest student with a GPA above 3, and what is their GPA? |
college_1 | SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C' | What are the first names of all students who got a grade C in a class? |
college_1 | SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) LIMIT 1 | What is the name of the department with the fewest professors? |
college_1 | SELECT T2.dept_name , T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1 | Which department has the most professors with a Ph.D.? |
college_1 | SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num | What are the first names of all professors not teaching any classes? |
college_1 | SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num | What are the first names of all history professors who do not teach? |
college_1 | SELECT T1.emp_lname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' | What are the last name and office of all history professors? |
college_1 | SELECT T3.dept_name , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington' | What is the name of the department and office location for the professor with the last name of Heffington? |
college_1 | SELECT T1.emp_lname , T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102' | What is the last name of the professor whose office is located in DRE 102, and when were they hired? |
college_1 | SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson' | What are the course codes for every class that the student with the last name Smithson took? |
college_1 | SELECT T4.crs_description , T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson' | How many credits is the course that the student with the last name Smithson took, and what is its description? |
college_1 | SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA' | How many professors attained either Ph.D. or Masters degrees? |
college_1 | SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology' | What is the number of professors who are in the Accounting or Biology departments? |
college_1 | SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261' | What is the first name of the professor who is teaching CIS-220 and QM-261? |
college_1 | SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems' | What are the first names of all students taking accoutning and Computer Information Systems classes? |
college_1 | SELECT avg(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' | What is the average GPA of students taking ACCT-211? |
college_1 | SELECT stu_gpa , stu_phone , stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5 | What is the first name, GPA, and phone number of the students with the top 5 GPAs? |
college_1 | SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1 | What is the name of the department with the student that has the lowest GPA? |
college_1 | SELECT stu_fname , stu_gpa FROM student WHERE stu_gpa < (SELECT avg(stu_gpa) FROM student) | What is the first name and GPA of every student that has a GPA lower than average? |
college_1 | SELECT T2.dept_name , T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1 | What is the name and address of the department with the most students? |
college_1 | SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3 | What is the name, address, and number of students in the departments that have the 3 most students? |
college_1 | SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.' | What are the first names and office of the professors who are in the history department and have a Ph.D? |
college_1 | SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num | What are the first names of all teachers who have taught a course and the corresponding course codes? |
college_1 | SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code | What are the first names of all teachers who have taught a course and the corresponding descriptions? |
college_1 | SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num | What are the first names, office locations of all lecturers who have taught some course? |
college_1 | SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code | What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach? |
college_1 | SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code | What are the names of all students who took a class and the corresponding course descriptions? |
college_1 | SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A' | What are the names of all students taking a course who received an A or C? |
college_1 | SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting' | What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach? |
college_1 | SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems' | What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department? |
college_1 | SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018 | What is the last name of the student who received an A in the class with the code 10018? |
college_1 | SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree ! = 'Ph.D.' | What are the first names and offices of history professors who don't have Ph.D.s? |
college_1 | SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1 | What are the first names of all professors who teach more than one class? |
college_1 | SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1 | What are the first names of student who only took one course? |
college_1 | SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%' | What is the name of the department that offers a course that has a description including the word "Statistics"? |
college_1 | SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%' | What is the first name of the student whose last name starts with the letter S and is taking ACCT-211? |
inn_1 | SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern'; | What are the names of modern rooms that have a base price lower than $160 and two beds. |
inn_1 | SELECT roomName , RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2; | What are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people. |
inn_1 | 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; | Which room has the largest number of reservations? |
inn_1 | SELECT kids FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY"; | Find the number of kids staying in the rooms reserved by a person called ROY SWEAZ. |
inn_1 | SELECT count(*) FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY"; | Find the number of times ROY SWEAZY has reserved a room. |
inn_1 | 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; | Return the name, rate, check in and check out date for the room with the highest rate. |
inn_1 | SELECT Adults FROM Reservations WHERE CheckIn = "2010-10-23" AND FirstName = "CONRAD" AND LastName = "SELBIG"; | Find the number of adults for the room reserved and checked in by CONRAD SELBIG on Oct 23, 2010. |
inn_1 | SELECT Kids FROM Reservations WHERE CheckIn = "2010-09-21" AND FirstName = "DAMIEN" AND LastName = "TRACHSEL"; | Return the number of kids for the room reserved and checked in by DAMIEN TRACHSEL on Sep 21, 2010. |
inn_1 | SELECT sum(beds) FROM Rooms WHERE bedtype = 'King'; | Find the total number of king beds available. |
inn_1 | SELECT roomName , decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice; | What are the names and decor of rooms with a king bed? Sort them by their price |
inn_1 | SELECT roomName , basePrice FROM Rooms ORDER BY basePrice ASC LIMIT 1; | What are the room name and base price of the room with the lowest base price? |
inn_1 | SELECT decor FROM Rooms WHERE roomName = "Recluse and defiance"; | Return the decor of the room named "Recluse and defiance". |
inn_1 | SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType; | For each bed type, find the average base price of different bed type. |
inn_1 | SELECT sum(maxOccupancy) FROM Rooms WHERE decor = 'modern'; | How many people in total can stay in the modern rooms of this inn? |
inn_1 | 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; | What is the least popular kind of decor? |
inn_1 | SELECT count(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids; | How many times the number of adults and kids staying in a room reached the maximum capacity of the room? |
inn_1 | SELECT T1.firstname , T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0 | What are the first and last names of people who payed more than the rooms' base prices? |
inn_1 | SELECT count(*) FROM Rooms; | What is the total number of rooms available in this inn? |
inn_1 | SELECT count(*) FROM Rooms WHERE bedType = "King"; | How many rooms have a king bed? |
inn_1 | SELECT bedType , count(*) FROM Rooms GROUP BY bedType; | What are the number of rooms for each bed type? |
inn_1 | SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1; | What is the name of the room that can accommodate the most people? |
inn_1 | SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1; | Which room has the highest base price? |
inn_1 | SELECT roomName , bedType FROM Rooms WHERE decor = "traditional"; | What are the bed type and name of all the rooms with traditional decor? |
inn_1 | SELECT decor , count(*) FROM Rooms WHERE bedType = "King" GROUP BY decor; | How many rooms have king beds? Report the number for each decor type. |
inn_1 | SELECT decor , avg(basePrice) , min(basePrice) FROM Rooms GROUP BY decor; | What is the average minimum and price of the rooms for each different decor. |
inn_1 | SELECT roomName FROM Rooms ORDER BY basePrice; | Sort all the rooms according to the price. Just report the room names. |
inn_1 | SELECT decor , count(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor; | How many rooms cost more than 120, for each different decor? |
inn_1 | SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType; | What is the average base price of rooms, for each bed type? |
inn_1 | SELECT roomName FROM Rooms WHERE bedType = "King" OR bedType = "Queen"; | What are the names of rooms that have either king or queen bed? |
inn_1 | SELECT count(DISTINCT bedType) FROM Rooms; | Find the number of distinct bed types available in this inn. |
inn_1 | SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3; | What are the name and id of the three highest priced rooms? |
inn_1 | SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms ); | What are the name of rooms that cost more than the average. |
inn_1 | SELECT count(*) FROM rooms WHERE roomid NOT IN (SELECT DISTINCT room FROM reservations) | How many rooms have not had any reservation yet? |
inn_1 | SELECT T2.roomName , count(*) , T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room | For each room, find its name and the number of times reservations were made for it. |
inn_1 | SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING count(*) > 60 | What are the names of rooms whose reservation frequency exceeds 60 times? |
inn_1 | SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150 | Which rooms cost between 120 and 150? Give me the room names. |
inn_1 | SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%' | What are the name of rooms booked by customers whose first name has "ROY" in part? |
allergy_1 | SELECT count(DISTINCT allergy) FROM Allergy_type | How many allergy entries are there? |
allergy_1 | SELECT count(DISTINCT allergytype) FROM Allergy_type | How many distinct allergies are there? |
allergy_1 | SELECT DISTINCT allergytype FROM Allergy_type | What are the different allergy types? |
allergy_1 | SELECT allergy , allergytype FROM Allergy_type | What are the allergies and their types? |
allergy_1 | SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food" | What are all the different food allergies? |
allergy_1 | SELECT allergytype FROM Allergy_type WHERE allergy = "Cat" | What is allergy type of a cat allergy? |
allergy_1 | SELECT count(*) FROM Allergy_type WHERE allergytype = "animal" | How many animal type allergies exist? |
allergy_1 | SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype | What are the allergy types and how many allergies correspond to each one? |
allergy_1 | SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1 | Which allergy type is most common? |
allergy_1 | SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1 | Which allergy type is the least common? |
allergy_1 | SELECT count(*) FROM Student | What is the total number of students? |
allergy_1 | SELECT Fname , Lname FROM Student | What are the full names of all students |
allergy_1 | SELECT count(DISTINCT advisor) FROM Student | How many advisors are there? |
allergy_1 | SELECT DISTINCT Major FROM Student | What are the different majors? |
allergy_1 | SELECT DISTINCT city_code FROM Student | What cities do students live in? |
allergy_1 | SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F' | What are the full names and ages for all female students whose sex is F? |
allergy_1 | SELECT StuID FROM Student WHERE Sex = 'M' | What are the student ids for all male students? |
allergy_1 | SELECT count(*) FROM Student WHERE age = 18 | How many students are 18 years old? |
allergy_1 | SELECT StuID FROM Student WHERE age > 20 | What are the student ids for students over 20 years old? |
allergy_1 | SELECT city_code FROM Student WHERE LName = "Kim" | Give the city that the student whose family name is Kim lives in. |
allergy_1 | SELECT Advisor FROM Student WHERE StuID = 1004 | Who advises student 1004? |
allergy_1 | SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI" | Give the number of students living in either HKG or CHI. |
Subsets and Splits