database_id
stringlengths
4
31
query
stringlengths
22
577
question
stringlengths
19
224
csu_1
SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939
Which campus was opened between 1935 and 1939?
csu_1
SELECT campus FROM campuses WHERE LOCATION = "Northridge" AND county = "Los Angeles" UNION SELECT campus FROM campuses WHERE LOCATION = "San Francisco" AND county = "San Francisco"
Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco.
csu_1
SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = "San Jose State University" AND T2.year = 1996
What is the campus fee of "San Jose State University" in year 1996?
csu_1
SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = "San Francisco State University" AND T2.year = 1996
What is the campus fee of "San Francisco State University" in year 1996?
csu_1
SELECT count(*) FROM csu_fees WHERE campusfee > (SELECT avg(campusfee) FROM csu_fees)
Find the count of universities whose campus fee is greater than the average campus fee.
csu_1
SELECT campus FROM campuses WHERE county = "Los Angeles" AND YEAR > 1950
Which university is in Los Angeles county and opened after 1950?
csu_1
SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY sum(degrees) DESC LIMIT 1
Which year has the most degrees conferred?
csu_1
SELECT campus FROM degrees GROUP BY campus ORDER BY sum(degrees) DESC LIMIT 1
Which campus has the most degrees conferred in all times?
csu_1
SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1
Which campus has the most faculties in year 2003?
csu_1
SELECT T1.campus , sum(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T2.year >= 1998 AND T2.year <= 2002 GROUP BY T1.campus
report the total number of degrees granted between 1998 and 2002 in each campus.
csu_1
SELECT T1.campus , sum(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = "Orange" AND T2.year >= 2000 GROUP BY T1.campus
For each Orange county campus, report the number of degrees granted after 2000.
csu_1
SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND faculty > (SELECT max(faculty) FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND T1.county = "Orange")
Find the names of the campus which has more faculties in 2002 than every campus in Orange county.
csu_1
SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND FTE_AY > 200
What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956?
csu_1
SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = "San Jose State University" AND t2.year = 2000
How many degrees were conferred in "San Jose State University" in 2000?
csu_1
SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2002 AND T2.campus = "Long Beach State University"
What is the number of faculty lines in campus "Long Beach State University" in 2002?
csu_1
SELECT T1.campus FROM campuses AS t1 JOIN faculty AS t2 ON t1.id = t2.campus WHERE t2.faculty >= 600 AND t2.faculty <= 1000 AND T2.year = 2004
List the campus that have between 600 and 1000 faculty lines in year 2004.
csu_1
SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1
How many faculty lines are there in the university that conferred the most number of degrees in year 2002?
csu_1
SELECT sum(t1.undergraduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = "San Jose State University"
How many undergraduates are there in "San Jose State University" in year 2004?
csu_1
SELECT sum(t1.graduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = "San Francisco State University"
What is the number of graduates in "San Francisco State University" in year 2004?
csu_1
SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = "San Francisco State University" AND t1.year = 2000
What is the campus fee of "San Francisco State University" in year 2000?
activity_1
SELECT count(*) FROM Faculty
How many faculty do we have?
activity_1
SELECT DISTINCT rank FROM Faculty
What ranks do we have for faculty?
activity_1
SELECT DISTINCT building FROM Faculty
Show all the distinct buildings that have faculty rooms.
activity_1
SELECT rank , Fname , Lname FROM Faculty
Show the rank, first name, and last name for all the faculty.
activity_1
SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F'
Show the first name, last name, and phone number for all female faculty members.
activity_1
SELECT FacID FROM Faculty WHERE Sex = 'M'
Show ids for all the male faculty.
activity_1
SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
How many female Professors do we have?
activity_1
SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
Show the phone, room, and building for the faculty named Jerry Prince.
activity_1
SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
How many Professors are in building NEB?
activity_1
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
Show the first name and last name for all the instructors.
activity_1
SELECT building , count(*) FROM Faculty GROUP BY building
Show all the buildings along with the number of faculty members the buildings have.
activity_1
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Which building has most faculty members?
activity_1
SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10
Show all the buildings that have at least 10 professors.
activity_1
SELECT rank , count(*) FROM Faculty GROUP BY rank
For each faculty rank, show the number of faculty members who have it.
activity_1
SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex
Show all the ranks and the number of male and female faculty for each rank.
activity_1
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Which rank has the smallest number of faculty members?
activity_1
SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
Show the number of male and female assistant professors.
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
What are the first name and last name of Linda Smith's advisor?
activity_1
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
Show the ids of students whose advisors are professors.
activity_1
SELECT T2.fname , T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Show first name and last name for all the students advised by Michael Goodrich.
activity_1
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
Show the faculty id of each faculty member, along with the number of students he or she advises.
activity_1
SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
Show all the faculty ranks and the number of students advised by each rank.
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
What are the first and last name of the faculty who has the most students?
activity_1
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
Show the ids for all the faculty members who have at least 2 students.
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
Show ids for the faculty members who don't advise any student.
activity_1
SELECT activity_name FROM Activity
What activities do we have?
activity_1
SELECT count(*) FROM Activity
How many activities do we have?
activity_1
SELECT count(DISTINCT FacID) FROM Faculty_participates_in
How many faculty members participate in an activity?
activity_1
SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
Show the ids of the faculty who don't participate in any activity.
activity_1
SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
Show the ids of all the faculty members who participate in an activity and advise a student.
activity_1
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
How many activities does Mark Giuliano participate in?
activity_1
SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Show the names of all the activities Mark Giuliano participates in.
activity_1
SELECT T1.fname , T1.lname , count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.
activity_1
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
Show all the activity names and the number of faculty involved in each activity.
activity_1
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the faculty participating in the most activities?
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity that has the most faculty members involved in?
activity_1
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
Show the ids of the students who don't participate in any activity.
activity_1
SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
Show the ids for all the students who participate in an activity and are under 20.
activity_1
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the student participating in the most activities?
activity_1
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity with the most students?
activity_1
SELECT DISTINCT T1.fname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of the faculty members who are playing Canoeing or Kayaking.
activity_1
SELECT fname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.fname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of professors who are not playing Canoeing or Kayaking.
activity_1
SELECT T1.fname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.fname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T...
Find the first names of the faculty members who participate in Canoeing and Kayaking.
workshop_paper
SELECT Author FROM submission WHERE College = "Florida" OR College = "Temple"
Show the names of authors from college "Florida" or "Temple"
workshop_paper
SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1
What is the author of the submission with the highest score?
workshop_paper
SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1
Show the most common college of authors of submissions.
workshop_paper
SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.
workshop_paper
SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
Show the result of the submission with the highest score.
workshop_paper
SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author
Show each author and the number of workshops they submitted to.
workshop_paper
SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1
Show the authors who have submissions to more than one workshop.
race_track
SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating
Show names and seatings, ordered by seating for all tracks opened after 2000.
race_track
SELECT name , LOCATION , seating FROM track ORDER BY year_opened DESC LIMIT 1
What is the name, location and seating for the most recently opened track?
race_track
SELECT min(seating) , max(seating) , avg(seating) FROM track
What is the minimum, maximum, and average seating for all tracks.
race_track
SELECT name , LOCATION , year_opened FROM track WHERE seating > (SELECT avg(seating) FROM track)
Show the name, location, open year for all tracks with a seating higher than the average.
race_track
SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
What is the race class with most number of races.
race_track
SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2
List the race class with at least two races.
race_track
SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'
What are the names for tracks without a race in class 'GT'.
race_track
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
Show all track names that have had no races.
race_track
SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id
Show the name of track and the number of races in each track.
race_track
SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1
Show the name of track with most number of races.
race_track
SELECT T2.name , T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING count(*) = 1
Show the name and location of track with 1 race.
apartment_rentals
SELECT count(*) FROM Apartment_Bookings
How many apartment bookings are there in total?
apartment_rentals
SELECT booking_start_date , booking_end_date FROM Apartment_Bookings
Show the start dates and end dates of all the apartment bookings.
apartment_rentals
SELECT DISTINCT building_description FROM Apartment_Buildings
Show all distinct building descriptions.
apartment_rentals
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma"
Show the short names of the buildings managed by "Emma".
apartment_rentals
SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden"
Show the addresses and phones of all the buildings managed by "Brenden".
apartment_rentals
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
What are the building full names that contain the word "court"?
apartment_rentals
SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments
What is the minimum and maximum number of bathrooms of all the apartments?
apartment_rentals
SELECT avg(bedroom_count) FROM Apartments
What is the average number of bedrooms of all apartments?
apartment_rentals
SELECT apt_number , room_count FROM Apartments
Return the apartment number and the number of rooms for each apartment.
apartment_rentals
SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio"
What is the average number of rooms of apartments with type code "Studio"?
apartment_rentals
SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat"
Return the apartment numbers of the apartments with type code "Flat".
apartment_rentals
SELECT guest_first_name , guest_last_name FROM Guests
Return the first names and last names of all guests
apartment_rentals
SELECT date_of_birth FROM Guests WHERE gender_code = "Male"
Return the date of birth for all the guests with gender code "Male".
apartment_rentals
SELECT T2.apt_number , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id
Show the apartment numbers, start dates, and end dates of all the apartment bookings.
apartment_rentals
SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex"
What are the booking start and end dates of the apartments with type code "Duplex"?
apartment_rentals
SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2
What are the booking start and end dates of the apartments with more than 2 bedrooms?
apartment_rentals
SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = "Suite 634"
What is the booking status code of the apartment with apartment number "Suite 634"?
apartment_rentals
SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed"
Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".
apartment_rentals
SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
Show the average room count of the apartments that have booking status code "Provisional".