Question:
Report all advisors that advise more than 2 students.
Additional table information: table: voter_2

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


Question:
What are the city name, id, and number of addresses corresponding to the city with the most addressed?
Additional table information: table: sakila_1

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


Question:
List all restaurant types.
Additional table information: table: restaurant_1

Answer: SELECT ResTypeName FROM Restaurant_Type


Question:
What are the id and address of the shops which have a happy hour in May?
Additional table information: table: coffee_shop

Answer: SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = 'May'


Question:
What is the invoice number and invoice date corresponding to the invoice with the greatest number of transactions?
Additional table information: table: customers_and_invoices

Answer: SELECT T2.invoice_number, T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids of all students who played video games and sports?
Additional table information: table: game_1

Answer: SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games


Question:
What is the name of the organization that was formed most recently?
Additional table information: table: e_government

Answer: SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1


Question:
Count the total number of bookings made.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT COUNT(*) FROM BOOKINGS


Question:
Return the ids and details corresponding to projects for which there are more than two documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_id, T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING COUNT(*) > 2


Question:
Give me the first name and last name for all the female members of the club 'Bootup Baltimore'.
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 = 'Bootup Baltimore' AND t3.sex = 'F'


Question:
What is the channel code and contact number of the customer contact channel that was active for the longest time?
Additional table information: table: customers_and_addresses

Answer: SELECT channel_code, contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)


Question:
What are the names and other details for accounts corresponding to the customer named Meaghan Keeling?
Additional table information: table: customers_and_invoices

Answer: SELECT 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' AND T2.customer_last_name = 'Keeling'


Question:
Which orders are made by the customer named 'Jeramie'? Give me the order ids and status.
Additional table information: table: tracking_orders

Answer: SELECT T2.order_id, T2.order_status FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Jeramie'


Question:
What are the ids of all students who live in CHI?
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE city_code = 'CHI'


Question:
Find the name and description of the role with code 'MG'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_name, role_description FROM ROLES WHERE role_code = 'MG'


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

Answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'


Question:
Find the distinct names of wines produced before the year of 2000 or after the year of 2010.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010


Question:
How many camera lenses have a focal length longer than 15 mm?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(*) FROM camera_lens WHERE focal_length_mm > 15


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

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


Question:
Show all church names that have hosted least two weddings.
Additional table information: table: wedding

Answer: SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING COUNT(*) >= 2


Question:
List the total scores of body builders in ascending order.
Additional table information: table: body_builder

Answer: SELECT Total FROM body_builder ORDER BY Total ASC NULLS FIRST


Question:
Group by ships by flag, and return number of ships that have each flag.
Additional table information: table: ship_1

Answer: SELECT COUNT(*), flag FROM ship GROUP BY flag


Question:
What are the percentage of hispanics in cities with the black percentage higher than 10?
Additional table information: table: county_public_safety

Answer: SELECT Hispanic FROM city WHERE Black > 10


Question:
What is the last name of the student who got a grade A in the class with code 10018.
Additional table information: table: college_1

Answer: SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018


Question:
What is the zip code in which the average mean sea level pressure is the lowest?
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) NULLS FIRST LIMIT 1


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

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


Question:
Show the denomination of the school that has the most players.
Additional table information: table: school_player

Answer: SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of rooms whose base price is between 120 and 150.
Additional table information: table: inn_1

Answer: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150


Question:
How many distinct artists do the volumes associate to?
Additional table information: table: music_4

Answer: SELECT COUNT(DISTINCT Artist_ID) FROM volume


Question:
How many regions were affected by each storm?
Additional table information: table: storm_record

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


Question:
Return the flag that is most common among all ships.
Additional table information: table: ship_1

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


Question:
What are the names of scientists who are not working on the project with the most hours?
Additional table information: table: scientist_1

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


Question:
What is the name and the average gpa of department whose students have the highest average gpa?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, AVG(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY AVG(T1.stu_gpa) DESC LIMIT 1


Question:
Show ids of students who play video game and play sports.
Additional table information: table: game_1

Answer: SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games


Question:
Find the name of the courses that do not have any prerequisite?
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)


Question:
Find the name and component amount of the least popular furniture.
Additional table information: table: manufacturer

Answer: SELECT name, Num_of_Component FROM furniture ORDER BY market_rate NULLS FIRST LIMIT 1


Question:
Which nations have both hosts of age above 45 and hosts of age below 35?
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35


Question:
For each competition, count the number of matches.
Additional table information: table: city_record

Answer: SELECT COUNT(*), Competition FROM MATCH GROUP BY Competition


Question:
Give the names, details, and data types of characteristics that are not found in any product.
Additional table information: table: products_gen_characteristics

Answer: SELECT characteristic_name, other_characteristic_details, characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name, t1.other_characteristic_details, t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id


Question:
What is the alphabetically ordered list of all the distinct names of nurses?
Additional table information: table: hospital_1

Answer: SELECT DISTINCT name FROM nurse ORDER BY name NULLS FIRST


Question:
What are the monthly rentals of student addresses in Texas state?
Additional table information: table: behavior_monitoring

Answer: SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Texas'


Question:
List categories that have at least two books after year 1989.
Additional table information: table: culture_company

Answer: SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2


Question:
What are the first name, last name, and phone number of all the female faculty members?
Additional table information: table: activity_1

Answer: SELECT Fname, Lname, phone FROM Faculty WHERE Sex = 'F'


Question:
List the studios which average gross is above 4500000.
Additional table information: table: film_rank

Answer: SELECT Studio FROM film GROUP BY Studio HAVING AVG(Gross_in_dollar) >= 4500000


Question:
What are the companies and main industries of all companies that are not headquartered in the United States?
Additional table information: table: gas_company

Answer: SELECT company, main_industry FROM company WHERE headquarters <> 'USA'


Question:
What is the 'active to date' of the latest contact channel used by 'Tillman Ernser'?
Additional table information: table: customers_and_addresses

Answer: SELECT MAX(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = 'Tillman Ernser'


Question:
List name of all tracks in Balls to the Wall.
Additional table information: table: store_1

Answer: SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'


Question:
How many stores are headquarted in each city?
Additional table information: table: store_product

Answer: SELECT t3.headquartered_city, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city


Question:
What are the names of documents that do not have any sections?
Additional table information: table: document_management

Answer: SELECT document_name FROM documents WHERE NOT document_code IN (SELECT document_code FROM document_sections)


Question:
What are the details of the lots which are not used in any transactions?
Additional table information: table: tracking_share_transactions

Answer: SELECT lot_details FROM Lots EXCEPT SELECT T1.lot_details FROM Lots AS T1 JOIN transactions_lots AS T2 ON T1.lot_id = T2.lot_id


Question:
Show ids for all documents with budget types described as 'Government'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = 'Government'


Question:
What is the vocal type of the band mate whose first name is 'Marianne' played the most?
Additional table information: table: music_2

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


Question:
Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.sent_date FROM documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research'


Question:
What is the phone number and postal code of the address 1031 Daugavpils Parkway?
Additional table information: table: sakila_1

Answer: SELECT phone, postal_code FROM address WHERE address = '1031 Daugavpils Parkway'


Question:
What are the names of movies that get 3 star and 4 star?
Additional table information: table: movie_1

Answer: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 4


Question:
Return the maximum and minimum number of cities across all markets.
Additional table information: table: film_rank

Answer: SELECT MAX(Number_cities), MIN(Number_cities) FROM market


Question:
What are the names of studios that have produced films with both Nicholas Meyer and Walter Hill?
Additional table information: table: film_rank

Answer: SELECT Studio FROM film WHERE Director = 'Nicholas Meyer' INTERSECT SELECT Studio FROM film WHERE Director = 'Walter Hill'


Question:
Show all advisors who have at least two students.
Additional table information: table: game_1

Answer: SELECT advisor FROM Student GROUP BY advisor HAVING COUNT(*) >= 2


Question:
Which engineers have never visited to maintain the assets? List the engineer first name and last name.
Additional table information: table: assets_maintenance

Answer: SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits)


Question:
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims)


Question:
What is detail of the student who registered the most number of courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of banks that have loaned money to customers with credit scores below 100?
Additional table information: table: loan_1

Answer: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100


Question:
What are the numbers of all flights coming from Los Angeles?
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE origin = 'Los Angeles'


Question:
Who is the youngest employee in the company? List employee's first and last name.
Additional table information: table: store_1

Answer: SELECT first_name, last_name FROM employees ORDER BY birth_date DESC LIMIT 1


Question:
How many colleges in total?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM College


Question:
What is the title of the film that has the highest high market estimation.
Additional table information: table: film_rank

Answer: SELECT t1.title FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID ORDER BY high_estimate DESC LIMIT 1


Question:
Show the ids of all employees who have destroyed a document.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed


Question:
What is the average height of the players from the college named 'Yale University'?
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'


Question:
What are all the movies rated as R? List the titles.
Additional table information: table: sakila_1

Answer: SELECT title FROM film WHERE rating = 'R'


Question:
Name all the products with next entry ID greater than 8.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8


Question:
What are the names of courses without prerequisites?
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)


Question:
Find the names of customers whose name contains 'Diana'.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers WHERE customer_details LIKE '%Diana%'


Question:
Show the id and star rating of each hotel, ordered by its price from low to high.
Additional table information: table: cre_Theme_park

Answer: SELECT hotel_id, star_rating_code FROM HOTELS ORDER BY price_range ASC NULLS FIRST


Question:
What is the name of all the people who are older than at least one engineer? Order them by age.
Additional table information: table: network_2

Answer: SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM person WHERE job = 'engineer') ORDER BY age NULLS FIRST


Question:
What are the full names and hire dates for employees in the same department as someone with the first name Clara?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = 'Clara')


Question:
What are the companies of entrepreneurs, ordered descending by amount of money requested?
Additional table information: table: entrepreneur

Answer: SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC


Question:
display all the details from Employees table for those employees who was hired before 2002-06-21.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date < '2002-06-21'


Question:
Find the names of artists that do not have any albums.
Additional table information: table: chinook_1

Answer: SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId


Question:
What are names and savings balances of the three accounts with the highest savings balances?
Additional table information: table: small_bank_1

Answer: SELECT T1.name, T2.balance FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T2.balance DESC LIMIT 3


Question:
Find the total number of available hotels.
Additional table information: table: cre_Theme_park

Answer: SELECT COUNT(*) FROM HOTELS


Question:
Find the rank of the faculty that the fewest faculties belong to.
Additional table information: table: college_3

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


Question:
What is the name of the race held most recently?
Additional table information: table: formula_1

Answer: SELECT name FROM races ORDER BY date DESC LIMIT 1


Question:
Show the maximum and minimum share count of different transaction types.
Additional table information: table: tracking_share_transactions

Answer: SELECT transaction_type_code, MAX(share_count), MIN(share_count) FROM TRANSACTIONS GROUP BY transaction_type_code


Question:
What are the names of all songs in English?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE languages = 'english'


Question:
How many events had participants whose details had the substring 'Dr.'
Additional table information: table: local_govt_in_alabama

Answer: SELECT COUNT(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%'


Question:
Find the average number of customers cross all banks.
Additional table information: table: loan_1

Answer: SELECT AVG(no_of_customers) FROM bank


Question:
Which person whose friends have the oldest 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:
How many games has each stadium held?
Additional table information: table: game_injury

Answer: SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id


Question:
What is the largest major?
Additional table information: table: allergy_1

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


Question:
Show the average price of hotels for different pet policy.
Additional table information: table: cre_Theme_park

Answer: SELECT pets_allowed_yn, AVG(price_range) FROM HOTELS GROUP BY pets_allowed_yn


Question:
What are the investors who have invested in both entrepreneurs who requested more than 140000 and entrepreneurs who requested less than 120000?
Additional table information: table: entrepreneur

Answer: SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000


Question:
What are the different cities listed?
Additional table information: table: manufactory_1

Answer: SELECT DISTINCT headquarter FROM manufacturers


Question:
Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261.
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'


Question:
Find employee with ID and name of the country presently where (s)he is working.
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id


Question:
Return the names of people, ordered by weight ascending.
Additional table information: table: entrepreneur

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


Question:
How much in total does customer with first name as Carole and last name as Bernhard paid?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Carole' AND T2.last_name = 'Bernhard'


Question:
How many departments are in the division AS?
Additional table information: table: college_3

Answer: SELECT COUNT(*) FROM DEPARTMENT WHERE Division = 'AS'


Question:
For each airport name, how many routes start at that airport?
Additional table information: table: flight_4

Answer: SELECT COUNT(*), T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name


Question:
List all customers’ names in the alphabetical order.
Additional table information: table: small_bank_1

Answer: SELECT name FROM accounts ORDER BY name NULLS FIRST


Question:
What are the maximum and average height of the mountains?
Additional table information: table: mountain_photos

Answer: SELECT MAX(height), AVG(height) FROM mountain


Question:
What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?
Additional table information: table: department_store

Answer: SELECT product_id FROM Order_Items GROUP BY product_id HAVING COUNT(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING SUM(total_amount_purchased) > 80000


Question:
Show the names of players and names of their coaches.
Additional table information: table: riding_club

Answer: SELECT T3.Player_name, T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID


Question:
In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently?
Additional table information: table: movie_1

Answer: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year NULLS FIRST


Question:
How many customers are there?
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(*) FROM customers


Question:
What are the names of customers with accounts, and how many checking accounts do each of them have?
Additional table information: table: small_bank_1

Answer: SELECT COUNT(*), T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid GROUP BY T1.name


Question:
List the names of buildings in descending order of building height.
Additional table information: table: company_office

Answer: SELECT name FROM buildings ORDER BY Height DESC


Question:
Return the code of the card type that is most common.
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the titles of movies and books corresponding to companies incorporated in China?
Additional table information: table: culture_company

Answer: SELECT T1.title, T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'


Question:
Which physicians are in charge of more than one patient? Give me their names.
Additional table information: table: hospital_1

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


Question:
What are the name and primarily affiliated department name of each physician?
Additional table information: table: hospital_1

Answer: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1


Question:
Show the names of trains and locations of railways they are in.
Additional table information: table: railway

Answer: SELECT T2.Name, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID


Question:
What are the names of all employees who have a certificate to fly Boeing 737-800?
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'


Question:
What are the nationalities and ages of journalists?
Additional table information: table: news_report

Answer: SELECT Nationality, Age FROM journalist


Question:
List the names of editors that are not on any journal committee.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE NOT editor_id IN (SELECT editor_id FROM journal_committee)


Question:
Show order ids and the number of products in each order.
Additional table information: table: customers_and_invoices

Answer: SELECT order_id, COUNT(DISTINCT product_id) FROM Order_items GROUP BY order_id


Question:
What are the names of body builders?
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


Question:
How many students are over 18 and do not have allergy to food type or animal type?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food' OR T2.allergytype = 'animal')


Question:
Find the name and age of the person who is a friend of Dan or Alice.
Additional table information: table: network_2

Answer: SELECT DISTINCT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice'


Question:
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
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 = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'


Question:
What is the email of the student with first name 'Emma' and last name 'Rohan'?
Additional table information: table: behavior_monitoring

Answer: SELECT email_address FROM Students WHERE first_name = 'Emma' AND last_name = 'Rohan'


Question:
What are the ids and durations of the trips with the top 3 durations?
Additional table information: table: bike_1

Answer: SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3


Question:
Find the number of teachers who teach the student called CHRISSY NABOZNY.
Additional table information: table: student_1

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


Question:
What is the characteristic name used by most number of the products?
Additional table information: table: products_gen_characteristics

Answer: SELECT t3.characteristic_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 GROUP BY t3.characteristic_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the venue of the competition '1994 FIFA World Cup qualification' which was hosted by 'Nanjing ( Jiangsu )'.
Additional table information: table: city_record

Answer: SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = 'Nanjing ( Jiangsu )' AND T3.competition = '1994 FIFA World Cup qualification'


Question:
Find the payment method that is used the most often in all the invoices. Give me its code.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT payment_method_code FROM INVOICES GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the composer who created the track 'Fast As a Shark'?
Additional table information: table: store_1

Answer: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'


Question:
What procedures cost less than 5000 and have John Wen as a trained physician?
Additional table information: table: hospital_1

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


Question:
Show the people that have been governor the most times.
Additional table information: table: election

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


Question:
List the total number of horses on farms in ascending order.
Additional table information: table: farm

Answer: SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC NULLS FIRST


Question:
What are the login names and family names of course author and tutors?
Additional table information: table: e_learning

Answer: SELECT login_name, family_name FROM Course_Authors_and_Tutors


Question:
How many different countries are all the swimmers from?
Additional table information: table: swimming

Answer: SELECT COUNT(DISTINCT nationality) FROM swimmer


Question:
What are the names of representatives and the dates of elections they participated in.
Additional table information: table: election_representative

Answer: SELECT T2.Name, T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID


Question:
Find the faculty rank that has the least members.
Additional table information: table: activity_1

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


Question:
Show total hours per week and number of games played for student David Shieber.
Additional table information: table: game_1

Answer: SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = 'David' AND T2.Lname = 'Shieber'


Question:
What are the order details of the products with price higher than 2000?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Other_Item_Details FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_price > 2000


Question:
What buildings have faculty offices?
Additional table information: table: activity_1

Answer: SELECT DISTINCT building FROM Faculty


Question:
What are the names of actors ordered descending by the year in which their musical was awarded?
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC


Question:
What are all the instruments used?
Additional table information: table: music_2

Answer: SELECT DISTINCT instrument FROM Instruments


Question:
Return all reviewer names and movie names together in a single list.
Additional table information: table: movie_1

Answer: SELECT name FROM Reviewer UNION SELECT title FROM Movie


Question:
How many females does this network has?
Additional table information: table: network_2

Answer: SELECT COUNT(*) FROM Person WHERE gender = 'female'


Question:
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.
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:
Select the names of all the products in the store.
Additional table information: table: manufactory_1

Answer: SELECT Name FROM Products


Question:
How many settlements are there in total?
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*) FROM Settlements


Question:
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin' AND T1.lesson_status_code = 'Completed'


Question:
What is the rank, company, and market value of every comapny in the banking industry ordered by sales and profits?
Additional table information: table: gas_company

Answer: SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion NULLS FIRST, profits_billion NULLS FIRST


Question:
Find the names of customers who have no policies associated.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id


Question:
What is the total amount of grants given by each organisations? Also list the organisation id.
Additional table information: table: tracking_grants_for_research

Answer: SELECT SUM(grant_amount), organisation_id FROM Grants GROUP BY organisation_id


Question:
What are the id and name of the mountains that have at least 2 photos?
Additional table information: table: mountain_photos

Answer: SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING COUNT(*) >= 2


Question:
Return the the 'active to date' of the latest contact channel used by the customer named 'Tillman Ernser'.
Additional table information: table: customers_and_addresses

Answer: SELECT MAX(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = 'Tillman Ernser'


Question:
What are the ids and last names of all drivers who participated in the most 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:
Which payment method is used by most customers?
Additional table information: table: customers_and_addresses

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


Question:
What are the names of all cities and states?
Additional table information: table: e_government

Answer: SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses


Question:
What country does Roberto Almeida live?
Additional table information: table: store_1

Answer: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'


Question:
Who are the owners of the programs that broadcast both in the morning and at night?
Additional table information: table: program_share

Answer: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning' INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Night'


Question:
What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%' ORDER BY department_id NULLS FIRST


Question:
Who is the nominee who has been nominated for the most musicals?
Additional table information: table: musical

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


Question:
What are the white percentages of cities, and the corresponding crime rates of the counties they correspond to?
Additional table information: table: county_public_safety

Answer: SELECT T1.White, T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID


Question:
What campuses are located in Los Angeles county and opened after 1950?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE county = 'Los Angeles' AND YEAR > 1950


Question:
Show the years and the official names of the host cities of competitions.
Additional table information: table: farm

Answer: SELECT T2.Year, T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID


Question:
List the studios of each film and the number of films produced by that studio.
Additional table information: table: film_rank

Answer: SELECT Studio, COUNT(*) FROM film GROUP BY Studio


Question:
What are the distinct names of the products that cost more than the average?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT DISTINCT Product_Name FROM PRODUCTS WHERE Product_Price > (SELECT AVG(Product_Price) FROM PRODUCTS)


Question:
Show the first name and last name for all the instructors.
Additional table information: table: activity_1

Answer: SELECT fname, lname FROM Faculty WHERE Rank = 'Instructor'


Question:
For each player, what are their name, season, and country that they belong to?
Additional table information: table: match_season

Answer: SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country


Question:
Find the names of all reviewers who have contributed three or more ratings.
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3


Question:
Which customers have made at least two orders? Give me each customer name and number of orders made.
Additional table information: table: tracking_orders

Answer: SELECT T2.customer_name, COUNT(*) FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING COUNT(*) >= 2


Question:
List names of all teams in the basketball competition, ordered by all home scores in descending order.
Additional table information: table: university_basketball

Answer: SELECT team_name FROM basketball_match ORDER BY All_Home DESC


Question:
What are the names of captains, sorted by age descending?
Additional table information: table: ship_1

Answer: SELECT name FROM captain ORDER BY age DESC


Question:
Find the name of dorms which have TV Lounge but no Study Room as amenity.
Additional table information: table: dorm_1

Answer: SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room'


Question:
What is the name of the stadium which held the most events?
Additional table information: table: swimming

Answer: SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
list the name, job title of all people ordered by their names.
Additional table information: table: network_2

Answer: SELECT name, job FROM Person ORDER BY name NULLS FIRST


Question:
What are the names of captains that have either the rank Midshipman or Lieutenant?
Additional table information: table: ship_1

Answer: SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'


Question:
Return the id of the project that has the fewest corresponding documents.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
How many songs appear in studio albums?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE t1.type = 'Studio'


Question:
Show ids for all transactions whose amounts are greater than the average.
Additional table information: table: customers_and_invoices

Answer: SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM Financial_transactions)


Question:
What are the first names and last names of the students that minor in the department with DNO 140.
Additional table information: table: college_3

Answer: SELECT T2.Fname, T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140


Question:
What is the total access count of documents that are of the most common document type?
Additional table information: table: document_management

Answer: SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
On which day and in which zip code was the min dew point lower than any day in zip code 94107?
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:
how many schools exist in total?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT school_code) FROM department


Question:
What is the average age for all managers?
Additional table information: table: railway

Answer: SELECT AVG(Age) FROM manager


Question:
What are the names of countains that no climber has climbed?
Additional table information: table: climbing

Answer: SELECT Name FROM mountain WHERE NOT Mountain_ID IN (SELECT Mountain_ID FROM climber)


Question:
Display the first name, and department number for all employees whose last name is 'McEwen'.
Additional table information: table: hr_1

Answer: SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'


Question:
Return the colleges that have players who play the Midfielder position, as well as players who play the Defender position.
Additional table information: table: match_season

Answer: SELECT College FROM match_season WHERE POSITION = 'Midfielder' INTERSECT SELECT College FROM match_season WHERE POSITION = 'Defender'


Question:
What are the faculty ids of all the male faculty members?
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty WHERE Sex = 'M'


Question:
Show all locations and the number of gas stations in each location ordered by the count.
Additional table information: table: gas_company

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


Question:
Find the name of different colleges involved in the tryout in alphabetical order.
Additional table information: table: soccer_2

Answer: SELECT DISTINCT cName FROM tryout ORDER BY cName NULLS FIRST


Question:
Which committees have delegates from both democratic party and liberal party?
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic' INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Liberal'


Question:
Find the number of rooms that do not have any reservation.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM rooms WHERE NOT roomid IN (SELECT DISTINCT room FROM reservations)


Question:
Tell me what the notes are for South Australia.
Additional table information: table: regional_marketing
columns: state_territory, text_bg_color, format, current_slogan, current_series, Notes

Answer: SELECT Notes FROM "regional_marketing" WHERE current_slogan = 'SOUTH AUSTRALIA'


Question:
Give the maximum and minimum gradepoints for students living in NYC?
Additional table information: table: college_3

Answer: SELECT MAX(T2.gradepoint), MIN(T2.gradepoint) FROM ENROLLED_IN AS T1, GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = 'NYC'


Question:
Count the number of different colleges that players who play for Columbus Crew are from.
Additional table information: table: match_season

Answer: SELECT COUNT(DISTINCT T1.College) FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Columbus Crew'


Question:
Show student ids who are on scholarship and have major 600.
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'


Question:
Find the id and star rating of each hotel and sort them in increasing order of price.
Additional table information: table: cre_Theme_park

Answer: SELECT hotel_id, star_rating_code FROM HOTELS ORDER BY price_range ASC NULLS FIRST


Question:
Find the distinct number of president votes.
Additional table information: table: voter_2

Answer: SELECT COUNT(DISTINCT President_Vote) FROM VOTING_RECORD


Question:
Return the rank for which there are the fewest captains.
Additional table information: table: ship_1

Answer: SELECT rank FROM captain GROUP BY rank ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the total checking and saving balance of all accounts sorted by the total balance in ascending order.
Additional table information: table: small_bank_1

Answer: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance NULLS FIRST


Question:
Show the names and total passengers for all train stations not in London.
Additional table information: table: train_station

Answer: SELECT name, total_passengers FROM station WHERE LOCATION <> 'London'


Question:
List the name of all rooms sorted by their prices.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY basePrice NULLS FIRST


Question:
What are the names of representatives whose party is not 'Republican'?
Additional table information: table: election_representative

Answer: SELECT Name FROM Representative WHERE Party <> 'Republican'


Question:
Find the count of universities whose campus fee is greater than the average campus fee.
Additional table information: table: csu_1

Answer: SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees)


Question:
What are the names and data types of the characteristics of the 'cumin' product?
Additional table information: table: products_gen_characteristics

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


Question:
What are the names of all pilots 30 years old or young in descending alphabetical order?
Additional table information: table: aircraft

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


Question:
How many cities are in Australia?
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'


Question:
Show the team that have at least two technicians.
Additional table information: table: machine_repair

Answer: SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2


Question:
How many transactions do we have?
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Financial_transactions


Question:
Count the number of cities in Australia.
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'


Question:
List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major <> 600 AND Sex = 'F'


Question:
List all vehicle id
Additional table information: table: driving_school

Answer: SELECT vehicle_id FROM Vehicles


Question:
What are the ids of the students who registered for course 301 most recently?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1


Question:
What are all details of the students who registered but did not attend any course?
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 ids of the problems reported after the date of any problems reported by the staff Rylan Homenick.
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > (SELECT MAX(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Rylan' AND T4.staff_last_name = 'Homenick')


Question:
Show the first year and last year of parties with theme 'Spring' or 'Teqnology'.
Additional table information: table: party_host

Answer: SELECT First_year, Last_year FROM party WHERE Party_Theme = 'Spring' OR Party_Theme = 'Teqnology'


Question:
Return all the information for each election record.
Additional table information: table: election

Answer: SELECT * FROM election


Question:
How many medicines have the FDA approval status 'No' ?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(*) FROM medicine WHERE FDA_approved = 'No'


Question:
How many devices are there?
Additional table information: table: device

Answer: SELECT COUNT(*) FROM device


Question:
Return the party email that has used party services the greatest number of times.
Additional table information: table: e_government

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


Question:
Return the id and full name of the customer who has the fewest accounts.
Additional table information: table: customers_card_transactions

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


Question:
What are teh names of the different products, as well as the number of customers who have ordered each product.
Additional table information: table: customers_and_invoices

Answer: SELECT T2.product_name, COUNT(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name


Question:
What are all the section titles of the document named 'David CV'?
Additional table information: table: document_management

Answer: SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = 'David CV'


Question:
How many different locations does each school have?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_address), school_code FROM department GROUP BY school_code


Question:
Show the names of festivals that have nominated artworks of type 'Program Talent Show'.
Additional table information: table: entertainment_awards

Answer: SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T2.Type = 'Program Talent Show'


Question:
How many flights do we have?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Flight


Question:
What are the gender and occupation of players?
Additional table information: table: riding_club

Answer: SELECT Gender, Occupation FROM player


Question:
How many students play video games?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT StuID) FROM Plays_games


Question:
How many documents have the status code done?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT COUNT(*) FROM Documents WHERE document_status_code = 'done'


Question:
What are the id of students who registered courses or attended courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance


Question:
How many undergraduates are there in 'San Jose State University' in year 2004?
Additional table information: table: csu_1

Answer: SELECT SUM(t1.undergraduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = 'San Jose State University'


Question:
What are the id and details of the customers who have at least 3 events?
Additional table information: table: local_govt_and_lot

Answer: SELECT T1.customer_id, T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 3


Question:
Find the number of members living in each address.
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*), address FROM member GROUP BY address


Question:
What are the names of players who train between 500 and 1500 hours?
Additional table information: table: soccer_2

Answer: SELECT pName FROM Player WHERE HS BETWEEN 500 AND 1500


Question:
What are the ids of the stations in San Francisco that normally have more than 10 bikes available?
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 is the average credit score for customers who have never taken a loan?
Additional table information: table: loan_1

Answer: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)


Question:
Show the number of all customers without an account.
Additional table information: table: customers_card_transactions

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


Question:
Return the descriptions and names of the courses that have more than two students enrolled in.
Additional table information: table: e_learning

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


Question:
How many allergies are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergy) FROM Allergy_type


Question:
Find the number of tied games (the value of 'ties' is '1') in 1885 postseason.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason WHERE YEAR = 1885 AND ties = 1


Question:
Which address do not have any member with the black membership card?
Additional table information: table: coffee_shop

Answer: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card = 'Black'


Question:
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds?
Additional table information: table: bike_1

Answer: SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3


Question:
What are the titles and studios of films that have been produced by a studio whose name contains 'Universal'?
Additional table information: table: film_rank

Answer: SELECT title, Studio FROM film WHERE Studio LIKE '%Universal%'


Question:
Show the names of donors who donated to both school 'Glenn' and 'Triton.'
Additional table information: table: school_finance

Answer: SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn' INTERSECT SELECT T1.donator_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Triton'


Question:
What is the forename and surname of the driver with the shortest laptime?
Additional table information: table: formula_1

Answer: SELECT T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds NULLS FIRST LIMIT 1


Question:
What type has the most games?
Additional table information: table: game_1

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


Question:
What are the personal name, family name, and author ID of the course author who teaches the most courses?
Additional table information: table: e_learning

Answer: SELECT T1.personal_name, T1.family_name, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the number of different different airports that are destinations for American Airlines?
Additional table information: table: flight_4

Answer: SELECT COUNT(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'


Question:
Count the number of different languages in these films.
Additional table information: table: sakila_1

Answer: SELECT COUNT(DISTINCT language_id) FROM film


Question:
What is the id for the employee called Ebba?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_ID FROM Employees WHERE employee_name = 'Ebba'


Question:
What is the country of origin of the artist who is female and produced a song in Bangla?
Additional table information: table: music_1

Answer: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female' AND T2.languages = 'bangla'


Question:
Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names.
Additional table information: table: student_1

Answer: SELECT DISTINCT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = 'OTHA' AND T2.lastname = 'MOYER'


Question:
What is the date of the performance with the highest number of attendees?
Additional table information: table: performance_attendance

Answer: SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1


Question:
What are the names and years of all races that had a driver with the last name Lewis?
Additional table information: table: formula_1

Answer: SELECT T2.name, T2.year FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T1.driverid = T3.driverid WHERE T3.forename = 'Lewis'


Question:
What are the location and nickname of each school?
Additional table information: table: school_player

Answer: SELECT T1.Location, T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID


Question:
Find the average number of followers for the users who do not have any tweet.
Additional table information: table: twitter_1

Answer: SELECT AVG(followers) FROM user_profiles WHERE NOT UID IN (SELECT UID FROM tweets)


Question:
Show the account id with most number of transactions.
Additional table information: table: customers_and_invoices

Answer: SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show me the classrooms grade 5 is using.
Additional table information: table: student_1

Answer: SELECT DISTINCT classroom FROM list WHERE grade = 5


Question:
For all directors who have directed more than one movie, what movies have they directed and what are their names?
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title ORDER BY T1.director NULLS FIRST, T1.title NULLS FIRST


Question:
Show all male student ids who don't play football.
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = 'Football'


Question:
What are the names of the counties of public safety, ordered by population descending?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC


Question:
What are the distinct buildings with capacities of greater than 50?
Additional table information: table: college_2

Answer: SELECT DISTINCT building FROM classroom WHERE capacity > 50


Question:
Compute the average price of all products with manufacturer code equal to 2.
Additional table information: table: manufactory_1

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


Question:
Count different addresses of each school.
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_address), school_code FROM department GROUP BY school_code


Question:
Which kind of part has the least number of faults? List the part name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
which countries have more than 2 airports?
Additional table information: table: flight_company

Answer: SELECT country FROM airport GROUP BY country HAVING COUNT(*) > 2


Question:
Tell me the payment method used by the customer who ordered the least amount of goods in total.
Additional table information: table: customers_and_addresses

Answer: SELECT t1.payment_method 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 GROUP BY t1.customer_name ORDER BY SUM(t3.order_quantity) NULLS FIRST LIMIT 1


Question:
What are the distinct types of mills that are built by American or Canadian architects?
Additional table information: table: architecture

Answer: SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'


Question:
Return the investor who have invested in the greatest number of entrepreneurs.
Additional table information: table: entrepreneur

Answer: SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32.
Additional table information: table: phone_1

Answer: SELECT T2.Hardware_Model_name, T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32


Question:
Which vocal type did the musician with first name 'Solveig' played in the song with title 'A Bar in Amsterdam'?
Additional table information: table: music_2

Answer: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid JOIN band AS T3 ON T1.bandmate = T3.id WHERE T3.firstname = 'Solveig' AND T2.title = 'A Bar In Amsterdam'


Question:
report the total number of degrees granted between 1998 and 2002.
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 T2.year >= 1998 AND T2.year <= 2002 GROUP BY T1.campus


Question:
How many invoices correspond to each order id?
Additional table information: table: customers_and_invoices

Answer: SELECT order_id, COUNT(*) FROM Invoices GROUP BY order_id


Question:
Sort all captain names by their ages from old to young.
Additional table information: table: ship_1

Answer: SELECT name FROM captain ORDER BY age DESC


Question:
Show the average amount of transactions for different lots, ordered by average amount of transactions.
Additional table information: table: tracking_share_transactions

Answer: SELECT T2.lot_id, AVG(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id ORDER BY AVG(amount_of_transaction) NULLS FIRST


Question:
What are the different cities where people live?
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 are the names of artists that have not had any exhibitions?
Additional table information: table: theme_gallery

Answer: SELECT name FROM artist WHERE NOT artist_id IN (SELECT artist_id FROM exhibition)


Question:
Find the number of medications prescribed for each brand.
Additional table information: table: hospital_1

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


Question:
Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname, COUNT(*), T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID


Question:
How many movies were made before 2000?
Additional table information: table: movie_1

Answer: SELECT COUNT(*) FROM Movie WHERE YEAR < 2000


Question:
For each classroom, report the classroom number and the number of grades using it.
Additional table information: table: student_1

Answer: SELECT classroom, COUNT(DISTINCT grade) FROM list GROUP BY classroom


Question:
Show all majors and corresponding number of students.
Additional table information: table: allergy_1

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


Question:
Which location names contain the word 'film'?
Additional table information: table: cre_Theme_park

Answer: SELECT Location_Name FROM LOCATIONS WHERE Location_Name LIKE '%film%'


Question:
How many rooms in each building have a capacity of over 50?
Additional table information: table: college_2

Answer: SELECT COUNT(*), building FROM classroom WHERE capacity > 50 GROUP BY building


Question:
Return the names and typical buying and selling prices for products that have 'yellow' as their color description.
Additional table information: table: products_gen_characteristics

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


Question:
What are the names of all movies directed by Steven Spielberg?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE director = 'Steven Spielberg'


Question:
List all the subject names.
Additional table information: table: e_learning

Answer: SELECT subject_name FROM SUBJECTS


Question:
What are the distinct address type codes for all customer addresses?
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT DISTINCT address_type_code FROM customer_addresses


Question:
What is the first names of the professors from the history department who do not teach a class.
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num


Question:
Show all the cinema names and opening years in descending order of opening year.
Additional table information: table: cinema

Answer: SELECT name, openning_year FROM cinema ORDER BY openning_year DESC


Question:
What are the names of rooms whose reservation frequency exceeds 60 times?
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING COUNT(*) > 60


Question:
Show different parties of people along with the number of people in each party.
Additional table information: table: debate

Answer: SELECT Party, COUNT(*) FROM people GROUP BY Party


Question:
What are the completion dates of all the tests that have result 'Fail'?
Additional table information: table: e_learning

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


Question:
Which parties have hosts of age above 50? Give me the party locations.
Additional table information: table: party_host

Answer: SELECT T3.Location 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 T2.Age > 50


Question:
List in alphabetic order the names of all distinct instructors.
Additional table information: table: college_2

Answer: SELECT DISTINCT name FROM instructor ORDER BY name NULLS FIRST


Question:
Count the number of regions.
Additional table information: table: party_people

Answer: SELECT COUNT(*) FROM region


Question:
Show the names of members and names of colleges they go to.
Additional table information: table: decoration_competition

Answer: SELECT T2.Name, T1.Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID


Question:
How many students whose are playing the role of goalie?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM tryout WHERE pPos = 'goalie'


Question:
How many institutions do not have an associated protein in our record?
Additional table information: table: protein_institute

Answer: SELECT COUNT(*) FROM institution WHERE NOT institution_id IN (SELECT institution_id FROM protein)


Question:
Find the name of dorms only for female (F gender).
Additional table information: table: dorm_1

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


Question:
What apartment type codes and apartment numbers do the buildings managed by 'Kyle' have?
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = 'Kyle'


Question:
Of all the claims, what was the earliest date when any claim was made?
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS FIRST LIMIT 1


Question:
List the names of all the distinct customers who bought 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:
Who made the latest order?
Additional table information: table: customers_and_addresses

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


Question:
What are the names of regions with two or more storms?
Additional table information: table: storm_record

Answer: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2


Question:
What are the ids of all aircrafts that can cover a distance of more than 1000?
Additional table information: table: flight_1

Answer: SELECT aid FROM Aircraft WHERE distance > 1000


Question:
What is the number of wins the team Boston Red Stockings got in the postseasons each year in history?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*), T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year


Question:
Find the policy types more than 4 customers use. Show their type code.
Additional table information: table: insurance_fnol

Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4


Question:
Show the names of journalists and the names of the events they reported in ascending order
Additional table information: table: news_report

Answer: SELECT T3.Name, T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance ASC NULLS FIRST


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

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


Question:
What are the names of rooms that have either king or queen bed?
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE bedType = 'King' OR bedType = 'Queen'


Question:
Return the names of products that have had complaints filed by the customer who has filed the fewest complaints.
Additional table information: table: customer_complaints

Answer: SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id, customers AS t3 GROUP BY t3.customer_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the total number of domestic passengers at all London airports?
Additional table information: table: aircraft

Answer: SELECT SUM(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE '%London%'


Question:
What are the total amount and average amount paid in claim headers?
Additional table information: table: insurance_and_eClaims

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


Question:
What is the first and last name of the student participating in the most activities?
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which workshop groups have bookings with status code 'stop'? Give me the names.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T2.Store_Name FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID WHERE T1.Status_Code = 'stop'


Question:
What is the average bike availability in stations that are not located in Palo Alto?
Additional table information: table: bike_1

Answer: SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = 'Palo Alto')


Question:
What is the number of cities in the United States with more than 3 airports?
Additional table information: table: flight_4

Answer: SELECT city FROM airports WHERE country = 'United States' GROUP BY city HAVING COUNT(*) > 3


Question:
Find the average age of female students.
Additional table information: table: voter_2

Answer: SELECT AVG(Age) FROM STUDENT WHERE Sex = 'F'


Question:
For each product, show its name and the number of times it was ordered.
Additional table information: table: tracking_orders

Answer: SELECT T3.product_name, COUNT(*) FROM orders AS T1, order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id


Question:
How many settlements does each claim correspond to? List the claim id and the number of settlements.
Additional table information: table: insurance_policies

Answer: SELECT T1.Claim_id, COUNT(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id


Question:
What are the task details, task id and project id for the projects which are detailed as 'omnis' or  have more than 2 outcomes?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.project_id HAVING COUNT(*) > 2


Question:
Which location has the most corresponding counties?
Additional table information: table: county_public_safety

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


Question:
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.
Additional table information: table: election

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


Question:
Show all school names in alphabetical order.
Additional table information: table: school_finance

Answer: SELECT school_name FROM school ORDER BY school_name NULLS FIRST


Question:
Which classrooms are used by grade 4?
Additional table information: table: student_1

Answer: SELECT DISTINCT classroom FROM list WHERE grade = 4


Question:
How many students are enrolled in some classes that are taught by an accounting professor?
Additional table information: table: college_1

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


Question:
Return the different statuses of cities, ascending by frequency.
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC NULLS FIRST


Question:
What are the first names of all professors not teaching any classes?
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num


Question:
Show the ids for all the students who participate in an activity and are under 20.
Additional table information: table: activity_1

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


Question:
What are the first and last names of all students who are living in a dorm with a TV Lounge?
Additional table information: table: dorm_1

Answer: SELECT T1.fname, T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge')


Question:
How many students are there in total?
Additional table information: table: voter_2

Answer: SELECT COUNT(*) FROM STUDENT


Question:
Which city is the address of the store named 'FJA Filming' located in?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = 'FJA Filming'


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

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


Question:
Show the name and description of the role played by the employee named Ebba.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Find the names of the regions which were affected by the storm that killed the greatest number of people.
Additional table information: table: storm_record

Answer: SELECT T2.region_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 ORDER BY T3.Number_Deaths DESC LIMIT 1


Question:
Return the characters and durations for each actor.
Additional table information: table: musical

Answer: SELECT Character, Duration FROM actor


Question:
What are the name and the nationality of the host of the highest age?
Additional table information: table: party_host

Answer: SELECT Name, Nationality FROM HOST ORDER BY Age DESC LIMIT 1


Question:
Show the name of aircraft which fewest people have its certificate.
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the average age of female (sex is F) students?
Additional table information: table: voter_2

Answer: SELECT AVG(Age) FROM STUDENT WHERE Sex = 'F'


Question:
Find the names of either colleges in LA with greater than 15000 size or in state AZ with less than 13000 enrollment.
Additional table information: table: soccer_2

Answer: SELECT cName FROM College WHERE enr < 13000 AND state = 'AZ' UNION SELECT cName FROM College WHERE enr > 15000 AND state = 'LA'


Question:
Find the contact channel code that was used by the customer named 'Tillman Ernser'.
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = 'Tillman Ernser'


Question:
Find the first name of students who are living in the Smith Hall.
Additional table information: table: dorm_1

Answer: SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'


Question:
Show the phone, room, and building for the faculty named Jerry Prince.
Additional table information: table: activity_1

Answer: SELECT phone, room, building FROM Faculty WHERE Fname = 'Jerry' AND Lname = 'Prince'


Question:
Find the number of students in total.
Additional table information: table: voter_2

Answer: SELECT COUNT(*) FROM STUDENT


Question:
What is highest rating for the most recent movie and when was it released?
Additional table information: table: movie_1

Answer: SELECT MAX(T1.stars), T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MAX(YEAR) FROM Movie)


Question:
Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.
Additional table information: table: workshop_paper

Answer: SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80


Question:
Find the id of users who are followed by Mary or Susan.
Additional table information: table: twitter_1

Answer: SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = 'Mary' OR T1.name = 'Susan'


Question:
Return the name and gender of the staff who was 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:
Show the name and service for all trains in order by time.
Additional table information: table: train_station

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


Question:
What are the different positions of players from UCLA or Duke colleges?
Additional table information: table: match_season

Answer: SELECT DISTINCT POSITION FROM match_season WHERE College = 'UCLA' OR College = 'Duke'


Question:
What are the reigns and days held of all wrestlers?
Additional table information: table: wrestler

Answer: SELECT Reign, Days_held FROM wrestler


Question:
return all columns of the albums created in the year of 2012.
Additional table information: table: music_2

Answer: SELECT * FROM Albums WHERE YEAR = 2012


Question:
What is the shortest and most poorly rated song for each genre, ordered alphabetically by genre?
Additional table information: table: music_1

Answer: SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is NULLS FIRST


Question:
Show the names for all females from Canada having a wedding in year 2016.
Additional table information: table: wedding

Answer: SELECT T2.name FROM wedding AS T1 JOIN people AS T2 ON T1.female_id = T2.people_id WHERE T1.year = 2016 AND T2.is_male = 'F' AND T2.country = 'Canada'


Question:
What document status codes do we have?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_status_code FROM Ref_Document_Status


Question:
What are the average, maximum and total revenues of all companies?
Additional table information: table: manufactory_1

Answer: SELECT AVG(revenue), MAX(revenue), SUM(revenue) FROM manufacturers


Question:
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?
Additional table information: table: small_bank_1

Answer: SELECT T1.name, T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance


Question:
Tell me the first and last name of the student who has the most activities.
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many songs have 4 minute duration?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM files WHERE duration LIKE '4:%'


Question:
Which film actor (actress) starred the most films? List his or her first name, last name and actor id.
Additional table information: table: sakila_1

Answer: SELECT T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all the distinct institution types.
Additional table information: table: protein_institute

Answer: SELECT DISTINCT TYPE FROM institution


Question:
Find the names of the artists who have produced English songs but have never received rating higher than 8.
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM song WHERE languages = 'english' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8


Question:
What are the types and countries of competitions?
Additional table information: table: sports_competition

Answer: SELECT Competition_type, Country FROM competition


Question:
How many professors are in the accounting dept?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = 'Accounting'


Question:
What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956?
Additional table information: table: csu_1

Answer: SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND FTE_AY > 200


Question:
Find the average number of bedrooms of all the apartments.
Additional table information: table: apartment_rentals

Answer: SELECT AVG(bedroom_count) FROM Apartments


Question:
What are the names and scores of wines that are made of white color grapes?
Additional table information: table: wine_1

Answer: SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White'


Question:
How many different songs have shared vocals?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = 'shared'


Question:
Find the id of the appointment with the most recent start date?
Additional table information: table: hospital_1

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


Question:
Give me a list of descriptions of the problems that are reported by the staff whose first name is Christop.
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_description FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Christop'


Question:
What are the unit of measure and category code for the 'chervil' product?
Additional table information: table: products_gen_characteristics

Answer: SELECT t2.unit_of_measure, t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = 'chervil'


Question:
Find the document type name of the document named 'How to read a book'.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Which colleges do the tryout players whose name starts with letter D go to?
Additional table information: table: soccer_2

Answer: SELECT T1.cName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T2.pName LIKE 'D%'


Question:
Order denominations in descending order of the count of schools with the denomination. Return each denomination with the count of schools.
Additional table information: table: school_player

Answer: SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC


Question:
find the names of programs whose origin is not in Beijing.
Additional table information: table: program_share

Answer: SELECT name FROM program WHERE origin <> 'Beijing'


Question:
What are the names of entrepreneurs whose investor is not 'Rachel Elnaugh'?
Additional table information: table: entrepreneur

Answer: SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor <> 'Rachel Elnaugh'


Question:
Which customer made the largest amount of claim in a single claim? Return the customer details.
Additional table information: table: insurance_and_eClaims

Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) FROM claim_headers)


Question:
find the number of medicines offered by each trade.
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT trade_name, COUNT(*) FROM medicine GROUP BY trade_name


Question:
Find the customer name and date of the orders that have the status 'Delivered'.
Additional table information: table: customers_and_addresses

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


Question:
Find the id of routes whose source and destination airports are in the United States.
Additional table information: table: flight_4

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


Question:
Find the last name of the staff member who processed the complaint of the cheapest product.
Additional table information: table: customer_complaints

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


Question:
What are the names and location of the shops in ascending alphabetical order of name.
Additional table information: table: device

Answer: SELECT Shop_Name, LOCATION FROM shop ORDER BY Shop_Name ASC NULLS FIRST


Question:
For the oldest movie listed, what is its average rating and title?
Additional table information: table: movie_1

Answer: SELECT AVG(T1.stars), T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MIN(YEAR) FROM Movie)


Question:
Find the policy type used by more than 4 customers.
Additional table information: table: insurance_fnol

Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4


Question:
Show details of all investors if they make any transaction with share count greater than 100.
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.share_count > 100


Question:
What are the names of all customers, ordered by account balance?
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer ORDER BY acc_bal NULLS FIRST


Question:
Give me the name and description of the document type code RV.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
What is the document type name and the document type description and creation date for all the documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_type_name, T1.document_type_description, T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code


Question:
What are the address and phone number of the buildings managed by 'Brenden'?
Additional table information: table: apartment_rentals

Answer: SELECT building_address, building_phone FROM Apartment_Buildings WHERE building_manager = 'Brenden'


Question:
List all location codes and location names.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_code, location_name FROM Ref_locations


Question:
What are all the the participant ids, type code and details?
Additional table information: table: local_govt_in_alabama

Answer: SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants


Question:
What are the first, middle, and last names of all staff?
Additional table information: table: driving_school

Answer: SELECT first_name, middle_name, last_name FROM Staff


Question:
What are the different album labels listed?
Additional table information: table: music_2

Answer: SELECT DISTINCT label FROM Albums


Question:
What are the names and descriptions of the photos taken at the tourist attraction 'film festival'?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name, T1.Description FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = 'film festival'


Question:
What is the first and last name of the student who played the most sports?
Additional table information: table: game_1

Answer: SELECT T2.Fname, T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the title, credit value, and department name for courses with more than one prerequisite?
Additional table information: table: college_2

Answer: SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) > 1