Question:
Find the name and id of the good with the highest average rank.
Additional table information: table: epinions_1

Answer: SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rank) DESC LIMIT 1


Question:
Find the name of the department that offers the largest number of credits of all classes.
Additional table information: table: college_1

Answer: SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY SUM(T1.crs_credit) DESC LIMIT 1


Question:
Which grade is studying in room 105?
Additional table information: table: student_1

Answer: SELECT DISTINCT grade FROM list WHERE classroom = 105


Question:
What are the ids of the movies that are not reviewed by Brittany Harris.
Additional table information: table: movie_1

Answer: SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris'


Question:
What is the id of the trip that started from the station with the highest dock count?
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1


Question:
Return the name of each physician and the number of patients he or she treats.
Additional table information: table: hospital_1

Answer: SELECT T1.name, COUNT(*) FROM physician AS T1 JOIN patient AS T2 ON T1.employeeid = T2.PCP GROUP BY T1.employeeid


Question:
For each bed type, find the average room price.
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
show the titles, and authors or editors for all books made after the year 1989.
Additional table information: table: culture_company

Answer: SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989


Question:
How many unique classes are offered?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT class_code) FROM CLASS


Question:
What is the total number of purchases for members with level 6?
Additional table information: table: shop_membership

Answer: SELECT COUNT(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6


Question:
What are the three countries that the least players are from?
Additional table information: table: baseball_1

Answer: SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 3


Question:
Show the average amount of transactions for different investors.
Additional table information: table: tracking_share_transactions

Answer: SELECT investor_id, AVG(amount_of_transaction) FROM TRANSACTIONS GROUP BY investor_id


Question:
What is the highest, lowest, and average student GPA for every department?
Additional table information: table: college_1

Answer: SELECT MAX(stu_gpa), AVG(stu_gpa), MIN(stu_gpa), dept_code FROM student GROUP BY dept_code


Question:
Find the name of customers who do not have an saving account.
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'


Question:
Report all majors that have less than 3 students.
Additional table information: table: voter_2

Answer: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3


Question:
Show the nominees that have nominated musicals for both 'Tony Award' and 'Drama Desk Award'.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' INTERSECT SELECT Nominee FROM musical WHERE Award = 'Drama Desk Award'


Question:
How many distinct locations have the things with service detail 'Unsatisfied' been located in?
Additional table information: table: local_govt_and_lot

Answer: SELECT COUNT(DISTINCT T2.Location_Code) FROM Things AS T1 JOIN Timed_Locations_of_Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.service_details = 'Unsatisfied'


Question:
Which cities have regional population above 10000000?
Additional table information: table: city_record

Answer: SELECT city FROM city WHERE regional_population > 10000000


Question:
What are the titles of all movies that were not reviewed by Chris Jackson?
Additional table information: table: movie_1

Answer: SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson'


Question:
Which vocal type has the band mate with first name 'Marianne' played the most?
Additional table information: table: music_2

Answer: SELECT TYPE FROM vocals AS T1 JOIN band AS T2 ON T1.bandmate = T2.id WHERE firstname = 'Marianne' GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the complete description of the job of a researcher?
Additional table information: table: tracking_grants_for_research

Answer: SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher'


Question:
Show other account details for account with name 338.
Additional table information: table: customers_card_transactions

Answer: SELECT other_account_details FROM Accounts WHERE account_name = '338'


Question:
Which papers have 'Stephanie Weirich' as an author?
Additional table information: table: icfp_1

Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = 'Stephanie' AND t1.lname = 'Weirich'


Question:
Show the most common builder of railways.
Additional table information: table: railway

Answer: SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the ids for all the faculty members who have at least 2 students.
Additional table information: table: activity_1

Answer: SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING COUNT(*) >= 2


Question:
Please show the most common status of roller coasters.
Additional table information: table: roller_coaster

Answer: SELECT Status FROM roller_coaster GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names.
Additional table information: table: decoration_competition

Answer: SELECT T2.Name, T1.College_Location FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID ORDER BY T2.Name ASC NULLS FIRST


Question:
What are the themes of competitions that have corresponding host cities with more than 1000 residents?
Additional table information: table: farm

Answer: SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000


Question:
What are the names of the all-female dorms?
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm WHERE gender = 'F'


Question:
Find the full name and id of the college that has the most baseball players.
Additional table information: table: baseball_1

Answer: SELECT T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the average and minimum price (in Euro) of all products?
Additional table information: table: product_catalog

Answer: SELECT AVG(price_in_euros), MIN(price_in_euros) FROM catalog_contents


Question:
What are the names and hours spent practicing of every student who received a yes at tryouts?
Additional table information: table: soccer_2

Answer: SELECT T1.pName, T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'


Question:
What are the first and last name of all biology professors?
Additional table information: table: college_1

Answer: SELECT T3.EMP_FNAME, T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = 'Biology'


Question:
What are the names and locations of all tracks?
Additional table information: table: race_track

Answer: SELECT name, LOCATION FROM track


Question:
find the event names that have more than 2 records.
Additional table information: table: party_people

Answer: SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2


Question:
Show the names of roller coasters and names of country they are in.
Additional table information: table: roller_coaster

Answer: SELECT T2.Name, T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID


Question:
Show all document type codes, document type names, document type descriptions.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types


Question:
What is the id and last name of the driver who participated in the most races after 2010?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the crime rates of counties sorted by number of offices ascending?
Additional table information: table: county_public_safety

Answer: SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC NULLS FIRST


Question:
Show all student IDs who have at least two allergies.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2


Question:
What is the country that has the most perpetrators?
Additional table information: table: perpetrator

Answer: SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the details of all the markets that are accessible by walk or bus.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Market_Details FROM Street_Markets AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = 'walk' OR T2.How_to_Get_There = 'bus'


Question:
What are the vocal types used in song 'Le Pop'?
Additional table information: table: music_2

Answer: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Le Pop'


Question:
Find the name and salary of instructors who are advisors of the students from the Math department.
Additional table information: table: college_2

Answer: SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math'


Question:
What is the document type description for document type named Film?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_description FROM Ref_document_types WHERE document_type_name = 'Film'


Question:
What is the genre name of the film HUNGER ROOF?
Additional table information: table: sakila_1

Answer: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'


Question:
Find the names of the users whose number of followers is greater than that of the user named 'Tyler Swift'.
Additional table information: table: twitter_1

Answer: SELECT T1.name FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING COUNT(*) > (SELECT COUNT(*) FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 WHERE T1.name = 'Tyler Swift')


Question:
What are the birth places that are shared by at least two people?
Additional table information: table: body_builder

Answer: SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2


Question:
Give me the the first and last name of the faculty who advises the most students.
Additional table information: table: activity_1

Answer: 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


Question:
What is the first name and GPA of every student that has a GPA lower than average?
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_gpa FROM student WHERE stu_gpa < (SELECT AVG(stu_gpa) FROM student)


Question:
What are the average access counts of documents that have the functional area description 'Acknowledgement'?
Additional table information: table: document_management

Answer: SELECT AVG(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code = t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code = t3.functional_area_code WHERE t3.functional_area_description = 'Acknowledgement'


Question:
How many employees have salary between 100000 and 200000?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000


Question:
What is the first and last name of all students who are younger than average?
Additional table information: table: dorm_1

Answer: SELECT fname, lname FROM student WHERE age < (SELECT AVG(age) FROM student)


Question:
How many students does KAWA GORDON teaches?
Additional table information: table: student_1

Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = 'KAWA' AND T2.lastname = 'GORDON'


Question:
Return the color code and description for the product with the name 'chervil'.
Additional table information: table: products_gen_characteristics

Answer: SELECT t1.color_code, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = 'chervil'


Question:
What is the average cost of procedures that physician John Wen was trained in?
Additional table information: table: hospital_1

Answer: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = 'John Wen'


Question:
Show the names of climbers and the heights of mountains they climb.
Additional table information: table: climbing

Answer: SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


Question:
What are all the location codes and location names?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_code, location_name FROM Ref_locations


Question:
Find the maximum age of all the students.
Additional table information: table: voter_2

Answer: SELECT MAX(Age) FROM STUDENT


Question:
Return all the information for all employees without any department number.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE department_id = 'null'


Question:
Find the enrollment date for all the tests that have 'Pass' result.
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Pass'


Question:
What is the last name of the staff who has handled the first ever complaint?
Additional table information: table: customer_complaints

Answer: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised NULLS FIRST LIMIT 1


Question:
What are the id of each employee and the number of document destroyed by that employee?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT Destroyed_by_Employee_ID, COUNT(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID


Question:
What are the first names, office locations of all lecturers who have taught some course?
Additional table information: table: college_1

Answer: 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


Question:
Find the total and average amount paid in claim headers.
Additional table information: table: insurance_and_eClaims

Answer: SELECT SUM(amount_piad), AVG(amount_piad) FROM claim_headers


Question:
How many submissions are there?
Additional table information: table: workshop_paper

Answer: SELECT COUNT(*) FROM submission


Question:
What are the name and os of web client accelerators that do not work with only a 'Broadband' type connection?
Additional table information: table: browser_web

Answer: SELECT name, operating_system FROM web_client_accelerator WHERE CONNECTION <> 'Broadband'


Question:
Find the name and hours of the students whose tryout decision is yes.
Additional table information: table: soccer_2

Answer: SELECT T1.pName, T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'


Question:
find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.
Additional table information: table: aircraft

Answer: SELECT t1.name, t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of different ranks of captain.
Additional table information: table: ship_1

Answer: SELECT COUNT(DISTINCT rank) FROM captain


Question:
Find the titles of the papers that contain the word 'ML'.
Additional table information: table: icfp_1

Answer: SELECT title FROM papers WHERE title LIKE '%ML%'


Question:
Count the number of customers who have an account.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


Question:
Select the name of each manufacturer along with the name and price of its most expensive product.
Additional table information: table: manufactory_1

Answer: SELECT T1.Name, MAX(T1.Price), T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name


Question:
List all information about courses sorted by credits in the ascending order.
Additional table information: table: college_3

Answer: SELECT * FROM COURSE ORDER BY Credits NULLS FIRST


Question:
Which apartments have type code 'Flat'? Give me their apartment numbers.
Additional table information: table: apartment_rentals

Answer: SELECT apt_number FROM Apartments WHERE apt_type_code = 'Flat'


Question:
Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'SF'


Question:
Find the organisation type description of the organisation detailed as 'quo'.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.organisation_type_description FROM organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_details = 'quo'


Question:
Find the name of airline which runs the most number of routes.
Additional table information: table: flight_4

Answer: SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which apartment type code is the most common among apartments with more than one bathroom?
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all different home cities.
Additional table information: table: school_bus

Answer: SELECT DISTINCT home_city FROM driver


Question:
What is the nickname of staff with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
What are all the distinct premise types?
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT DISTINCT premises_type FROM premises


Question:
What are the names of musicals with nominee 'Bob Fosse'?
Additional table information: table: musical

Answer: SELECT Name FROM musical WHERE Nominee = 'Bob Fosse'


Question:
Find the order id and customer id associated with the oldest order.
Additional table information: table: tracking_orders

Answer: SELECT order_id, customer_id FROM orders ORDER BY date_order_placed NULLS FIRST LIMIT 1


Question:
List the description, code and the number of services for each service type.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Service_Type_Description, T2.Service_Type_Code, COUNT(*) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T2.Service_Type_Code


Question:
Find the name and active date of the customer that use email as the contact channel.
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name, t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'


Question:
How many drivers were in the Australian Grand Prix held in 2009?
Additional table information: table: formula_1

Answer: SELECT COUNT(*) FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid WHERE T2.name = 'Australian Grand Prix' AND YEAR = 2009


Question:
Show all product colors.
Additional table information: table: customers_and_invoices

Answer: SELECT DISTINCT product_color FROM Products


Question:
Show all locations which don't have a train station with at least 15 platforms.
Additional table information: table: train_station

Answer: SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15


Question:
What are the appelations for wines produced after 2008 but not in the Central Coast area?
Additional table information: table: wine_1

Answer: SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = 'Central Coast'


Question:
What are the names of all the documents, as well as the access counts of each, ordered alphabetically?
Additional table information: table: document_management

Answer: SELECT document_name, access_count FROM documents ORDER BY document_name NULLS FIRST


Question:
How many climbers are from each country?
Additional table information: table: climbing

Answer: SELECT Country, COUNT(*) FROM climber GROUP BY Country


Question:
What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?
Additional table information: table: department_store

Answer: SELECT MAX(product_price), MIN(product_price), product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code NULLS FIRST


Question:
How many body builders are there?
Additional table information: table: body_builder

Answer: SELECT COUNT(*) FROM body_builder


Question:
List the names of perpetrators in descending order of the year.
Additional table information: table: perpetrator

Answer: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Year DESC


Question:
What are the names and descriptions of aircrafts associated with an airport that has more total passengers than 10000000?
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft, T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000


Question:
List the industry shared by the most companies.
Additional table information: table: company_office

Answer: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number of students who have the word 'son' in their personal names.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE personal_name LIKE '%son%'


Question:
For each nomination, show the name of the artwork and name of the festival where it is nominated.
Additional table information: table: entertainment_awards

Answer: SELECT T2.Name, T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID


Question:
Show cinema name, film title, date, and price for each record in schedule.
Additional table information: table: cinema

Answer: SELECT T3.name, T2.title, T1.date, T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id


Question:
Which college has any student who is a goalie and succeeded in the tryout.
Additional table information: table: soccer_2

Answer: SELECT cName FROM tryout WHERE decision = 'yes' AND pPos = 'goalie'


Question:
What is the average unit price of rock tracks?
Additional table information: table: chinook_1

Answer: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'


Question:
Find the titles of albums that contain tracks of both the Reggae and Rock genres.
Additional table information: table: chinook_1

Answer: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = 'Rock'


Question:
What are the names of the stations that are located in Palo Alto but have never been the ending point of the trips
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE city = 'Palo Alto' EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING COUNT(*) > 100


Question:
What are all the policy types of the customer named 'Dayana Robel'?
Additional table information: table: insurance_fnol

Answer: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = 'Dayana Robel'


Question:
What are the customer name and date of the orders whose status is 'Delivered'.
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name, t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = 'Delivered'


Question:
Show all member names and registered branch names sorted by register year.
Additional table information: table: shop_membership

Answer: SELECT T3.name, T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year NULLS FIRST


Question:
What is the average base price of rooms, for each bed type?
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
List title of albums have the number of tracks greater than 10.
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10


Question:
How many assets can each parts be used in? List the part name and the number.
Additional table information: table: assets_maintenance

Answer: SELECT T1.part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name


Question:
Find the name of all the cities and states.
Additional table information: table: e_government

Answer: SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses


Question:
Find products with max page size as 'A4' or pages per minute color smaller than 5.
Additional table information: table: store_product

Answer: SELECT product FROM product WHERE max_page_size = 'A4' OR pages_per_minute_color < 5


Question:
How many professors attained either Ph.D. or Masters degrees?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'


Question:
Show company name and main industry without a gas station.
Additional table information: table: gas_company

Answer: SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company)


Question:
List the cities which have more than one airport and number of airports.
Additional table information: table: flight_4

Answer: SELECT city, COUNT(*) FROM airports GROUP BY city HAVING COUNT(*) > 1


Question:
List all countries of markets in ascending alphabetical order.
Additional table information: table: film_rank

Answer: SELECT Country FROM market ORDER BY Country ASC NULLS FIRST


Question:
Return the names of the gymnasts.
Additional table information: table: gymnast

Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID


Question:
Find the name and revenue of the company that earns the highest revenue in each city.
Additional table information: table: manufactory_1

Answer: SELECT name, MAX(revenue), Headquarter FROM manufacturers GROUP BY Headquarter


Question:
Show the names and ids of tourist attractions that are visited at least two times.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name, T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING COUNT(*) >= 2


Question:
Show all game ids and the number of hours played.
Additional table information: table: game_1

Answer: SELECT gameid, SUM(hours_played) FROM Plays_games GROUP BY gameid


Question:
What are the different stage positions for all musicians whose first name is 'Solveig'?
Additional table information: table: music_2

Answer: SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = 'Solveig'


Question:
What is the id and name of the department store that has both marketing and managing department?
Additional table information: table: department_store

Answer: SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = 'marketing' INTERSECT SELECT T2.dept_store_id, T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = 'managing'


Question:
Show all the locations where no cinema has capacity over 800.
Additional table information: table: cinema

Answer: SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800


Question:
List the customers first and last name of 10 least expensive invoices.
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total NULLS FIRST LIMIT 10


Question:
How many budget record has a budget amount smaller than the invested amount?
Additional table information: table: school_finance

Answer: SELECT COUNT(*) FROM budget WHERE budgeted < invested


Question:
How many activities does Mark Giuliano participate in?
Additional table information: table: activity_1

Answer: 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'


Question:
Count the number of different official languages corresponding to countries that players who play Defender are from.
Additional table information: table: match_season

Answer: SELECT COUNT(DISTINCT T1.Official_native_language) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = 'Defender'


Question:
Count the number of captains younger than 50 of each rank.
Additional table information: table: ship_1

Answer: SELECT COUNT(*), rank FROM captain WHERE age < 50 GROUP BY rank


Question:
Who is the advisor of student with ID 1004?
Additional table information: table: allergy_1

Answer: SELECT Advisor FROM Student WHERE StuID = 1004


Question:
How many teachers does the student named CHRISSY NABOZNY have?
Additional table information: table: student_1

Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = 'CHRISSY' AND T1.lastname = 'NABOZNY'


Question:
What is the name of the claim processing stage that most of the claims are on?
Additional table information: table: insurance_and_eClaims

Answer: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which people severed as governor most frequently?
Additional table information: table: election

Answer: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the most popular payment method?
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the amenities in the dorm that a student who has the last name of Smith lives in?
Additional table information: table: dorm_1

Answer: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith'


Question:
List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.
Additional table information: table: game_injury

Answer: SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'


Question:
List players' first name and last name who have weight greater than 220 or height shorter than 75.
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75


Question:
What are the names of climbers and the corresponding heights of the mountains that they climb?
Additional table information: table: climbing

Answer: SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


Question:
show the train name and station name for each train.
Additional table information: table: train_station

Answer: SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id


Question:
What are the names of people in ascending order of height?
Additional table information: table: perpetrator

Answer: SELECT Name FROM People ORDER BY Height ASC NULLS FIRST


Question:
How many companies operates airlines in each airport?
Additional table information: table: flight_company

Answer: SELECT T3.id, COUNT(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id


Question:
Give me all the phone numbers and email addresses of the workshop groups where services are performed.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Store_Phone, T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID


Question:
What is the name of the department with the fewest members?
Additional table information: table: college_3

Answer: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
How many appelations are in Napa Country?
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM APPELLATIONS WHERE County = 'Napa'


Question:
Show all the information about election.
Additional table information: table: election

Answer: SELECT * FROM election


Question:
What is the document type name for the document with name 'How to read a book'?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T2.document_type_name FROM All_documents AS T1 JOIN Ref_document_types AS T2 ON T1.document_type_code = T2.document_type_code WHERE T1.document_name = 'How to read a book'


Question:
What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_details, T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'


Question:
What are the customer id and name corresponding to accounts with a checking balance less than the largest checking balance?
Additional table information: table: small_bank_1

Answer: SELECT T1.custid, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT MAX(balance) FROM checking)


Question:
What is the mean longitude for all stations that have never had more than 10 bikes available?
Additional table information: table: bike_1

Answer: SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)


Question:
Return reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly by number of stars.
Additional table information: table: movie_1

Answer: SELECT T3.name, T2.title, T1.stars, T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name NULLS FIRST, T2.title NULLS FIRST, T1.stars NULLS FIRST


Question:
What are the names of all the aircrafts associated with London Gatwick airport?
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = 'London Gatwick'


Question:
How many different genders are there in the dorms?
Additional table information: table: dorm_1

Answer: SELECT COUNT(DISTINCT gender) FROM dorm


Question:
Who are the players from Indonesia?
Additional table information: table: match_season

Answer: SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = 'Indonesia'


Question:
How many games are free of injury accidents?
Additional table information: table: game_injury

Answer: SELECT COUNT(*) FROM game WHERE NOT id IN (SELECT game_id FROM injury_accident)


Question:
Show the id and name of the aircraft with the maximum distance.
Additional table information: table: flight_1

Answer: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1


Question:
Show all customer ids and the number of accounts for each customer.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id


Question:
Return the first names and last names of employees who earn more than 30000 in salary.
Additional table information: table: company_1

Answer: SELECT fname, lname FROM employee WHERE salary > 30000


Question:
What is the 3 most common cloud cover rates in the region of zip code 94107?
Additional table information: table: bike_1

Answer: SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3


Question:
How many products are there?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products


Question:
What are the first and last names of the employee with the earliest date of birth?
Additional table information: table: college_1

Answer: SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob NULLS FIRST LIMIT 1


Question:
What is the name, type, and flag of the ship that was built in the most recent year?
Additional table information: table: ship_1

Answer: SELECT name, TYPE, flag FROM ship ORDER BY built_year DESC LIMIT 1


Question:
How many students have had at least one 'B' grade?
Additional table information: table: college_3

Answer: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = 'B'


Question:
Give the hometowns from which two or more gymnasts are from.
Additional table information: table: gymnast

Answer: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*) >= 2


Question:
List all of the player ids with a height of at least 180cm and an overall rating higher than 85.
Additional table information: table: soccer_1

Answer: SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85


Question:
Which locations contains both shops that opened after the year 2012 and shops that opened before 2008?
Additional table information: table: device

Answer: SELECT LOCATION FROM shop WHERE Open_Year > 2012 INTERSECT SELECT LOCATION FROM shop WHERE Open_Year < 2008


Question:
How many type of jobs do they have?
Additional table information: table: network_2

Answer: SELECT COUNT(DISTINCT job) FROM Person


Question:
What is the role of the employee named Koby?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = 'Koby'


Question:
Advisor 1121 has how many students?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Student WHERE Advisor = 1121


Question:
find the name of all departments that do actually have one or more employees assigned to them.
Additional table information: table: hr_1

Answer: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
How many followers does each user have?
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM follows


Question:
Show the ids of all the faculty members who participate in an activity and advise a student.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student


Question:
What is the velocity of the pilot named 'Thompson'?
Additional table information: table: flight_company

Answer: SELECT AVG(velocity) FROM flight WHERE pilot = 'Thompson'


Question:
What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director?
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name


Question:
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.
Additional table information: table: restaurant_1

Answer: SELECT Restaurant.ResName, SUM(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY SUM(Visits_Restaurant.Spent) ASC NULLS FIRST LIMIT 1


Question:
Find the names of the trains that do not pass any station located in London.
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = 'London')


Question:
What is the name of the youngest captain?
Additional table information: table: ship_1

Answer: SELECT name FROM captain ORDER BY age NULLS FIRST LIMIT 1


Question:
Show the names of all the activities Mark Giuliano participates in.
Additional table information: table: activity_1

Answer: 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'


Question:
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
Additional table information: table: college_1

Answer: 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.'


Question:
What are the names of the airports in the city of Goroka?
Additional table information: table: flight_4

Answer: SELECT name FROM airports WHERE city = 'Goroka'


Question:
Find the name, address, number of students in the departments that have the top 3 highest number of students.
Additional table information: table: college_1

Answer: 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


Question:
What is the id of the appointment that started most recently?
Additional table information: table: hospital_1

Answer: SELECT appointmentid FROM appointment ORDER BY START DESC LIMIT 1


Question:
List the first names of all the students in room 107.
Additional table information: table: student_1

Answer: SELECT DISTINCT firstname FROM list WHERE classroom = 107


Question:
Show all the distinct president votes made on 08/30/2015.
Additional table information: table: voter_2

Answer: SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = '08/30/2015'


Question:
Find the name of the product that has the smallest capacity.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC NULLS FIRST LIMIT 1


Question:
What are the descriptions and names of the courses that have student enrollment bigger than 2?
Additional table information: table: e_learning

Answer: SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2


Question:
List the authors who do not have submission to any workshop.
Additional table information: table: workshop_paper

Answer: SELECT Author FROM submission WHERE NOT Submission_ID IN (SELECT Submission_ID FROM acceptance)


Question:
Find the total population of the districts where the area is bigger than the average city area.
Additional table information: table: store_product

Answer: SELECT SUM(city_population) FROM district WHERE city_area > (SELECT AVG(city_area) FROM district)


Question:
What is the average age for each city and what are those cities?
Additional table information: table: dorm_1

Answer: SELECT AVG(age), city_code FROM student GROUP BY city_code


Question:
What is the total and maximum duration for all trips with the bike id 636?
Additional table information: table: bike_1

Answer: SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636


Question:
What is the name and description for document type code RV?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT document_type_name, document_type_description FROM Ref_document_types WHERE document_type_code = 'RV'


Question:
What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009?
Additional table information: table: hr_1

Answer: SELECT job_id, hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'


Question:
Find the number of rooms with a king bed.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms WHERE bedType = 'King'


Question:
List every album ordered by album title in ascending order.
Additional table information: table: store_1

Answer: SELECT title FROM albums ORDER BY title NULLS FIRST


Question:
For each distinct test result, find the number of students who got the result.
Additional table information: table: e_learning

Answer: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC


Question:
What are the names of the physician who prescribed the highest dose?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1


Question:
What is the number of faculty at Long Beach State University in 2002?
Additional table information: table: csu_1

Answer: 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'


Question:
For each phone, show its names and total number of stocks.
Additional table information: table: phone_market

Answer: SELECT T2.Name, SUM(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name


Question:
What is the first name and the last name of the customer who made the earliest rental?
Additional table information: table: sakila_1

Answer: SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC NULLS FIRST LIMIT 1


Question:
How many drama workshop groups are there in each city? Return both the city and the count.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.City_Town, COUNT(*) FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID GROUP BY T1.City_Town


Question:
Find the names of stadiums which have never had any event.
Additional table information: table: swimming

Answer: SELECT name FROM stadium WHERE NOT id IN (SELECT stadium_id FROM event)


Question:
What are the names of the scientists, and how many projects are each of them working on?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name


Question:
Sort all the industries in descending order of the count of companies in each industry
Additional table information: table: company_office

Answer: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC


Question:
How many customer cards are there?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards


Question:
Find the number of students who is older than 20 in each dorm.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name


Question:
How many allergies have type animal?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = 'animal'


Question:
What campuses opened between 1935 and 1939?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE YEAR >= 1935 AND YEAR <= 1939


Question:
What is the location shared by most counties?
Additional table information: table: county_public_safety

Answer: SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each city, list their names in decreasing order by their highest station latitude.
Additional table information: table: bike_1

Answer: SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC


Question:
Show the name, home city, and age for all drivers.
Additional table information: table: school_bus

Answer: SELECT name, home_city, age FROM driver


Question:
What is the total enrollment number of all colleges?
Additional table information: table: soccer_2

Answer: SELECT SUM(enr) FROM College


Question:
Find all manufacturers' names and their headquarters, sorted by the ones with highest revenue first.
Additional table information: table: manufactory_1

Answer: SELECT name, headquarter FROM manufacturers ORDER BY revenue DESC


Question:
What are the ids and first names of customers who do not hold a credit card?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'


Question:
What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)?
Additional table information: table: college_2

Answer: SELECT T3.title, T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom)


Question:
How many different payment methods are there?
Additional table information: table: customer_deliveries

Answer: SELECT COUNT(DISTINCT payment_method) FROM customers


Question:
Show the id, the date of account opened, the account name, and other account detail for all accounts.
Additional table information: table: customers_and_invoices

Answer: SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts


Question:
Show the name of colleges that have at least two players.
Additional table information: table: match_season

Answer: SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2


Question:
Which city does the student whose last name is 'Kim' live in?
Additional table information: table: allergy_1

Answer: SELECT city_code FROM Student WHERE LName = 'Kim'


Question:
Find the name and partition id for users who tweeted less than twice.
Additional table information: table: twitter_1

Answer: SELECT T1.name, T1.partitionid FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) < 2


Question:
What are the teams of the players, sorted in ascending alphabetical order?
Additional table information: table: school_player

Answer: SELECT Team FROM player ORDER BY Team ASC NULLS FIRST


Question:
List the race class with at least two races.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS HAVING COUNT(*) >= 2


Question:
Among all the claims, which claims have a claimed amount larger than the average? List the date the claim was made and the date it was settled.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims)


Question:
How many acting statuses are there?
Additional table information: table: department_management

Answer: SELECT COUNT(DISTINCT temporary_acting) FROM management


Question:
What are the average rating and resolution of songs that are in Bangla?
Additional table information: table: music_1

Answer: SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = 'bangla'


Question:
Find names of all students who took some course and the course description.
Additional table information: table: college_1

Answer: 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


Question:
List all the names of schools with an endowment amount smaller than or equal to 10.
Additional table information: table: school_finance

Answer: SELECT T2.school_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T1.school_id HAVING SUM(T1.amount) <= 10


Question:
Find the phone number and email address of customer 'Harold'.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Customer_Phone, Customer_Email_Address FROM CUSTOMERS WHERE Customer_Name = 'Harold'


Question:
What is the customer id, first and last name with most number of accounts.
Additional table information: table: customers_and_invoices

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which game type has least number of games?
Additional table information: table: game_1

Answer: SELECT gtype FROM Video_games GROUP BY gtype ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What is the number of colleges with a student population greater than 15000?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM College WHERE enr > 15000


Question:
Show the players and the years played.
Additional table information: table: match_season

Answer: SELECT Player, Years_Played FROM player


Question:
Show the titles of books in descending order of publication price.
Additional table information: table: book_2

Answer: SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC


Question:
Which department has the largest number of employees?
Additional table information: table: hospital_1

Answer: SELECT name FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) DESC LIMIT 1


Question:
How many students play sports?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT StuID) FROM Sportsinfo


Question:
How many girl students who are younger than 25?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25


Question:
What are the total account balances for each customer from Utah or Texas?
Additional table information: table: loan_1

Answer: SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'


Question:
Which origin has most number of flights?
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies?
Additional table information: table: movie_1

Answer: SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5


Question:
What are the names of the dorm with the largest capacity?
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1


Question:
Show the ids and details of the investors who have at least two transactions with type code 'SALE'.
Additional table information: table: tracking_share_transactions

Answer: SELECT T2.investor_id, T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = 'SALE' GROUP BY T2.investor_id HAVING COUNT(*) >= 2


Question:
What are all the distinct last names of all the engineers?
Additional table information: table: assets_maintenance

Answer: SELECT DISTINCT last_name FROM Maintenance_Engineers


Question:
Show the station name and number of trains in each station.
Additional table information: table: train_station

Answer: SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id


Question:
Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.
Additional table information: table: sakila_1

Answer: SELECT T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY SUM(amount) ASC NULLS FIRST LIMIT 1


Question:
Show the name of colleges that have at least two players in descending alphabetical order.
Additional table information: table: match_season

Answer: SELECT College FROM match_season GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC


Question:
Show the names of customers who have the most mailshots.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the average rating and resolution of all bangla songs?
Additional table information: table: music_1

Answer: SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = 'bangla'


Question:
Who directed Avatar?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie WHERE title = 'Avatar'


Question:
What are the names of all cities with more than one airport and how many airports do they have?
Additional table information: table: flight_4

Answer: SELECT city, COUNT(*) FROM airports GROUP BY city HAVING COUNT(*) > 1


Question:
What are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent?
Additional table information: table: cre_Theme_park

Answer: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = '660 Shea Crescent' OR T2.How_to_Get_There = 'walk'


Question:
What is the number of aircraft?
Additional table information: table: aircraft

Answer: SELECT COUNT(*) FROM aircraft


Question:
Find the names of all the catalog entries.
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_entry_name) FROM catalog_contents


Question:
Find the average unit price for a track.
Additional table information: table: chinook_1

Answer: SELECT AVG(UnitPrice) FROM TRACK


Question:
Show all branch names with the number of members in each branch registered after 2015.
Additional table information: table: shop_membership

Answer: SELECT T2.name, COUNT(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id


Question:
What are the different software platforms for devices, and how many devices have each?
Additional table information: table: device

Answer: SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform


Question:
What are the names of the tourist attractions Vincent and Marcelle visit?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Vincent' INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Marcelle'


Question:
Return the name and max speed of the storm that affected the most regions.
Additional table information: table: storm_record

Answer: SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the issue date of the volume that has spent the fewest weeks on top.
Additional table information: table: music_4

Answer: SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC NULLS FIRST LIMIT 1


Question:
Report the distinct registration date and the election cycle.
Additional table information: table: voter_2

Answer: SELECT DISTINCT Registration_Date, Election_Cycle FROM VOTING_RECORD


Question:
List three countries which are the origins of the least players.
Additional table information: table: baseball_1

Answer: SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 3


Question:
How many games are played for all football games by students on scholarship?
Additional table information: table: game_1

Answer: SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = 'Football' AND onscholarship = 'Y'


Question:
From which hometowns did both people older than 23 and younger than 20 come from?
Additional table information: table: gymnast

Answer: SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20


Question:
Show the number of locations.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM Ref_locations


Question:
Find the name of the artist who made the album 'Balls to the Wall'.
Additional table information: table: chinook_1

Answer: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = 'Balls to the Wall'


Question:
list all the names of programs, ordering by launch time.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch NULLS FIRST


Question:
What are the names of ships that are commanded by both captains with the rank of Midshipman and captains with the rank of Lieutenant?
Additional table information: table: ship_1

Answer: SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'


Question:
What are the names and ids of documents that have the type code BK?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_id FROM Documents WHERE document_type_code = 'BK'


Question:
What are the names of the chairs of festivals, sorted in ascending order of the year held?
Additional table information: table: entertainment_awards

Answer: SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC NULLS FIRST


Question:
List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages.
Additional table information: table: dorm_1

Answer: SELECT fname, lname FROM student WHERE city_code <> 'HKG' ORDER BY age NULLS FIRST


Question:
Find the average rating star for each movie that are not reviewed by Brittany Harris.
Additional table information: table: movie_1

Answer: SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris') GROUP BY mID


Question:
How many parties do we have?
Additional table information: table: party_people

Answer: SELECT COUNT(DISTINCT party_name) FROM party


Question:
Return the dates of ceremony and the results of all music festivals
Additional table information: table: music_4

Answer: SELECT Date_of_ceremony, RESULT FROM music_festival


Question:
What are the names of all schools that have students trying out for the position of goal and 'mid'-field.
Additional table information: table: soccer_2

Answer: SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid'


Question:
What are the phone and email for customer Harold?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Customer_Phone, Customer_Email_Address FROM CUSTOMERS WHERE Customer_Name = 'Harold'


Question:
Which themes have had corresponding exhibitions that have had attendance both below 100 and above 500?
Additional table information: table: theme_gallery

Answer: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500


Question:
Show different locations of railways along with the corresponding number of railways at each location.
Additional table information: table: railway

Answer: SELECT LOCATION, COUNT(*) FROM railway GROUP BY LOCATION


Question:
What is the average latitude and longitude in San Jose?
Additional table information: table: bike_1

Answer: SELECT AVG(lat), AVG(long) FROM station WHERE city = 'San Jose'


Question:
List all the characteristic names and data types of product 'cumin'.
Additional table information: table: products_gen_characteristics

Answer: SELECT t3.characteristic_name, t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = 'cumin'


Question:
Please show the most common type of ships.
Additional table information: table: ship_mission

Answer: SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number and time of the train that goes from Chennai to Guruvayur.
Additional table information: table: station_weather

Answer: SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'


Question:
What is the name of the movie produced after 2000 and directed by James Cameron?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000


Question:
How many services has each resident requested? List the resident id, details, and the count in descending order of the count.
Additional table information: table: local_govt_and_lot

Answer: SELECT T1.resident_id, T1.other_details, COUNT(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id = T2.resident_id GROUP BY T1.resident_id ORDER BY COUNT(*) DESC


Question:
Show the name, location, and number of platforms for all stations.
Additional table information: table: train_station

Answer: SELECT name, LOCATION, number_of_platforms FROM station


Question:
How many students are enrolled in the class taught by some professor from the accounting department?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'


Question:
Who are the friends of Bob?
Additional table information: table: network_2

Answer: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'


Question:
Find the club which has the largest number of members majoring in '600'.
Additional table information: table: club_1

Answer: SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.major = '600' GROUP BY t1.clubname ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the average share count of transactions for different investors.
Additional table information: table: tracking_share_transactions

Answer: SELECT investor_id, AVG(share_count) FROM TRANSACTIONS GROUP BY investor_id


Question:
What is the average duration of songs that have mp3 format and resolution below 800?
Additional table information: table: music_1

Answer: SELECT AVG(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800


Question:
What is the first name of the band mate who perfomed in the most songs?
Additional table information: table: music_2

Answer: SELECT t2.firstname FROM Performance AS t1 JOIN Band AS t2 ON t1.bandmate = t2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId GROUP BY firstname ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of nurses who are nursing an undergoing treatment.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID


Question:
Give the names of tracks that do not have a race in the class 'GT'.
Additional table information: table: race_track

Answer: 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'


Question:
List the all the assets make, model, details by the disposed date ascendingly.
Additional table information: table: assets_maintenance

Answer: SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date ASC NULLS FIRST


Question:
How many members have the black membership card?
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*) FROM member WHERE Membership_card = 'Black'


Question:
List the name of all projects that are operated longer than the average working hours of all projects.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)


Question:
Find the id and last name of the teacher that has the most detentions with detention type code 'AFTER'?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.teacher_id, T2.last_name FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = 'AFTER' GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the titles of films that include 'Deleted Scenes' in their special feature section.
Additional table information: table: sakila_1

Answer: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'


Question:
What are the names and number of works for all artists who have sung at least one song in English?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name HAVING COUNT(*) >= 1


Question:
What is the location and name of the winning aircraft?
Additional table information: table: aircraft

Answer: SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft


Question:
What are the names of all movies that were created after the most recent Steven Spielberg film?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = 'Steven Spielberg')


Question:
Report the distinct advisors who have more than 2 students.
Additional table information: table: voter_2

Answer: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2


Question:
What are the titles and ids for albums containing tracks with unit price greater than 1?
Additional table information: table: chinook_1

Answer: SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID


Question:
What is all the customer information for customers in NY state?
Additional table information: table: chinook_1

Answer: SELECT * FROM CUSTOMER WHERE State = 'NY'


Question:
Show all allergy types.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergytype FROM Allergy_type


Question:
What is the id of the problem log that is created most recently?
Additional table information: table: tracking_software_problems

Answer: SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1


Question:
Show the prices of the products named 'Dining' or 'Trading Policy'.
Additional table information: table: solvency_ii

Answer: SELECT Product_Price FROM Products WHERE Product_Name = 'Dining' OR Product_Name = 'Trading Policy'


Question:
Which cities served as a host city after 2010?
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010


Question:
What are the wines that have prices lower than 50 and have appelations in Monterey county?
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Monterey' AND T2.price < 50


Question:
Find the number of distinct bed types available in this inn.
Additional table information: table: inn_1

Answer: SELECT COUNT(DISTINCT bedType) FROM Rooms


Question:
What is the first name, last name, and phone of the customer with card 4560596484842.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'


Question:
Which film has the most number of actors or actresses? List the film name, film id and description.
Additional table information: table: sakila_1

Answer: SELECT T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the average price for each type of product?
Additional table information: table: department_store

Answer: SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code


Question:
What are the different types of transactions?
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT transaction_type FROM Financial_Transactions


Question:
Find the SSN and name of scientists who are assigned to the project with the longest hours.
Additional table information: table: scientist_1

Answer: SELECT T3.ssn, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)


Question:
how many airports are there in each country?
Additional table information: table: flight_company

Answer: SELECT COUNT(*), country FROM airport GROUP BY country


Question:
How many schools do not participate in the basketball match?
Additional table information: table: university_basketball

Answer: SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match)


Question:
What are the types of every competition and in which countries are they located?
Additional table information: table: sports_competition

Answer: SELECT Competition_type, Country FROM competition


Question:
For each country and airline name, how many routes are there?
Additional table information: table: flight_4

Answer: SELECT T1.country, T1.name, COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name


Question:
List the teams of the players with the top 5 largest ages.
Additional table information: table: school_player

Answer: SELECT Team FROM player ORDER BY Age DESC LIMIT 5


Question:
list the names of the companies with more than 200 sales in the descending order of sales and profits.
Additional table information: table: company_employee

Answer: SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion NULLS FIRST, Profits_in_Billion DESC


Question:
What are the ids and names of all start stations that were the beginning of at least 200 trips?
Additional table information: table: bike_1

Answer: SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200


Question:
List the description of all the colors.
Additional table information: table: products_gen_characteristics

Answer: SELECT color_description FROM ref_colors


Question:
What are the first names of all professors who teach more than one class?
Additional table information: table: college_1

Answer: 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


Question:
What is the name of the room that can accommodate the most people?
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1


Question:
How many council taxes are collected for renting arrears ?
Additional table information: table: local_govt_mdm

Answer: SELECT COUNT(*) FROM rent_arrears


Question:
Show name and salary for all employees sorted by salary.
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee ORDER BY salary NULLS FIRST


Question:
Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles.
Additional table information: table: college_2

Answer: SELECT T2.building, T2.room_number, T2.semester, T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title NULLS FIRST


Question:
What are the different card type codes?
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT card_type_code FROM Customers_Cards


Question:
Show all dates of transactions whose type code is 'SALE'.
Additional table information: table: tracking_share_transactions

Answer: SELECT date_of_transaction FROM TRANSACTIONS WHERE transaction_type_code = 'SALE'


Question:
Find the name, headquarter and founder of the manufacturer that has the highest revenue.
Additional table information: table: manufactory_1

Answer: SELECT name, headquarter, founder FROM manufacturers ORDER BY revenue DESC LIMIT 1


Question:
Which industries have both companies with headquarter in 'USA' and companies with headquarter in 'China'?
Additional table information: table: company_office

Answer: SELECT Industry FROM Companies WHERE Headquarters = 'USA' INTERSECT SELECT Industry FROM Companies WHERE Headquarters = 'China'


Question:
Find the number of albums.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM


Question:
Show the name, location, open year for all tracks with a seating higher than the average.
Additional table information: table: race_track

Answer: SELECT name, LOCATION, year_opened FROM track WHERE seating > (SELECT AVG(seating) FROM track)


Question:
Find the ids of reviewers who didn't only give 4 star.
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating WHERE stars <> 4


Question:
Find the common personal name of course authors and students.
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Course_Authors_and_Tutors INTERSECT SELECT personal_name FROM Students


Question:
What are the highest cost, lowest cost and average cost of procedures?
Additional table information: table: hospital_1

Answer: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures


Question:
List names of all pilot in descending order of age.
Additional table information: table: aircraft

Answer: SELECT Name FROM pilot ORDER BY Age DESC


Question:
Show all the buildings that have at least 10 professors.
Additional table information: table: activity_1

Answer: SELECT building FROM Faculty WHERE rank = 'Professor' GROUP BY building HAVING COUNT(*) >= 10


Question:
Find the addresses of the course authors who teach the course with name 'operating system' or 'data structure'.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'


Question:
Tell me the the claim date and settlement date for each settlement case.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements


Question:
For each tourist attraction, return its name and the date when the tourists named Vincent or Vivian visited there.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name, T3.Visit_Date FROM Tourist_Attractions AS T1, VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = 'Vincent' OR T2.Tourist_Details = 'Vivian'


Question:
What are the department names, cities, and state provinces for each department?
Additional table information: table: hr_1

Answer: SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id


Question:
Find the name of department has the highest amount of students?
Additional table information: table: college_2

Answer: SELECT dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find all the product whose name contains the word 'Scanner'.
Additional table information: table: store_product

Answer: SELECT product FROM product WHERE product LIKE '%Scanner%'


Question:
Show the game name that has most number of hours played.
Additional table information: table: game_1

Answer: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY SUM(hours_played) DESC LIMIT 1


Question:
List all the username and passwords of users with the most popular role.
Additional table information: table: document_management

Answer: SELECT user_name, password FROM users GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the names of 5 users followed by the largest number of other users.
Additional table information: table: twitter_1

Answer: SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5


Question:
Show teams that have suffered more than three eliminations.
Additional table information: table: wrestler

Answer: SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) > 3


Question:
What are all the instruments used by the musician with the last name 'Heilo'?
Additional table information: table: music_2

Answer: SELECT instrument FROM instruments AS T1 JOIN Band AS T2 ON T1.bandmateid = T2.id WHERE T2.lastname = 'Heilo'


Question:
How many instruments does the song 'Le Pop' use?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Le Pop'


Question:
Which nurses are in charge of patients undergoing treatments?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID


Question:
What are the distinct secretary votes in the fall election cycle?
Additional table information: table: voter_2

Answer: SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = 'Fall'


Question:
What are the names of patients who are not taking the medication of Procrastin-X.
Additional table information: table: hospital_1

Answer: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X'


Question:
What are the names of projects that have taken longer than the average number of hours for all projects?
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)


Question:
Find the latest logon date of the students whose family name is 'Jaskolski' or 'Langosh'.
Additional table information: table: e_learning

Answer: SELECT date_of_latest_logon FROM Students WHERE family_name = 'Jaskolski' OR family_name = 'Langosh'


Question:
Find all the cities that have 2 to 4 parks.
Additional table information: table: baseball_1

Answer: SELECT city FROM park GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4


Question:
Find the id and name of the most expensive base price room.
Additional table information: table: inn_1

Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1


Question:
How much salary did the top 3 well-paid players get in 2001?
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3


Question:
List the name of all customers sorted by their account balance in ascending order.
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer ORDER BY acc_bal NULLS FIRST


Question:
How many customers do we have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers


Question:
How many tracks belong to rock genre?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'


Question:
Retrieve all the first and last names of authors in the alphabetical order of last names.
Additional table information: table: icfp_1

Answer: SELECT fname, lname FROM authors ORDER BY lname NULLS FIRST


Question:
What are the different names of all the races in reverse alphabetical order?
Additional table information: table: formula_1

Answer: SELECT DISTINCT name FROM races ORDER BY name DESC


Question:
Return the name of the category to which the film 'HUNGER ROOF' belongs.
Additional table information: table: sakila_1

Answer: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'


Question:
Find the forename and surname of drivers whose nationality is German?
Additional table information: table: formula_1

Answer: SELECT forename, surname FROM drivers WHERE nationality = 'German'


Question:
What are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people.
Additional table information: table: inn_1

Answer: SELECT roomName, RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2


Question:
Return the address and email of the customer with the first name Linda.
Additional table information: table: sakila_1

Answer: SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'


Question:
How many lessons were taught by a staff member whose first name has the letter 'a' in it?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%'


Question:
What is the theme and artist name for the exhibition with a ticket price higher than the average?
Additional table information: table: theme_gallery

Answer: SELECT T1.theme, T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT AVG(ticket_price) FROM exhibition)


Question:
What are the names of the technicians that are assigned to repair machines with more point values than 70?
Additional table information: table: machine_repair

Answer: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID WHERE T2.value_points > 70


Question:
Count the number of courses in the Physics department.
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'


Question:
Show the ids of the students who don't participate in any activity.
Additional table information: table: activity_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in


Question:
How many schools are in the basketball match?
Additional table information: table: university_basketball

Answer: SELECT COUNT(DISTINCT school_id) FROM basketball_match


Question:
What is the theme, date, and attendance for the exhibition in year 2004?
Additional table information: table: theme_gallery

Answer: SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004


Question:
What are the ids of all reviewers who have not given 4 stars at least once?
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating WHERE stars <> 4


Question:
Find all the albums in 2012.
Additional table information: table: music_2

Answer: SELECT * FROM Albums WHERE YEAR = 2012


Question:
What are the rooms for members of the faculty who are professors and who live in building NEB?
Additional table information: table: college_3

Answer: SELECT Room FROM FACULTY WHERE Rank = 'Professor' AND Building = 'NEB'


Question:
What is maximum and minimum RAM size of phone produced by company named 'Nokia Corporation'?
Additional table information: table: phone_1

Answer: SELECT MAX(T1.RAM_MiB), MIN(T1.RAM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = 'Nokia Corporation'


Question:
List the names of people that have not been on the affirmative side of debates.
Additional table information: table: debate

Answer: SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people)


Question:
find the total percentage share of all channels owned by CCTV.
Additional table information: table: program_share

Answer: SELECT SUM(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'


Question:
What are the names of students who have taken the prerequisite for the course International Finance?
Additional table information: table: college_2

Answer: SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance')


Question:
What are the party emails associated with parties that used the party form that is the most common?
Additional table information: table: e_government

Answer: SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY COUNT(*) DESC LIMIT 1)


Question:
How many medications are prescribed for each brand?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.name FROM medication AS T1 JOIN prescribes AS T2 ON T1.code = T2.medication GROUP BY T1.brand


Question:
What are the names, classes, and dates for all races?
Additional table information: table: race_track

Answer: SELECT name, CLASS, date FROM race


Question:
Find the city that hosted the most events.
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many vehicles exist?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Vehicles


Question:
Which catalog contents have a product stock number that starts from '2'? Show the catalog entry names.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE '2%'


Question:
What is the aircraft name for the flight with number 99
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99


Question:
What are the names and locations of festivals?
Additional table information: table: entertainment_awards

Answer: SELECT Festival_Name, LOCATION FROM festival_detail


Question:
On what dates did the student with family name 'Zieme' and personal name 'Bernie' enroll in and complete the courses?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie'


Question:
What are the gas station ids, locations, and manager names for the gas stations ordered by opening year?
Additional table information: table: gas_company

Answer: SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year NULLS FIRST


Question:
List all the event names by year from the most recent to the oldest.
Additional table information: table: swimming

Answer: SELECT name FROM event ORDER BY YEAR DESC


Question:
What are the names and countries of members?
Additional table information: table: decoration_competition

Answer: SELECT Name, Country FROM member


Question:
List the actual delivery date for all the orders with quantity 1
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1


Question:
What are the names of races that were held after 2017 and the circuits were in the country of Spain?
Additional table information: table: formula_1

Answer: SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = 'Spain' AND T1.year > 2017


Question:
Show the name of cities in the county that has the largest number of police officers.
Additional table information: table: county_public_safety

Answer: SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)


Question:
Find the buildings which have rooms with capacity more than 50.
Additional table information: table: college_2

Answer: SELECT DISTINCT building FROM classroom WHERE capacity > 50


Question:
Find the name of the customer who made an order most recently.
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1


Question:
What is the average price of products with manufacturer codes equal to 2?
Additional table information: table: manufactory_1

Answer: SELECT AVG(price) FROM products WHERE manufacturer = 2


Question:
Find the average age and experience working length of journalists working on different role type.
Additional table information: table: news_report

Answer: SELECT AVG(t1.age), AVG(Years_working), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type


Question:
Which Advisor has most of students? List advisor and the number of students.
Additional table information: table: restaurant_1

Answer: SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor ORDER BY COUNT(Advisor) DESC LIMIT 1


Question:
Find the names of all the tracks that contain the word 'you'.
Additional table information: table: chinook_1

Answer: SELECT Name FROM TRACK WHERE Name LIKE '%you%'


Question:
What are the names of all instructors who advise students in the math depart sorted by total credits of the student.
Additional table information: table: college_2

Answer: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred NULLS FIRST


Question:
Find the average access count across all documents?
Additional table information: table: document_management

Answer: SELECT AVG(access_count) FROM documents


Question:
Which industry has the most companies?
Additional table information: table: company_office

Answer: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1