schema
stringlengths 144
5.45k
| question
stringlengths 16
224
| query
stringlengths 18
577
| hardness
stringclasses 5
values |
---|---|---|---|
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'. | SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%"; | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s? | SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%"; | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | How many lessons taught by staff whose first name has letter 'a' in it? | SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%" | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | How many lessons were taught by a staff member whose first name has the letter 'a' in it? | SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%" | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn? | SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is the total time for all lessons taught by Janessa Sawayn? | SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is average lesson price taught by staff with first name as Janessa and last name as Sawayn? | SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is the average price for a lesson taught by Janessa Sawayn? | SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"; | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | How many lesson does customer with first name Ray took? | SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray" | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | How many lessons did the customer with the first name Ray take? | SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray" | medium |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | Which last names are both used by customers and by staff? | SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What are the last names that are used by customers and staff? | SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is the first name of the staff who did not give any lesson? | SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is the first name of all employees who do not give any lessons? | SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id | hard |
CREATE TABLE Addresses (address_id number, line_1_number_building text, city text, zip_postcode text, state_province_county text, country text); CREATE TABLE Staff (staff_id number, staff_address_id number, nickname text, first_name text, middle_name text, last_name text, date_of_birth time, date_joined_staff time, date_left_staff time); CREATE TABLE Vehicles (vehicle_id number, vehicle_details text); CREATE TABLE Customers (customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text); CREATE TABLE Customer_Payments (customer_id number, datetime_payment time, payment_method_code text, amount_payment number); CREATE TABLE Lessons (lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number); | What is the id and detail of the vehicle used in lessons for most of the times? | SELECT T1.vehicle_id , T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY count(*) DESC LIMIT 1 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty do we have? | SELECT count(*) FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the total number of faculty members? | SELECT count(*) FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What ranks do we have for faculty? | SELECT DISTINCT rank FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the list of distinct ranks for faculty. | SELECT DISTINCT rank FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the distinct buildings that have faculty rooms. | SELECT DISTINCT building FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What buildings have faculty offices? | SELECT DISTINCT building FROM Faculty | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the rank, first name, and last name for all the faculty. | SELECT rank , Fname , Lname FROM Faculty | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the rank, first name, and last name of the faculty members? | SELECT rank , Fname , Lname FROM Faculty | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the first name, last name, and phone number for all female faculty members. | SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F' | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the first name, last name, and phone number of all the female faculty members? | SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F' | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show ids for all the male faculty. | SELECT FacID FROM Faculty WHERE Sex = 'M' | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the faculty ids of all the male faculty members? | SELECT FacID FROM Faculty WHERE Sex = 'M' | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many female Professors do we have? | SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Count the number of female Professors we have. | SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the phone, room, and building for the faculty named Jerry Prince. | SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the phone, room, and building of the faculty member called Jerry Prince? | SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many Professors are in building NEB? | SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Count the number of Professors who have office in building NEB. | SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the first name and last name for all the instructors. | SELECT fname , lname FROM Faculty WHERE Rank = "Instructor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the first name and last name of all the instructors? | SELECT fname , lname FROM Faculty WHERE Rank = "Instructor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the buildings along with the number of faculty members the buildings have. | SELECT building , count(*) FROM Faculty GROUP BY building | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty members does each building have? List the result with the name of the building. | SELECT building , count(*) FROM Faculty GROUP BY building | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which building has most faculty members? | SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the building that has the largest number of faculty members. | SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the buildings that have at least 10 professors. | SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10 | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | In which buildings are there at least ten professors? | SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10 | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | For each faculty rank, show the number of faculty members who have it. | SELECT rank , count(*) FROM Faculty GROUP BY rank | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty members do we have for each faculty rank? | SELECT rank , count(*) FROM Faculty GROUP BY rank | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the ranks and the number of male and female faculty for each rank. | SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty members do we have for each rank and gender? | SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which rank has the smallest number of faculty members? | SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the faculty rank that has the least members. | SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the number of male and female assistant professors. | SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many male and female assistant professors do we have? | SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the first name and last name of Linda Smith's advisor? | 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" | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Who is the advisor of Linda Smith? Give me the first name and last name. | 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" | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids of students whose advisors are professors. | SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which students have professors as their advisors? Find their student ids. | SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show first name and last name for all the students advised by Michael Goodrich. | 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" | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which students are advised by Michael Goodrich? Give me their first and last names. | 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" | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the faculty id of each faculty member, along with the number of students he or she advises. | SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the faculty id and the number of students each faculty has? | SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the faculty ranks and the number of students advised by each rank. | SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many students are advised by each rank of faculty? List the rank and the number of students. | SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the first and last name of the faculty who has the most students? | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Give me the the first and last name of the faculty who advises the most students. | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids for all the faculty members who have at least 2 students. | SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2 | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which faculty members advise two ore more students? Give me their faculty ids. | SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2 | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show ids for the faculty members who don't advise any student. | SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the ids of the faculty members who do not advise any student. | SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What activities do we have? | SELECT activity_name FROM Activity | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | List all the activities we have. | SELECT activity_name FROM Activity | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many activities do we have? | SELECT count(*) FROM Activity | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the number of activities available. | SELECT count(*) FROM Activity | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty members participate in an activity? | SELECT count(DISTINCT FacID) FROM Faculty_participates_in | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Give me the number of faculty members who participate in an activity | SELECT count(DISTINCT FacID) FROM Faculty_participates_in | easy |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids of the faculty who don't participate in any activity. | SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which faculty do not participate in any activity? Find their faculty ids. | SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids of all the faculty members who participate in an activity and advise a student. | SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are ids of the faculty members who not only participate in an activity but also advise a student. | SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many activities does Mark Giuliano participate in? | 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" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the number of activities Mark Giuliano is involved in. | 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" | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the names of all the activities Mark Giuliano participates in. | 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" | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the names of the activities Mark Giuliano is involved in | 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" | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | 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. | SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in. | SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show all the activity names and the number of faculty involved in each activity. | SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | How many faculty members participate in each activity? Return the activity names and the number of faculty members. | SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID | medium |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the first and last name of the faculty participating in the most activities? | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the first and last name of the faculty who is involved in the largest number of activities. | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the name of the activity that has the most faculty members involved in? | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which activity has the most faculty members participating in? Find the activity name. | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids of the students who don't participate in any activity. | SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the ids of the students who are not involved in any activity | SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Show the ids for all the students who participate in an activity and are under 20. | SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the ids of the students who are under 20 years old and are involved in at least one activity. | SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20 | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the first and last name of the student participating in the most activities? | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Tell me the first and last name of the student who has the most activities. | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What is the name of the activity with the most students? | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the name of the activity that has the largest number of student participants. | 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 | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the first names of the faculty members who are playing Canoeing or Kayaking. | SELECT DISTINCT T1.lname 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' | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Which faculty members are playing either Canoeing or Kayaking? Tell me their first names. | SELECT DISTINCT T1.lname 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' | extra |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the first names of professors who are not playing Canoeing or Kayaking. | SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname 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' | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | What are the first names of the professors who do not play Canoeing or Kayaking as activities? | SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname 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' | hard |
CREATE TABLE Activity (actid number, activity_name text); CREATE TABLE Participates_in (stuid number, actid number); CREATE TABLE Faculty_Participates_in (FacID number, actid number); CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Faculty (FacID number, Lname text, Fname text, Rank text, Sex text, Phone number, Room text, Building text); | Find the first names of the faculty members who participate in Canoeing and Kayaking. | SELECT T1.lname 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.lname 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 = 'Kayaking' | extra |