Question:
Find the name and access counts of all documents, in alphabetic order of the document name.
Additional table information: table: document_management

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


Question:
Find the IDs of customers whose name contains 'Diana'.
Additional table information: table: insurance_fnol

Answer: SELECT customer_id FROM customers WHERE customer_name LIKE '%Diana%'


Question:
Find the last names of faculties who are members of computer science department.
Additional table information: table: college_3

Answer: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = 'Computer Science'


Question:
Find the emails of the user named 'Mary'.
Additional table information: table: twitter_1

Answer: SELECT email FROM user_profiles WHERE name = 'Mary'


Question:
Find the name of customers who have both saving and checking account types.
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'


Question:
What are the names of all the races that occurred in the year 2017?
Additional table information: table: formula_1

Answer: SELECT name FROM races WHERE YEAR = 2017


Question:
What are the names of all the media types?
Additional table information: table: store_1

Answer: SELECT name FROM media_types


Question:
What is the most common role for the staff?
Additional table information: table: tracking_grants_for_research

Answer: SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of the top 3 departments that provide the largest amount of courses?
Additional table information: table: college_2

Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
Find the number of funiture types produced by each manufacturer as well as the company names.
Additional table information: table: manufacturer

Answer: SELECT COUNT(*), t1.name FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id GROUP BY t1.manufacturer_id


Question:
What are all the players who played in match season, sorted by college in ascending alphabetical order?
Additional table information: table: match_season

Answer: SELECT player FROM match_season ORDER BY College ASC NULLS FIRST


Question:
Find the last name of female (sex is F) students in the descending order of age.
Additional table information: table: college_3

Answer: SELECT LName FROM STUDENT WHERE Sex = 'F' ORDER BY Age DESC


Question:
What is the name of the department with the most credits?
Additional table information: table: college_2

Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY SUM(credits) DESC LIMIT 1


Question:
Find the product names whose average product price is below 1000000.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_Name FROM PRODUCTS GROUP BY Product_Name HAVING AVG(Product_Price) < 1000000


Question:
List the total points of gymnasts in descending order of floor exercise points.
Additional table information: table: gymnast

Answer: SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC


Question:
What are the official names of cities that have hosted more than one competition?
Additional table information: table: farm

Answer: SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1


Question:
List total amount of  invoice from Chicago, IL.
Additional table information: table: store_1

Answer: SELECT SUM(total) FROM invoices WHERE billing_city = 'Chicago' AND billing_state = 'IL'


Question:
What are the names of all the reviewers and movie names?
Additional table information: table: movie_1

Answer: SELECT name FROM Reviewer UNION SELECT title FROM Movie


Question:
What are the result description of the project whose detail is 'sint'?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint'


Question:
Show the host names for parties with number of hosts greater than 20.
Additional table information: table: party_host

Answer: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20


Question:
Show the ids of all employees who have authorized destruction.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
Which customers have an insurance policy with the type code 'Deputy'? Give me the customer details.
Additional table information: table: insurance_and_eClaims

Answer: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = 'Deputy'


Question:
What is the average age for a male in each job?
Additional table information: table: network_2

Answer: SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job


Question:
Which parties did not have any delegates in elections?
Additional table information: table: election

Answer: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)


Question:
Find the number of customers in total.
Additional table information: table: customer_deliveries

Answer: SELECT COUNT(*) FROM customers


Question:
What information do you have on colleges sorted by increasing enrollment numbers?
Additional table information: table: soccer_2

Answer: SELECT * FROM College ORDER BY enr NULLS FIRST


Question:
What are the building full names that contain the word 'court'?
Additional table information: table: apartment_rentals

Answer: SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE '%court%'


Question:
List the names of buildings that have no company office.
Additional table information: table: company_office

Answer: SELECT name FROM buildings WHERE NOT id IN (SELECT building_id FROM Office_locations)


Question:
When did researchers start and stop working?
Additional table information: table: tracking_grants_for_research

Answer: SELECT date_from, date_to FROM Project_Staff WHERE role_code = 'researcher'


Question:
What are the names and genders of staff who were assigned in 2016?
Additional table information: table: department_store

Answer: SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE '2016%'


Question:
Return the minimum, maximum, and average seating across all tracks.
Additional table information: table: race_track

Answer: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track


Question:
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
Additional table information: table: customers_and_invoices

Answer: SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'


Question:
Which teachers teach in classroom 110? Give me their first names.
Additional table information: table: student_1

Answer: SELECT firstname FROM teachers WHERE classroom = 110


Question:
What are the names and enrollment numbers for colleges that have more than 10000 enrolled and are located in Louisiana?
Additional table information: table: soccer_2

Answer: SELECT cName, enr FROM College WHERE enr > 10000 AND state = 'LA'


Question:
Find the number of students in each major.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), major FROM student GROUP BY major


Question:
how many times is the fleet series (quantity) is 468-473 (6)?
Additional table information: table: "vehicles"."cars"
columns: order_year, manufacturer, model, fleet_series_quantity, powertrain, fuel_propulsion

Answer: SELECT COUNT order_year FROM "vehicles"."cars" WHERE fleet_series_quantity = '468-473 (6)'


Question:
What is the names of the physicians who prescribe medication Thesisin?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = 'Thesisin'


Question:
What are the names of people who are shorter than average?
Additional table information: table: candidate_poll

Answer: SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people)


Question:
what is the name and position of the head whose department has least number of employees?
Additional table information: table: hospital_1

Answer: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
Compute the average profits companies make.
Additional table information: table: company_office

Answer: SELECT AVG(Profits_billion) FROM Companies


Question:
What are the first and last name of the author who published the paper titled 'Nameless, Painless'?
Additional table information: table: icfp_1

Answer: SELECT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = 'Nameless ,  Painless'


Question:
What are the distinct names of customers who have purchased a keyboard?
Additional table information: table: department_store

Answer: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = 'keyboard'


Question:
What are card ids, customer ids, card types, and card numbers for each customer card?
Additional table information: table: customers_card_transactions

Answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards


Question:
Show the names of phones with carrier either 'Sprint' or 'TMobile'.
Additional table information: table: phone_market

Answer: SELECT Name FROM phone WHERE Carrier = 'Sprint' OR Carrier = 'TMobile'


Question:
How many airlines operate out of each country in descending order?
Additional table information: table: flight_4

Answer: SELECT country, COUNT(*) FROM airlines GROUP BY country ORDER BY COUNT(*) DESC


Question:
Find distinct cities of addresses of people?
Additional table information: table: student_assessment

Answer: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id


Question:
What is the minimum, average, and maximum distance of all aircrafts.
Additional table information: table: flight_1

Answer: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft


Question:
Give me the maximum low temperature and average precipitation at the Amersham station.
Additional table information: table: station_weather

Answer: SELECT MAX(t1.low_temperature), AVG(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = 'Amersham'


Question:
What is the total number of companies?
Additional table information: table: gas_company

Answer: SELECT COUNT(*) FROM company


Question:
List each donator name and the amount of endowment in descending order of the amount of endowment.
Additional table information: table: school_finance

Answer: SELECT donator_name, SUM(amount) FROM endowment GROUP BY donator_name ORDER BY SUM(amount) DESC


Question:
Count the number of different companies.
Additional table information: table: entrepreneur

Answer: SELECT COUNT(DISTINCT Company) FROM entrepreneur


Question:
When are the birthdays of customer who are classified as 'Good Customer' status?
Additional table information: table: driving_school

Answer: SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'


Question:
List names of all pilot aged 30 or younger in descending alphabetical order.
Additional table information: table: aircraft

Answer: SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC


Question:
Show the party and the number of drivers in each party.
Additional table information: table: school_bus

Answer: SELECT party, COUNT(*) FROM driver GROUP BY party


Question:
What are the ids of the problems which are reported before 1978-06-26?
Additional table information: table: tracking_software_problems

Answer: SELECT problem_id FROM problems WHERE date_problem_reported < '1978-06-26'


Question:
List all the product names with the color description 'white'.
Additional table information: table: products_gen_characteristics

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


Question:
What was the date of the earliest payment?
Additional table information: table: sakila_1

Answer: SELECT payment_date FROM payment ORDER BY payment_date ASC NULLS FIRST LIMIT 1


Question:
Find the first name, last name and id for the top three players won the most player awards.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 3


Question:
What is the duration, file size, and song format for every pop song, ordered by title alphabetically?
Additional table information: table: music_1

Answer: SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = 'pop' ORDER BY T2.song_name NULLS FIRST


Question:
Tell me the number of orders with 'Second time' as order detail.
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(*) FROM customer_orders WHERE order_details = 'Second time'


Question:
What are the first and last names of the customers with the 10 cheapest 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:
What are the distinct names of nurses on call?
Additional table information: table: hospital_1

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


Question:
Which department has more than 1 head at a time? List the id, name and the number of heads.
Additional table information: table: department_management

Answer: SELECT T1.department_id, T1.name, COUNT(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING COUNT(*) > 1


Question:
What are the names of the pilots in alphabetical order?
Additional table information: table: aircraft

Answer: SELECT Name FROM pilot ORDER BY Name ASC NULLS FIRST


Question:
How many apartments do not have any facility?
Additional table information: table: apartment_rentals

Answer: SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)


Question:
Show all storm names affecting region 'Denmark'.
Additional table information: table: storm_record

Answer: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'


Question:
Find the first names of students who took exactly one class.
Additional table information: table: college_1

Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING COUNT(*) = 1


Question:
For each director, return the director's name together with the title of the movie they directed that received the highest rating among all of their movies, and the value of that rating. Ignore movies whose director is NULL.
Additional table information: table: movie_1

Answer: SELECT T2.title, T1.stars, T2.director, MAX(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> 'null' GROUP BY director


Question:
List the first names of people in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT first_name FROM people ORDER BY first_name NULLS FIRST


Question:
How many counties correspond to each police force?
Additional table information: table: county_public_safety

Answer: SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force


Question:
List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name.
Additional table information: table: scientist_1

Answer: SELECT T1.Name, T3.Name, T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name NULLS FIRST, T1.Name NULLS FIRST


Question:
Show the account id and name with at least 4 transactions.
Additional table information: table: customers_and_invoices

Answer: SELECT T1.account_id, T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING COUNT(*) >= 4


Question:
What is the average number of pages per minute color?
Additional table information: table: store_product

Answer: SELECT AVG(pages_per_minute_color) FROM product


Question:
List the name of artworks in ascending alphabetical order.
Additional table information: table: entertainment_awards

Answer: SELECT Name FROM artwork ORDER BY Name ASC NULLS FIRST


Question:
Show the names of all the employees with role 'HR'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_name FROM Employees WHERE role_code = 'HR'


Question:
Find the average age of students who live in the city with code 'NYC' and have secretary votes in the spring election cycle.
Additional table information: table: voter_2

Answer: SELECT AVG(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = 'NYC' AND T2.Election_Cycle = 'Spring'


Question:
How many students are there?
Additional table information: table: student_1

Answer: SELECT COUNT(*) FROM list


Question:
What is the name of the media type that is least common across all tracks?
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What are the customer ids for customers who do not have an account?
Additional table information: table: customers_and_invoices

Answer: SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts


Question:
Find the number of products with category 'Spices' and typically sold above 1000.
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products WHERE product_category_code = 'Spices' AND typical_buying_price > 1000


Question:
Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not 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 = 'Alison' EXCEPT 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 = 'Rosalind'


Question:
Find the full names of employees who help customers with the first name Leonie.
Additional table information: table: chinook_1

Answer: SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'


Question:
Show the zip code of the county with name 'Howard'.
Additional table information: table: election

Answer: SELECT Zip_code FROM county WHERE County_name = 'Howard'


Question:
What is the title of a course that is listed in both the Statistics and Psychology departments?
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'


Question:
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.
Additional table information: table: e_learning

Answer: SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC NULLS FIRST


Question:
What is the name of the customer that made the order with the largest quantity?
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 JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = (SELECT MAX(order_quantity) FROM order_items)


Question:
What are the names of the campus that have more faculties in 2002 than the maximum number in Orange county?
Additional table information: table: csu_1

Answer: SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND faculty > (SELECT MAX(faculty) FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2002 AND T1.county = 'Orange')


Question:
What are the names of the climbers, ordered by points descending?
Additional table information: table: climbing

Answer: SELECT Name FROM climber ORDER BY Points DESC


Question:
What are the support, consider, and oppose rates of each candidate, ordered ascending by their unsure rate?
Additional table information: table: candidate_poll

Answer: SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY unsure_rate NULLS FIRST


Question:
What are the average price and score of wines for each appelation?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Score), Appelation FROM WINE GROUP BY Appelation


Question:
Show all cities where students live.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT city_code FROM Student


Question:
What are the details of the project that is producing both patents and papers as outcomes?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Patent'


Question:
List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007.
Additional table information: table: baseball_1

Answer: SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'


Question:
Which students have professors as their advisors? Find their student ids.
Additional table information: table: activity_1

Answer: SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = 'Professor'


Question:
What are the themes and years for exhibitions, sorted by ticket price descending?
Additional table information: table: theme_gallery

Answer: SELECT theme, YEAR FROM exhibition ORDER BY ticket_price DESC


Question:
What is the name of the department with the most students enrolled?
Additional table information: table: college_1

Answer: SELECT T4.dept_name 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 GROUP BY T3.dept_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Select the names of manufacturer whose products have an average price higher than or equal to $150.
Additional table information: table: manufactory_1

Answer: SELECT AVG(T1.Price), T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING AVG(T1.price) >= 150


Question:
Count the number of total papers.
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM papers


Question:
How many distinct governors are there?
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT Governor) FROM party


Question:
what are the names of the ships ordered by ascending tonnage?
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship ORDER BY Tonnage ASC NULLS FIRST


Question:
Which days had a minimum dew point smaller than any day in zip code 94107, and in which zip codes were those measurements taken?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)


Question:
List all club names in ascending order of start year.
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY Start_year ASC NULLS FIRST


Question:
List the name of physicians who never took any appointment.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID


Question:
When did Carole Bernhard first become a customer?
Additional table information: table: driving_school

Answer: SELECT date_became_customer FROM Customers WHERE first_name = 'Carole' AND last_name = 'Bernhard'


Question:
What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.
Additional table information: table: bike_1

Answer: SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5


Question:
How many projects are there?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Projects


Question:
How many countries do not have an roller coaster longer than 3000?
Additional table information: table: roller_coaster

Answer: SELECT COUNT(*) FROM country WHERE NOT country_id IN (SELECT country_id FROM roller_coaster WHERE LENGTH > 3000)


Question:
Return the names of products in the category 'Spices'.
Additional table information: table: products_gen_characteristics

Answer: SELECT product_name FROM products WHERE product_category_code = 'Spices'


Question:
What instrument did the musician with last name 'Heilo' use in the song 'Badlands'?
Additional table information: table: music_2

Answer: SELECT T4.instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId JOIN Instruments AS T4 ON T4.songid = T3.songid AND T4.bandmateid = T2.id WHERE T2.lastname = 'Heilo' AND T3.title = 'Badlands'


Question:
What are the department ids for which more than 10 employees had a commission?
Additional table information: table: hr_1

Answer: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10


Question:
What are the distinct hometowns of gymnasts with total points more than 57.5?
Additional table information: table: gymnast

Answer: SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5


Question:
Show ids, first names, last names, and phones for all customers.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers


Question:
What are the first names for all students who are from the major numbered 600?
Additional table information: table: game_1

Answer: SELECT Fname FROM Student WHERE Major = 600


Question:
Find the major that is studied by the largest number of students.
Additional table information: table: voter_2

Answer: SELECT Major FROM STUDENT GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the last names of faculty in building Barton, sorted by last name?
Additional table information: table: college_3

Answer: SELECT Lname FROM FACULTY WHERE Building = 'Barton' ORDER BY Lname NULLS FIRST


Question:
Which customers have both 'On Road' and 'Shipped' as order status? List the customer names.
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Shipped'


Question:
List the maximum scores of the team Boston Red Stockings when the team won in postseason?
Additional table information: table: baseball_1

Answer: SELECT MAX(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'


Question:
List the name, location, mascot for all schools.
Additional table information: table: school_finance

Answer: SELECT school_name, LOCATION, mascot FROM school


Question:
How many students have each different allergy?
Additional table information: table: allergy_1

Answer: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy


Question:
How many bands are there?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM Band


Question:
List the names of all genres in alphabetical oder, together with its ratings.
Additional table information: table: music_1

Answer: SELECT g_name, rating FROM genre ORDER BY g_name NULLS FIRST


Question:
Find the title of course that is provided by Statistics but not Psychology departments.
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'


Question:
Find the name of persons who are friends with Alice for the shortest years.
Additional table information: table: network_2

Answer: SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT MIN(YEAR) FROM PersonFriend WHERE friend = 'Alice')


Question:
What are the types of video games and how many are in each type?
Additional table information: table: game_1

Answer: SELECT gtype, COUNT(*) FROM Video_games GROUP BY gtype


Question:
What is the id of the reviewer whose name has substring “Mike”?
Additional table information: table: movie_1

Answer: SELECT rID FROM Reviewer WHERE name LIKE '%Mike%'


Question:
What are the apartment number and the room count of each apartment?
Additional table information: table: apartment_rentals

Answer: SELECT apt_number, room_count FROM Apartments


Question:
List all people names in the order of their date of birth from old to young.
Additional table information: table: candidate_poll

Answer: SELECT name FROM people ORDER BY date_of_birth NULLS FIRST


Question:
What is the name of the person who has the oldest average age for their friends, and what is that average age?
Additional table information: table: network_2

Answer: SELECT T2.name, AVG(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY AVG(T1.age) DESC LIMIT 1


Question:
What are the numbers of constructors for different nationalities?
Additional table information: table: formula_1

Answer: SELECT COUNT(*), nationality FROM constructors GROUP BY nationality


Question:
Show first name, last name, age for all female students. Their sex is F.
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'


Question:
Whare the names, friends, and ages of all people who are older than the average age of a person?
Additional table information: table: network_2

Answer: SELECT DISTINCT T2.name, T2.friend, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM person)


Question:
How many activities do we have?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Activity


Question:
Which district has the least area?
Additional table information: table: store_product

Answer: SELECT district_name FROM district ORDER BY city_area ASC NULLS FIRST LIMIT 1


Question:
How many cards does customer Art Turcotte have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
What is the full name of the employee who has the most customers?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each fourth-grade classroom, show the classroom number and the total number of students using it.
Additional table information: table: student_1

Answer: SELECT classroom, COUNT(*) FROM list WHERE grade = '4' GROUP BY classroom


Question:
How many accounts are there for each customer id?
Additional table information: table: customers_card_transactions

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


Question:
What are the times of elimination for any instances in which the elimination was done by Punk or Orton?
Additional table information: table: wrestler

Answer: SELECT TIME FROM elimination WHERE Eliminated_By = 'Punk' OR Eliminated_By = 'Orton'


Question:
What are names of customers who never ordered product Latte.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte'


Question:
Which state has the most customers?
Additional table information: table: customer_complaints

Answer: SELECT state FROM customers GROUP BY state ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the names and prices of all products in the store?
Additional table information: table: manufactory_1

Answer: SELECT name, price FROM products


Question:
For each Orange county campus, report the number of degrees granted after 2000.
Additional table information: table: csu_1

Answer: SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = 'Orange' AND T2.year >= 2000 GROUP BY T1.campus


Question:
What is the name of the player with the largest number of votes?
Additional table information: table: riding_club

Answer: SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1


Question:
What is the average price across all products?
Additional table information: table: manufactory_1

Answer: SELECT AVG(price) FROM products


Question:
Show ids for all documents in type CV without expense budgets.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents WHERE document_type_code = 'CV' EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
How many different source system code for the cmi cross references are there?
Additional table information: table: local_govt_mdm

Answer: SELECT COUNT(DISTINCT source_system_code) FROM CMI_cross_references


Question:
What is the lowest salary in departments with average salary greater than the overall average.
Additional table information: table: college_2

Answer: SELECT MIN(salary), dept_name FROM instructor GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor)


Question:
Find the titles of all movies 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:
List the names of the customers who have once bought product 'food'.
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_name FROM customers AS T1, orders AS T2, order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = 'food' GROUP BY T1.customer_id HAVING COUNT(*) >= 1


Question:
Find all the policy type codes associated with the customer 'Dayana Robel'
Additional table information: table: insurance_and_eClaims

Answer: SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = 'Dayana Robel'


Question:
Which papers' first author is affiliated with an institution in the country 'Japan' and has last name 'Ohori'? Give me the titles of the papers.
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 JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = 'Japan' AND t2.authorder = 1 AND t1.lname = 'Ohori'


Question:
For each election cycle, report the number of voting records.
Additional table information: table: voter_2

Answer: SELECT Election_Cycle, COUNT(*) FROM VOTING_RECORD GROUP BY Election_Cycle


Question:
What is the issue date of the volume with the minimum 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:
Show the most common headquarter for companies.
Additional table information: table: company_employee

Answer: SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the names and classes of ships that do not have a captain?
Additional table information: table: ship_1

Answer: SELECT name, CLASS FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain)


Question:
How many papers are published by the institution 'Tokohu University'?
Additional table information: table: icfp_1

Answer: SELECT COUNT(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = 'Tokohu University'


Question:
Show the description of the transaction type that occurs most frequently.
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the shipping agent names?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT shipping_agent_name FROM Ref_Shipping_Agents


Question:
What is the song in the volume with the maximum weeks on top?
Additional table information: table: music_4

Answer: SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1


Question:
List all program origins in the alphabetical order.
Additional table information: table: program_share

Answer: SELECT origin FROM program ORDER BY origin NULLS FIRST


Question:
Please show the nominee who has been nominated the greatest number of times.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the average prices of products, grouped by manufacturer code?
Additional table information: table: manufactory_1

Answer: SELECT AVG(Price), manufacturer FROM Products GROUP BY manufacturer


Question:
What is the address of employee Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
Find the name of customer who has the lowest credit score.
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer ORDER BY credit_score NULLS FIRST LIMIT 1


Question:
What are the product names with average product price smaller than 1000000?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_Name FROM PRODUCTS GROUP BY Product_Name HAVING AVG(Product_Price) < 1000000


Question:
Find the name of medication used on the patient who stays in room 111?
Additional table information: table: hospital_1

Answer: SELECT T4.name FROM stay AS T1 JOIN patient AS T2 ON T1.Patient = T2.SSN JOIN Prescribes AS T3 ON T3.Patient = T2.SSN JOIN Medication AS T4 ON T3.Medication = T4.Code WHERE room = 111


Question:
Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005.
Additional table information: table: wine_1

Answer: SELECT MAX(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2.year < 2005


Question:
List all of the ids for left-footed players with a height between 180cm and 190cm.
Additional table information: table: soccer_1

Answer: SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = 'left'


Question:
Show all game names played by at least 1000 hours.
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 HAVING SUM(hours_played) >= 1000


Question:
How many musicians play in the song 'Flash'?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.Title = 'Flash'


Question:
What are the first name and last name of each male member in club 'Hopkins Student Enterprises'?
Additional table information: table: club_1

Answer: SELECT t3.fname, t3.lname 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 t1.clubname = 'Hopkins Student Enterprises' AND t3.sex = 'M'


Question:
Return the the names of the drama workshop groups that are located in Feliciaberg city.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.City_Town = 'Feliciaberg'


Question:
What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets?
Additional table information: table: gas_company

Answer: SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3


Question:
Show all titles and their instructors' names for courses in 2008, in alphabetical order by title.
Additional table information: table: college_2

Answer: SELECT T1.title, T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title NULLS FIRST


Question:
What are the names of wines made from red grapes and with prices above 50?
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red' AND T2.price > 50


Question:
What is the salaray and name of the employee that is certified to fly the most planes?
Additional table information: table: flight_1

Answer: SELECT T1.name, T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which authors have submitted to more than one workshop?
Additional table information: table: workshop_paper

Answer: SELECT T2.Author FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.workshop_id) > 1


Question:
What are the names of the channels owned by CCTV or HBS?
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'


Question:
Show the description for role name 'Proof Reader'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_description FROM ROLES WHERE role_name = 'Proof Reader'


Question:
Count the number of companies.
Additional table information: table: company_office

Answer: SELECT COUNT(*) FROM Companies


Question:
What are the first and last names of the performer who was in the back stage position for the song 'Badlands'?
Additional table information: table: music_2

Answer: SELECT T2.firstname, T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Badlands' AND T1.StagePosition = 'back'


Question:
What are the facility codes of the apartments with more than four bedrooms?
Additional table information: table: apartment_rentals

Answer: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4


Question:
Show all transaction ids with transaction code 'PUR'.
Additional table information: table: tracking_share_transactions

Answer: SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code = 'PUR'


Question:
What is zip code of customer with first name as Carole and last name as Bernhard?
Additional table information: table: driving_school

Answer: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
What are the names and flags of ships that do not have a captain with the rank of Midshipman?
Additional table information: table: ship_1

Answer: SELECT name, flag FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')


Question:
What are the different names of the product characteristics?
Additional table information: table: products_gen_characteristics

Answer: SELECT DISTINCT characteristic_name FROM CHARACTERISTICS


Question:
Show all cities along with the number of drama workshop groups in each city.
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:
List the names of members who did not attend any performance.
Additional table information: table: performance_attendance

Answer: SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM member_attendance)


Question:
Find the names of students who have taken any course in the fall semester of year 2003.
Additional table information: table: college_2

Answer: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003)


Question:
How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'


Question:
Show the names of members and the location of performances they attended in ascending alphabetical order of their names.
Additional table information: table: performance_attendance

Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name ASC NULLS FIRST


Question:
What is the zip code of the address where the teacher with first name 'Lyla' lives?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Lyla'


Question:
How many airports are there per city in the United States? Order the cities by decreasing number of airports.
Additional table information: table: flight_4

Answer: SELECT COUNT(*), city FROM airports WHERE country = 'United States' GROUP BY city ORDER BY COUNT(*) DESC


Question:
Show different locations and the number of performances at each location.
Additional table information: table: performance_attendance

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


Question:
What are the distinct majors that students with treasurer votes are studying?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote


Question:
What are the full names and gradepoints for all enrollments?
Additional table information: table: college_3

Answer: SELECT T3.Fname, T3.LName, T2.gradepoint FROM ENROLLED_IN AS T1, GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID


Question:
Return the duration of the actor with the greatest age.
Additional table information: table: musical

Answer: SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1


Question:
How many items in inventory does store 1 have?
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM inventory WHERE store_id = 1


Question:
Find the name of the person who has friends with age above 40 but not under age 30?
Additional table information: table: network_2

Answer: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)


Question:
Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance.
Additional table information: table: small_bank_1

Answer: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT AVG(balance) FROM savings)


Question:
display job ID for those jobs that were done by two or more for more than 300 days.
Additional table information: table: hr_1

Answer: SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2


Question:
Show the organizer and name for churches that opened between 1830 and 1840.
Additional table information: table: wedding

Answer: SELECT organized_by, name FROM church WHERE open_date BETWEEN 1830 AND 1840


Question:
What are the names and parties of representatives?
Additional table information: table: election_representative

Answer: SELECT Name, Party FROM representative


Question:
Find the name of rooms booked by some customers whose first name contains ROY.
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'


Question:
How many players enter hall of fame each year?
Additional table information: table: baseball_1

Answer: SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid


Question:
Check the invoices record and compute the average quantities ordered with the payment method 'MasterCard'.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT AVG(Order_Quantity) FROM Invoices WHERE payment_method_code = 'MasterCard'


Question:
How many distinct countries are the climbers from?
Additional table information: table: climbing

Answer: SELECT COUNT(DISTINCT Country) FROM climber


Question:
What is the id of the store that has the most items in inventory?
Additional table information: table: sakila_1

Answer: SELECT store_id FROM inventory GROUP BY store_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of the customers who have order status both 'On Road' and 'Shipped'.
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Shipped'


Question:
What is the name and country of origin for each artist who has released a song with a resolution higher than 900?
Additional table information: table: music_1

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


Question:
What are the first names and date of birth of professors teaching course ACCT-211?
Additional table information: table: college_1

Answer: SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = 'ACCT-211'


Question:
Which department has the lowest budget?
Additional table information: table: college_2

Answer: SELECT dept_name FROM department ORDER BY budget NULLS FIRST LIMIT 1


Question:
Find out 5 customers who most recently purchased something. List customers' first and last name.
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 T2.invoice_date DESC LIMIT 5


Question:
Count the number of users that are logged in.
Additional table information: table: document_management

Answer: SELECT COUNT(*) FROM users WHERE user_login = 1


Question:
How old is each gender, on average?
Additional table information: table: network_2

Answer: SELECT AVG(age), gender FROM Person GROUP BY gender


Question:
Find the names of customers who never ordered product Latte.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte'


Question:
What are the names of customers who have a loan of more than 3000 in amount?
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000


Question:
Return the highest acc percent across all basketball matches.
Additional table information: table: university_basketball

Answer: SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1


Question:
How many students got accepted after the tryout?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM tryout WHERE decision = 'yes'


Question:
Return the hometown that is most common among gymnasts.
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 ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of gymnasts whose hometown is not 'Santo Domingo'?
Additional table information: table: gymnast

Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown <> 'Santo Domingo'


Question:
A list of the top 10 countries by average invoice size. List country name and average invoice size.
Additional table information: table: store_1

Answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10


Question:
What are the total purchases for members rated at 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 is the ordered list of customer ids?
Additional table information: table: insurance_fnol

Answer: SELECT customer_id, customer_name FROM customers ORDER BY customer_id ASC NULLS FIRST


Question:
Count the number of book clubs.
Additional table information: table: culture_company

Answer: SELECT COUNT(*) FROM book_club


Question:
Show names of pilots that have more than one record.
Additional table information: table: pilot_record

Answer: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1


Question:
Find the category descriptions of the products whose descriptions include letter 't'.
Additional table information: table: products_gen_characteristics

Answer: SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'


Question:
Find the id of songs that are available in mp4 format and have resolution lower than 1000.
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' INTERSECT SELECT f_id FROM song WHERE resolution < 1000


Question:
Which students are unaffected by allergies?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy


Question:
List the all the distinct names of the products with the characteristic name 'warm'.
Additional table information: table: products_gen_characteristics

Answer: SELECT DISTINCT t1.product_name 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 t3.characteristic_name = 'warm'


Question:
What is the name of the ship with the largest tonnage?
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1


Question:
How old is the youngest person for each job?
Additional table information: table: network_2

Answer: SELECT MIN(age), job FROM Person GROUP BY job


Question:
List the name and phone number of all suppliers in the alphabetical order of their addresses.
Additional table information: table: department_store

Answer: SELECT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details NULLS FIRST


Question:
How many customers have at least one order with status 'Cancelled'?
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(DISTINCT customer_id) FROM customer_orders WHERE order_status = 'Cancelled'


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

Answer: SELECT AVG(UnitPrice) FROM TRACK


Question:
Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800' INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Airbus A340-300'


Question:
What are the name of pilots aged 25 or older?
Additional table information: table: aircraft

Answer: SELECT Name FROM pilot WHERE Age >= 25


Question:
Count the number of distinct claim outcome codes.
Additional table information: table: insurance_and_eClaims

Answer: SELECT COUNT(DISTINCT claim_outcome_code) FROM claims_processing


Question:
What are the codes corresponding to document types for which there are less than 3 documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3


Question:
Which park had most attendances in 2008?
Additional table information: table: baseball_1

Answer: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1


Question:
Select the name and price of all products with a price larger than or equal to $180, and sort first by price (in descending order), and then by name  (in ascending order).
Additional table information: table: manufactory_1

Answer: SELECT name, price FROM products WHERE price >= 180 ORDER BY price DESC, name ASC NULLS FIRST


Question:
Which allergy type has least number of allergies?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Count the number of games taken place in park 'Columbia Park' in 1907.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park'


Question:
List the names of pilots in ascending order of rank.
Additional table information: table: pilot_record

Answer: SELECT Pilot_name FROM pilot ORDER BY Rank ASC NULLS FIRST


Question:
What are the types of film market estimations in year 1995?
Additional table information: table: film_rank

Answer: SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995


Question:
List the names of entrepreneurs and their companies in descending order of money requested?
Additional table information: table: entrepreneur

Answer: SELECT T2.Name, T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested NULLS FIRST


Question:
Show the name of the building that has the most company offices.
Additional table information: table: company_office

Answer: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the number of rooms for each bed type?
Additional table information: table: inn_1

Answer: SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType


Question:
How many users are there?
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM user_profiles


Question:
What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?
Additional table information: table: game_injury

Answer: SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'


Question:
What is the name of the customer who has the most orders?
Additional table information: table: tracking_orders

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


Question:
What are the names of wines that are more expensive then all wines made in the year 2006?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006)


Question:
What are the name of rooms booked by customers whose first name has 'ROY' in part?
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'


Question:
What are the weights of entrepreneurs in descending order of money requested?
Additional table information: table: entrepreneur

Answer: SELECT T2.Weight FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested DESC


Question:
What are the names of body builders whose total score is higher than 300?
Additional table information: table: body_builder

Answer: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300


Question:
List the camera lens names containing substring 'Digital'.
Additional table information: table: mountain_photos

Answer: SELECT name FROM camera_lens WHERE name LIKE '%Digital%'


Question:
How many different courses offered by Physics department?
Additional table information: table: college_2

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


Question:
Count the number of different hometowns of these people.
Additional table information: table: gymnast

Answer: SELECT COUNT(DISTINCT Hometown) FROM people


Question:
What is the name and salary for employee with id 242518965?
Additional table information: table: flight_1

Answer: SELECT name, salary FROM Employee WHERE eid = 242518965


Question:
What are the maximum, minimum and average home games each stadium held?
Additional table information: table: game_injury

Answer: SELECT MAX(home_games), MIN(home_games), AVG(home_games) FROM stadium


Question:
Find the total revenue of companies whose revenue is larger than the revenue of some companies based in Austin.
Additional table information: table: manufactory_1

Answer: SELECT SUM(revenue) FROM manufacturers WHERE revenue > (SELECT MIN(revenue) FROM manufacturers WHERE headquarter = 'Austin')


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

Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Accounts)


Question:
Return the countries of the mountains that have a height larger than 5000.
Additional table information: table: climbing

Answer: SELECT Country FROM mountain WHERE Height > 5000


Question:
Compute the number of products with a price larger than or equal to $180.
Additional table information: table: manufactory_1

Answer: SELECT COUNT(*) FROM products WHERE price >= 180


Question:
What campuses are located in Chico?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE LOCATION = 'Chico'


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

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


Question:
Find the number of students who participate in the tryout for each college ordered by descending count.
Additional table information: table: soccer_2

Answer: SELECT COUNT(*), cName FROM tryout GROUP BY cName ORDER BY COUNT(*) DESC


Question:
What is the code of each location and the number of documents in that location?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_code, COUNT(*) FROM Document_locations GROUP BY location_code


Question:
What are the full names of employees who with in department 70 or 90?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90


Question:
What are the names and ids of all stations that have more than 14 bikes available on average or had bikes installed in December?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE '12/%'


Question:
Give the color description for the product 'catnip'.
Additional table information: table: products_gen_characteristics

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


Question:
Find the total and average amount of settlements.
Additional table information: table: insurance_fnol

Answer: SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements


Question:
find the name of people whose height is lower than the average.
Additional table information: table: candidate_poll

Answer: SELECT name FROM people WHERE height < (SELECT AVG(height) FROM people)


Question:
What is the savings balance of the account belonging to the customer with the highest checking balance?
Additional table information: table: small_bank_1

Answer: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance DESC LIMIT 1


Question:
Find the titles of all the papers written by 'Aaron Turon'.
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 = 'Aaron' AND t1.lname = 'Turon'


Question:
Find the id and surname of the driver who participated the most number of races?
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 GROUP BY T1.driverid ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number of dorms and total capacity for each gender.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), SUM(student_capacity), gender FROM dorm GROUP BY gender


Question:
Find the details for all chip models.
Additional table information: table: phone_1

Answer: SELECT * FROM chip_model


Question:
What are all info of students who registered courses but not attended courses?
Additional table information: table: student_assessment

Answer: SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
Find the number of male (sex is 'M') students who have some food type allery.
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE sex = 'M' AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food')


Question:
List the nominees that have been nominated more than two musicals.
Additional table information: table: musical

Answer: SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2


Question:
List the names and origins of people who are not body builders.
Additional table information: table: body_builder

Answer: SELECT Name, birth_place FROM people EXCEPT SELECT T1.Name, T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id = T2.people_id


Question:
show all train numbers and names ordered by their time from early to late.
Additional table information: table: station_weather

Answer: SELECT train_number, name FROM train ORDER BY TIME NULLS FIRST


Question:
Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger 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:
What is the name of the department with an instructure who has a name like 'Soisalon'?
Additional table information: table: college_2

Answer: SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'


Question:
How many students are there?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM student


Question:
Return the number of music festivals of each category.
Additional table information: table: music_4

Answer: SELECT Category, COUNT(*) FROM music_festival GROUP BY Category


Question:
What are the names of the customers who bought product 'food' at least once?
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_name FROM customers AS T1, orders AS T2, order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = 'food' GROUP BY T1.customer_id HAVING COUNT(*) >= 1


Question:
List the order id, customer id for orders in Cancelled status, ordered by their order dates.
Additional table information: table: department_store

Answer: SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = 'Cancelled' ORDER BY order_date NULLS FIRST


Question:
What are the names of all female candidates in alphabetical order (sex is F)?
Additional table information: table: candidate_poll

Answer: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name NULLS FIRST


Question:
What products are available at store named 'Miramichi'?
Additional table information: table: store_product

Answer: SELECT t1.product FROM product AS t1 JOIN store_product AS t2 ON t1.product_id = t2.product_id JOIN store AS t3 ON t2.store_id = t3.store_id WHERE t3.store_name = 'Miramichi'


Question:
Show all product names without an order.
Additional table information: table: customers_and_invoices

Answer: SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id


Question:
Show the average and maximum damage for all storms with max speed higher than 1000.
Additional table information: table: storm_record

Answer: SELECT AVG(damage_millions_USD), MAX(damage_millions_USD) FROM storm WHERE max_speed > 1000


Question:
List the dates of debates with number of audience bigger than 150
Additional table information: table: debate

Answer: SELECT Date FROM debate WHERE Num_of_Audience > 150


Question:
What are the names of technicians and the machine series that they repair?
Additional table information: table: machine_repair

Answer: SELECT T3.Name, T2.Machine_series 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


Question:
What are the ids of stations that are located in San Francisco and have average bike availability above 10.
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE city = 'San Francisco' INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10


Question:
What are the first names of the faculty members playing both Canoeing and Kayaking?
Additional table information: table: activity_1

Answer: SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'


Question:
What is the total salary paid by team Boston Red Stockings in 2010?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010


Question:
Find the name of the most expensive product.
Additional table information: table: customer_deliveries

Answer: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1


Question:
How many sections does each course have?
Additional table information: table: college_1

Answer: SELECT COUNT(*), crs_code FROM CLASS GROUP BY crs_code


Question:
What is the station station and end station for the trips with the three smallest ids?
Additional table information: table: bike_1

Answer: SELECT start_station_name, end_station_name FROM trip ORDER BY id NULLS FIRST LIMIT 3


Question:
For each trip, return its ending station's installation date.
Additional table information: table: bike_1

Answer: SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id


Question:
Show director with the largest number of show times in total.
Additional table information: table: cinema

Answer: SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY SUM(T1.show_times_per_day) DESC LIMIT 1


Question:
What are the different product colors?
Additional table information: table: customers_and_invoices

Answer: SELECT DISTINCT product_color FROM Products


Question:
Which destination has least number of flights?
Additional table information: table: flight_1

Answer: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the names of customers using the most popular payment method?
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1)


Question:
Which artist does the album 'Balls to the Wall' belong to?
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:
Show all game names played by Linda Smith
Additional table information: table: game_1

Answer: SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = 'Smith' AND T3.Fname = 'Linda'


Question:
List the asset id, details, make and model for every asset.
Additional table information: table: assets_maintenance

Answer: SELECT asset_id, asset_details, asset_make, asset_model FROM Assets


Question:
Which allergy type is the least common?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What are the names of the schools with the top 3 largest class sizes?
Additional table information: table: soccer_2

Answer: SELECT cName FROM college ORDER BY enr DESC LIMIT 3


Question:
What are the first names of all teachers who have taught a course and the corresponding descriptions?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code


Question:
what is the salary and name of the employee who has the most number of aircraft certificates?
Additional table information: table: flight_1

Answer: SELECT T1.name, T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of mountains in ascending alphabetical order?
Additional table information: table: climbing

Answer: SELECT Name FROM mountain ORDER BY Name ASC NULLS FIRST


Question:
What are the names of the heads who are born outside the California state?
Additional table information: table: department_management

Answer: SELECT name FROM head WHERE born_state <> 'California'


Question:
List the full name (first and last name), and salary for those employees who earn below 6000.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE salary < 6000


Question:
For each classroom report the grade that is taught in it. Report just the classroom number and the grade number.
Additional table information: table: student_1

Answer: SELECT DISTINCT classroom, grade FROM list


Question:
display all the information of the employees whose salary if within the range of smallest salary and 2500.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500


Question:
Find the names of items whose rank is higher than 3 and whose average rating is above 5.
Additional table information: table: epinions_1

Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id HAVING AVG(T2.rating) > 5


Question:
How many coaches does each club has? List the club id, name and the number of coaches.
Additional table information: table: riding_club

Answer: SELECT T1.club_id, T1.club_name, COUNT(*) FROM club AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id


Question:
How many different colleges were represented at tryouts?
Additional table information: table: soccer_2

Answer: SELECT COUNT(DISTINCT cName) FROM tryout


Question:
For each location, how many gas stations are there in order?
Additional table information: table: gas_company

Answer: SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) NULLS FIRST


Question:
What is the project detail for the project with document 'King Book'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = 'King Book'


Question:
How many airlines are there?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM airlines


Question:
Find the names of all distinct wines that have appellations in North Coast area.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'North Coast'


Question:
Show ids for all employees with at least 100000 salary.
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee WHERE salary > 100000


Question:
How many Annual Meeting events happened in the United Kingdom region?
Additional table information: table: party_people

Answer: SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = 'United Kingdom' AND t3.Event_Name = 'Annaual Meeting'


Question:
What is the id, name and nationality of the architect who built most mills?
Additional table information: table: architecture

Answer: SELECT T1.id, T1.name, T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the denomination shared by schools founded before 1890 and schools founded after 1900
Additional table information: table: school_player

Answer: SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900


Question:
Return the primary conference of the school with the lowest acc percentage score.
Additional table information: table: university_basketball

Answer: SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent NULLS FIRST LIMIT 1


Question:
List the name of ships that are not involved in any mission
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM mission)


Question:
Select the names and the prices of all the products in the store.
Additional table information: table: manufactory_1

Answer: SELECT name, price FROM products


Question:
What is the total time for all lessons taught by Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT SUM(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What are ids and total number of hours played for each game?
Additional table information: table: game_1

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


Question:
What are the life spans of representatives from New York state or Indiana state?
Additional table information: table: election_representative

Answer: SELECT Lifespan FROM representative WHERE State = 'New York' OR State = 'Indiana'


Question:
List the position of players with average number of points scored by players of that position bigger than 20.
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player GROUP BY name HAVING AVG(Points) >= 20


Question:
What is the name of the staff that is in charge of the attraction named 'US museum'?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name FROM STAFF AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = 'US museum'


Question:
Show the apartment numbers of apartments with unit status availability of both 0 and 1.
Additional table information: table: apartment_rentals

Answer: SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1


Question:
Show the position of players and the corresponding number of players.
Additional table information: table: match_season

Answer: SELECT POSITION, COUNT(*) FROM match_season GROUP BY POSITION


Question:
Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department.
Additional table information: table: college_1

Answer: SELECT DISTINCT T2.emp_fname, T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'


Question:
Which channels are not owned by CCTV? Give me the channel names.
Additional table information: table: program_share

Answer: SELECT name FROM channel WHERE OWNER <> 'CCTV'


Question:
Find the name and city of the airport which is the destination of the most number of routes.
Additional table information: table: flight_4

Answer: SELECT T1.name, T1.city, T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid GROUP BY T2.dst_apid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the dates of the assessment notes?
Additional table information: table: behavior_monitoring

Answer: SELECT date_of_notes FROM Assessment_Notes


Question:
Count the number of financial transactions that the account with the name 337 has.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = '337'


Question:
Show the names of people and the number of times they have been on the affirmative side of debates.
Additional table information: table: debate

Answer: SELECT T2.Name, COUNT(*) FROM debate_people AS T1 JOIN people AS T2 ON T1.Affirmative = T2.People_ID GROUP BY T2.Name


Question:
What are the different types of video games?
Additional table information: table: game_1

Answer: SELECT DISTINCT gtype FROM Video_games


Question:
What is the name of the airport that is the destination of the most number of routes that start in China?
Additional table information: table: flight_4

Answer: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is id of the city that hosted events in the most recent year?
Additional table information: table: city_record

Answer: SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1


Question:
What is the id of the longest song?
Additional table information: table: music_1

Answer: SELECT f_id FROM files ORDER BY duration DESC LIMIT 1


Question:
Please show the names and the players of clubs.
Additional table information: table: sports_competition

Answer: SELECT T1.name, T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID


Question:
How many professors do have a Ph.D. degree?
Additional table information: table: college_1

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


Question:
Show codes and fates of missions, and names of ships involved.
Additional table information: table: ship_mission

Answer: SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID


Question:
Which teachers teach in classroom 109? Give me their last names.
Additional table information: table: student_1

Answer: SELECT lastname FROM teachers WHERE classroom = 109


Question:
What is the department name and corresponding building for the department with the greatest budget?
Additional table information: table: college_2

Answer: SELECT dept_name, building FROM department ORDER BY budget DESC LIMIT 1


Question:
What is the count of customers that Steve Johnson supports?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = 'Steve' AND T1.last_name = 'Johnson'


Question:
What is the total number of students?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student


Question:
Find the name, account type, and account balance of the customer who has the highest credit score.
Additional table information: table: loan_1

Answer: SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1


Question:
Show the players and years played for players from team 'Columbus Crew'.
Additional table information: table: match_season

Answer: SELECT T1.Player, T1.Years_Played FROM player AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Columbus Crew'


Question:
Show the document type code with fewer than 3 documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3


Question:
What are the ids of the students who are under 20 years old and are involved in at least one activity.
Additional table information: table: activity_1

Answer: SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20


Question:
Which distinct source system code includes the substring 'en'?
Additional table information: table: local_govt_mdm

Answer: SELECT DISTINCT source_system_code FROM cmi_cross_references WHERE source_system_code LIKE '%en%'


Question:
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.
Additional table information: table: insurance_policies

Answer: SELECT T1.claim_id, T1.date_claim_made, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the total and minimum enrollment of all schools?
Additional table information: table: university_basketball

Answer: SELECT SUM(enrollment), MIN(enrollment) FROM university


Question:
Find the attribute data type for the attribute named 'Green'.
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = 'Green'


Question:
Find the name of the first 5 customers.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name FROM Customers ORDER BY date_became_customer NULLS FIRST LIMIT 5


Question:
What are the first name and last name of the players whose death record is empty?
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE death_year = ''


Question:
What are the daily hire costs for the products with substring 'Book' in its name?
Additional table information: table: products_for_hire

Answer: SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'


Question:
Which transportation method is used the most often to get to tourist attractions?
Additional table information: table: cre_Theme_park

Answer: SELECT How_to_Get_There FROM Tourist_Attractions GROUP BY How_to_Get_There ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of customers.
Additional table information: table: customer_complaints

Answer: SELECT COUNT(*) FROM customers


Question:
What are all the dates of enrollment and completion in record?
Additional table information: table: e_learning

Answer: SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment


Question:
Show all payment method codes and the number of orders for each code.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT payment_method_code, COUNT(*) FROM INVOICES GROUP BY payment_method_code


Question:
What are the ids of the problems which are reported after 1978-06-26?
Additional table information: table: tracking_software_problems

Answer: SELECT problem_id FROM problems WHERE date_problem_reported > '1978-06-26'


Question:
What is the title of the album that was released by the artist whose name has the phrase 'Led'?
Additional table information: table: store_1

Answer: SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'


Question:
Find the name of the customer who made the order of the largest amount of goods.
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 JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = (SELECT MAX(order_quantity) FROM order_items)


Question:
Find the first names and last names of male (sex is M) faculties who live in building NEB.
Additional table information: table: college_3

Answer: SELECT Fname, Lname FROM FACULTY WHERE sex = 'M' AND Building = 'NEB'


Question:
Which papers have the substring 'Database' in their titles? Show the titles of the papers.
Additional table information: table: icfp_1

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


Question:
In what city does Janessa Sawayn live?
Additional table information: table: driving_school

Answer: SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
which course has most number of registered students?
Additional table information: table: student_assessment

Answer: SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the names and details of all the staff members.
Additional table information: table: cre_Theme_park

Answer: SELECT Name, Other_Details FROM Staff


Question:
How many students are there?
Additional table information: table: club_1

Answer: SELECT COUNT(*) FROM student


Question:
What are the details for the project whose research has been published?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id JOIN Research_outcomes AS T3 ON T2.outcome_code = T3.outcome_code WHERE T3.outcome_description LIKE '%Published%'


Question:
List the official names of cities that have not held any competition.
Additional table information: table: farm

Answer: SELECT Official_Name FROM city WHERE NOT City_ID IN (SELECT Host_city_ID FROM farm_competition)


Question:
How many actors have appeared in each musical?
Additional table information: table: musical

Answer: SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID


Question:
For each product that has problems, find the number of problems reported after 1986-11-13 and the product id?
Additional table information: table: tracking_software_problems

Answer: SELECT COUNT(*), T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T1.date_problem_reported > '1986-11-13' GROUP BY T2.product_id


Question:
find the full name of employees who report to Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT T2.first_name, T2.last_name FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = 'Nancy' AND T1.last_name = 'Edwards'


Question:
Which school has the smallest amount of professors?
Additional table information: table: college_1

Answer: SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
How many wrestlers are there?
Additional table information: table: wrestler

Answer: SELECT COUNT(*) FROM wrestler


Question:
Which employees were hired after September 7th, 1987?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date > '1987-09-07'


Question:
display the department ID, full name (first and last name), salary for those employees who is highest salary in every department.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id


Question:
Give the ids of the three products purchased in the largest amounts.
Additional table information: table: department_store

Answer: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3


Question:
What is the owner of the channel that has the highest rating ratio?
Additional table information: table: program_share

Answer: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1


Question:
What are the line 1 of addresses shared by some students and some teachers?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.line_1 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id INTERSECT SELECT T1.line_1 FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id


Question:
What is the id of every song that has a resolution higher than that of a song with a rating below 8?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8)


Question:
Find the number of routes from the United States to Canada.
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')


Question:
What are the locations of all the gas stations ordered by opening year?
Additional table information: table: gas_company

Answer: SELECT LOCATION FROM gas_station ORDER BY open_year NULLS FIRST


Question:
Which year had the greatest number of courses?
Additional table information: table: college_2

Answer: SELECT YEAR FROM SECTION GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1