Question:
Show all artist names who didn't have an exhibition in 2004.
Additional table information: table: theme_gallery

Answer: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004


Question:
List the distinct carriers of phones with memories bigger than 32.
Additional table information: table: phone_market

Answer: SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32


Question:
Find the employee id for all employees who earn more than the average salary.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)


Question:
Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate.
Additional table information: table: candidate_poll

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


Question:
What is the minimum, maximum, and average market value for every company?
Additional table information: table: gas_company

Answer: SELECT MIN(market_value), MAX(market_value), AVG(market_value) FROM company


Question:
What is the incident type description for the incident type with code 'VIOLENCE'?
Additional table information: table: behavior_monitoring

Answer: SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = 'VIOLENCE'


Question:
How many scientists are there?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists


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

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


Question:
Find the names of stadiums that some Australian swimmers have been to.
Additional table information: table: swimming

Answer: SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id = t3.id JOIN stadium AS t4 ON t4.id = t3.stadium_id WHERE t1.nationality = 'Australia'


Question:
Find the maximum and minimum settlement amount.
Additional table information: table: insurance_fnol

Answer: SELECT MAX(settlement_amount), MIN(settlement_amount) FROM settlements


Question:
display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’.
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')


Question:
What are the carriers of devices that are in stock in more than a single shop?
Additional table information: table: device

Answer: SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID HAVING COUNT(*) > 1


Question:
what is the phone number of employees whose salary is in the range of 8000 and 12000?
Additional table information: table: hr_1

Answer: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000


Question:
Find the distinct names of all races held between 2014 and 2017?
Additional table information: table: formula_1

Answer: SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017


Question:
What is the name and salary of all employees in order of salary?
Additional table information: table: flight_1

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


Question:
Count the number of members in club 'Bootup Baltimore' whose age is above 18.
Additional table information: table: club_1

Answer: SELECT COUNT(*) 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.age > 18


Question:
What are the names of counties that do not contain any cities?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety WHERE NOT County_ID IN (SELECT County_ID FROM city)


Question:
What ranks do we have for faculty?
Additional table information: table: activity_1

Answer: SELECT DISTINCT rank FROM Faculty


Question:
Show the delegate and committee information of elections.
Additional table information: table: election

Answer: SELECT Delegate, Committee FROM election


Question:
What are the titles of courses that are offered in more than one department?
Additional table information: table: college_2

Answer: SELECT title FROM course GROUP BY title HAVING COUNT(*) > 1


Question:
What are the names of the employees who authorised the destruction and the employees who destroyed the corresponding documents?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T2.employee_name, T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id


Question:
Please show different types of artworks with the corresponding number of artworks of each type.
Additional table information: table: entertainment_awards

Answer: SELECT TYPE, COUNT(*) FROM artwork GROUP BY TYPE


Question:
Count the number of cards the customer with the first name Art and last name Turcotte 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 = 'Art' AND T2.customer_last_name = 'Turcotte'


Question:
What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department?
Additional table information: table: college_1

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


Question:
Show the number of male and female assistant professors.
Additional table information: table: activity_1

Answer: SELECT sex, COUNT(*) FROM Faculty WHERE rank = 'AsstProf' GROUP BY sex


Question:
what are the employee ids and job titles for employees in department 80?
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80


Question:
Give me a list of names and years of races that had any driver whose forename is 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:
display the department name and number of employees in each of the department.
Additional table information: table: hr_1

Answer: SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name


Question:
Give me the average prices of wines that are produced by appelations in Sonoma County.
Additional table information: table: wine_1

Answer: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma'


Question:
Find each student's first name.
Additional table information: table: club_1

Answer: SELECT DISTINCT fname FROM student


Question:
What are the names of all movies made before 1980 or had James Cameron as the director?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE director = 'James Cameron' OR YEAR < 1980


Question:
Find the number of classes in each department.
Additional table information: table: college_1

Answer: SELECT COUNT(*), dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code


Question:
What are the different fates of the mission that involved ships from the United States?
Additional table information: table: ship_mission

Answer: SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = 'United States'


Question:
What are each physician's employee id and department id primarily affiliated.
Additional table information: table: hospital_1

Answer: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1


Question:
Show the case burden of counties in descending order of population.
Additional table information: table: county_public_safety

Answer: SELECT Case_burden FROM county_public_safety ORDER BY Population DESC


Question:
What is the average number of points for players from the 'AIB' club?
Additional table information: table: sports_competition

Answer: SELECT AVG(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = 'AIB'


Question:
Count the number of products with the 'hot' charactersitic.
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = 'hot'


Question:
What is the attribute data type of the attribute with name 'Green'?
Additional table information: table: product_catalog

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


Question:
Show names of technicians who are assigned to repair machines with value point more than 70.
Additional table information: table: machine_repair

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


Question:
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?
Additional table information: table: department_management

Answer: SELECT T1.name, T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'


Question:
Count the number of different film ratings.
Additional table information: table: sakila_1

Answer: SELECT COUNT(DISTINCT rating) FROM film


Question:
How many songs have vocals of type lead?
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 = 'lead'


Question:
How many products have a price higher than the average?
Additional table information: table: customers_and_products_contacts

Answer: SELECT COUNT(*) FROM products WHERE product_price > (SELECT AVG(product_price) FROM products)


Question:
List the method, date and amount of all the payments, in ascending order of date.
Additional table information: table: insurance_policies

Answer: SELECT Payment_Method_Code, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS FIRST


Question:
What is the name of department where has the largest number of professors with a Ph.D. degree?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show aircraft names and number of flights for each aircraft.
Additional table information: table: flight_1

Answer: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid


Question:
List all the distinct president votes and the vice president votes.
Additional table information: table: voter_2

Answer: SELECT DISTINCT President_Vote, VICE_President_Vote FROM VOTING_RECORD


Question:
What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.
Additional table information: table: allergy_1

Answer: SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = 'Lisa' ORDER BY T1.Allergy NULLS FIRST


Question:
Find the number of routes for each source airport and the airport name.
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:
what are the last names of the teachers who teach grade 5?
Additional table information: table: student_1

Answer: SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5


Question:
Find all the policy types that are used by more than 2 customers.
Additional table information: table: insurance_and_eClaims

Answer: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING COUNT(*) > 2


Question:
What is the number of airports per country, ordered from most to least?
Additional table information: table: flight_4

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


Question:
Which part fault requires the most number of skills to fix? List part id and name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.part_id, T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of documents that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)


Question:
What is the transaction type that has processed the greatest total amount in transactions?
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1


Question:
What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students?
Additional table information: table: college_2

Answer: SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100


Question:
How many journalists are there?
Additional table information: table: news_report

Answer: SELECT COUNT(*) FROM journalist


Question:
What is the name and distance for aircraft with id 12?
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft WHERE aid = 12


Question:
Find the number of distinct projects.
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT name) FROM projects


Question:
What are the names of the different banks that have provided loans?
Additional table information: table: loan_1

Answer: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id


Question:
What are the ids of the courses that are registered or attended by the student whose id is 121?
Additional table information: table: student_assessment

Answer: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121


Question:
What are the distinct move in dates of the residents?
Additional table information: table: local_govt_and_lot

Answer: SELECT DISTINCT date_moved_in FROM residents


Question:
Report the first name and last name of all the teachers.
Additional table information: table: student_1

Answer: SELECT DISTINCT firstname, lastname FROM teachers


Question:
What is the average age of all artists?
Additional table information: table: music_4

Answer: SELECT AVG(Age) FROM artist


Question:
What are the lifespans of representatives in descending order of vote percent?
Additional table information: table: election_representative

Answer: SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC


Question:
Show card number, name, and hometown for all members in a descending order of level.
Additional table information: table: shop_membership

Answer: SELECT card_number, name, hometown FROM member ORDER BY LEVEL DESC


Question:
What is the status of the city that has hosted the most competitions?
Additional table information: table: farm

Answer: SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number of students taught by TARRING LEIA.
Additional table information: table: student_1

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


Question:
Show project ids and the number of documents in each project.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id


Question:
What is the last name of the musician that have produced the most songs?
Additional table information: table: music_2

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


Question:
How many stadiums are there?
Additional table information: table: swimming

Answer: SELECT COUNT(*) FROM stadium


Question:
Which apartments have unit status availability of both 0 and 1? Return their apartment numbers.
Additional table information: table: apartment_rentals

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


Question:
List all the log ids and their descriptions from the problem logs.
Additional table information: table: tracking_software_problems

Answer: SELECT problem_log_id, log_entry_description FROM problem_log


Question:
Count the number of party events.
Additional table information: table: party_people

Answer: SELECT COUNT(*) FROM party_events


Question:
Find the author who achieved the highest score in a submission.
Additional table information: table: workshop_paper

Answer: SELECT Author FROM submission ORDER BY Scores DESC LIMIT 1


Question:
What are the name and code of the location with the smallest number of documents?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T2.location_name, T1.location_code FROM Document_locations AS T1 JOIN Ref_locations AS T2 ON T1.location_code = T2.location_code GROUP BY T1.location_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
How many schools are there?
Additional table information: table: school_finance

Answer: SELECT COUNT(*) FROM school


Question:
Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop.
Additional table information: table: workshop_paper

Answer: SELECT Date, Venue FROM workshop ORDER BY Venue NULLS FIRST


Question:
What are the nations that have more than two ships?
Additional table information: table: ship_mission

Answer: SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2


Question:
What are the usernames and passwords of users that have the most common role?
Additional table information: table: document_management

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


Question:
List the locations of schools in ascending order of enrollment.
Additional table information: table: school_player

Answer: SELECT LOCATION FROM school ORDER BY Enrollment ASC NULLS FIRST


Question:
Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64.
Additional table information: table: phone_market

Answer: SELECT Carrier FROM phone WHERE Memory_in_G < 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G > 64


Question:
Find all the stores in the district with the most population.
Additional table information: table: store_product

Answer: SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id WHERE district_id = (SELECT district_id FROM district ORDER BY city_population DESC LIMIT 1)


Question:
Show the name, average attendance, total attendance for stadiums where no accidents happened.
Additional table information: table: game_injury

Answer: SELECT name, average_attendance, total_attendance FROM stadium EXCEPT SELECT T2.name, T2.average_attendance, T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id


Question:
What are the names of all races that occurred after 12:00:00 or before 09:00:00?
Additional table information: table: formula_1

Answer: SELECT name FROM races WHERE TIME > '12:00:00' OR TIME < '09:00:00'


Question:
How many albums are there?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM


Question:
What are the distinct nominees of the musicals with the award that is not 'Tony Award'?
Additional table information: table: musical

Answer: SELECT DISTINCT Nominee FROM musical WHERE Award <> 'Tony Award'


Question:
Find the id and first name of the student that has the most number of assessment notes?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.student_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids of all students who don't play sports?
Additional table information: table: game_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo


Question:
Find the list of page size which have more than 3 product listed
Additional table information: table: store_product

Answer: SELECT max_page_size FROM product GROUP BY max_page_size HAVING COUNT(*) > 3


Question:
Return the names of people, ordered alphabetically.
Additional table information: table: gymnast

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


Question:
What are the countries for each market ordered by decreasing number of cities?
Additional table information: table: film_rank

Answer: SELECT Country FROM market ORDER BY Number_cities DESC


Question:
Find the entry names of the catalog with the attribute that have the most entries.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY COUNT(*) DESC LIMIT 1)


Question:
Which reign is the most common among wrestlers?
Additional table information: table: wrestler

Answer: SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the product name and total order quantity for each product.
Additional table information: table: customers_and_products_contacts

Answer: SELECT T1.product_name, SUM(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id


Question:
How many distinct students have been in detention?
Additional table information: table: behavior_monitoring

Answer: SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention


Question:
What are the full names and ages for all female students whose sex is F?
Additional table information: table: allergy_1

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


Question:
Which building does the instructor who teaches the most number of courses live in?
Additional table information: table: college_3

Answer: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the information of all instructors ordered by their salary in ascending order.
Additional table information: table: college_2

Answer: SELECT * FROM instructor ORDER BY salary NULLS FIRST


Question:
Find the names of schools that have some players in the mid position but not in the goalie position.
Additional table information: table: soccer_2

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


Question:
Show the transaction type descriptions and dates if the share count is smaller than 10.
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.transaction_type_description, T2.date_of_transaction FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10


Question:
Find the number of different product types.
Additional table information: table: department_store

Answer: SELECT COUNT(DISTINCT product_type_code) FROM products


Question:
What are the total amount of money in the invoices billed from Chicago, Illinois?
Additional table information: table: store_1

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


Question:
What are the ids of documents with the type code CV that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
What are the names of candidates who have a lower support rate than oppose rate?
Additional table information: table: candidate_poll

Answer: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate


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

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


Question:
List the names of aircrafts and that did not win any match.
Additional table information: table: aircraft

Answer: SELECT Aircraft FROM aircraft WHERE NOT Aircraft_ID IN (SELECT Winning_Aircraft FROM MATCH)


Question:
What is the names of movies whose created year is after all movies directed by Steven Spielberg?
Additional table information: table: movie_1

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


Question:
How many trains have 'Express' in their names?
Additional table information: table: station_weather

Answer: SELECT COUNT(*) FROM train WHERE name LIKE '%Express%'


Question:
Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.
Additional table information: table: small_bank_1

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


Question:
How many wines are there for each grape?
Additional table information: table: wine_1

Answer: SELECT COUNT(*), Grape FROM WINE GROUP BY Grape


Question:
Find the schools that were either founded after 1850 or public.
Additional table information: table: university_basketball

Answer: SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public'


Question:
What are the names of colleges that have two or more players, listed in descending alphabetical order?
Additional table information: table: match_season

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


Question:
How many states that have some college students playing in the mid position but not in the goalie position.
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie')


Question:
Find the student first and last names and grade points of all enrollments.
Additional table information: table: college_3

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


Question:
How many products are not made by Sony?
Additional table information: table: manufactory_1

Answer: SELECT COUNT(DISTINCT name) FROM products WHERE NOT name IN (SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Sony')


Question:
Who are the nominees who were nominated for either of the Bob Fosse or Cleavant Derricks awards?
Additional table information: table: musical

Answer: SELECT Nominee FROM musical WHERE Award = 'Tony Award' OR Award = 'Cleavant Derricks'


Question:
What is the first name of the author with last name 'Ueno'?
Additional table information: table: icfp_1

Answer: SELECT fname FROM authors WHERE lname = 'Ueno'


Question:
What are the ages of the gymnasts, ordered descending by their total points?
Additional table information: table: gymnast

Answer: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC


Question:
Which city has the least number of customers whose type code is 'Good Credit Rating'?
Additional table information: table: customer_complaints

Answer: SELECT town_city FROM customers WHERE customer_type_code = 'Good Credit Rating' GROUP BY town_city ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Find out the first name and last name of staff lived in city Damianfort.
Additional table information: table: driving_school

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


Question:
Show the name of storms which don't have affected region in record.
Additional table information: table: storm_record

Answer: SELECT name FROM storm WHERE NOT storm_id IN (SELECT storm_id FROM affected_region)


Question:
List the name and count of each product in all orders.
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:
List all the distinct product names ordered by product id?
Additional table information: table: tracking_software_problems

Answer: SELECT DISTINCT product_name FROM product ORDER BY product_id NULLS FIRST


Question:
Which party had the most hosts? Give me the party location.
Additional table information: table: party_host

Answer: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1


Question:
Show the customer name, customer address city, date from, and date to for each customer address history.
Additional table information: table: customers_and_products_contacts

Answer: SELECT T2.customer_name, T3.city, T1.date_from, T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id


Question:
Compute the average age of the members in the club 'Tennis Club'.
Additional table information: table: club_1

Answer: SELECT AVG(t3.age) 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 = 'Tennis Club'


Question:
Show the location name for document 'Robin CV'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T3.location_name FROM All_documents AS T1 JOIN Document_locations AS T2 ON T1.document_id = T2.document_id JOIN Ref_locations AS T3 ON T2.location_code = T3.location_code WHERE T1.document_name = 'Robin CV'


Question:
List the most common type of competition.
Additional table information: table: sports_competition

Answer: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all teams?
Additional table information: table: match_season

Answer: SELECT Name FROM Team


Question:
which countries did participated in both Friendly and Tournament type competitions.
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'


Question:
What are the names of body builders in descending order of total scores?
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 ORDER BY T1.Total DESC


Question:
Show all date and share count of transactions.
Additional table information: table: tracking_share_transactions

Answer: SELECT date_of_transaction, share_count FROM TRANSACTIONS


Question:
Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.
Additional table information: table: culture_company

Answer: SELECT AVG(budget_million), MAX(budget_million), MIN(budget_million) FROM movie WHERE YEAR < 2000


Question:
How many rooms have a king bed?
Additional table information: table: inn_1

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


Question:
Find all invoice dates corresponding to customers with first name Astrid and last name Gruber.
Additional table information: table: chinook_1

Answer: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'


Question:
Return all detention summaries.
Additional table information: table: behavior_monitoring

Answer: SELECT detention_summary FROM Detention


Question:
Who has friends that are younger than the average age?
Additional table information: table: network_2

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


Question:
What is the address of the location 'UK Gallery'?
Additional table information: table: cre_Theme_park

Answer: SELECT Address FROM LOCATIONS WHERE Location_Name = 'UK Gallery'


Question:
How many gold medals has the club with the most coaches won?
Additional table information: table: riding_club

Answer: SELECT T1.club_id, T1.gold FROM match_result AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of players whose card is yes in the descending order of training hours.
Additional table information: table: soccer_2

Answer: SELECT pName FROM Player WHERE yCard = 'yes' ORDER BY HS DESC


Question:
How many artists are from Bangladesh?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM artist WHERE country = 'Bangladesh'


Question:
How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n
Additional table information: table: local_govt_mdm

Answer: SELECT T2.cmi_cross_ref_id, T2.master_customer_id, COUNT(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id


Question:
What are the names of races held between 2009 and 2011?
Additional table information: table: formula_1

Answer: SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011


Question:
Find the name of the swimmer who has at least 2 records.
Additional table information: table: swimming

Answer: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id HAVING COUNT(*) >= 2


Question:
How many lessons were in cancelled state?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons WHERE lesson_status_code = 'Cancelled'


Question:
How many accounts are there in total?
Additional table information: table: small_bank_1

Answer: SELECT COUNT(*) FROM accounts


Question:
How many colors are never used by any product?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM Ref_colors WHERE NOT color_code IN (SELECT color_code FROM products)


Question:
Show different nationalities along with the number of hosts of each nationality.
Additional table information: table: party_host

Answer: SELECT Nationality, COUNT(*) FROM HOST GROUP BY Nationality


Question:
Find the number of students who are older than 18 and do not have allergy to either food or animal.
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 distinct cities of address of students?
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 JOIN students AS T3 ON T2.person_id = T3.student_id


Question:
When was the first asset acquired?
Additional table information: table: assets_maintenance

Answer: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC NULLS FIRST LIMIT 1


Question:
List the names of the browser that are compatible with both 'CACHEbox' and 'Fasterfox'.
Additional table information: table: browser_web

Answer: SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'CACHEbox' INTERSECT SELECT T3.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T1.name = 'Fasterfox'


Question:
Display all the information about the department Marketing.
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
What are all the different start station names for a trip that lasted less than 100?
Additional table information: table: bike_1

Answer: SELECT DISTINCT start_station_name FROM trip WHERE duration < 100


Question:
Count the number of budgets in year 2001 or before whose budgeted amount is greater than 3000
Additional table information: table: school_finance

Answer: SELECT COUNT(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001


Question:
Return the titles and directors of films that were never in the market of China.
Additional table information: table: film_rank

Answer: SELECT title, director FROM film WHERE NOT film_id IN (SELECT film_id FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.Market_ID WHERE country = 'China')


Question:
the names of models that launched between 2002 and 2004.
Additional table information: table: phone_1

Answer: SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004


Question:
How many games are held after season 2007?
Additional table information: table: game_injury

Answer: SELECT COUNT(*) FROM game WHERE season > 2007


Question:
Which students not enrolled in any course? Find their personal names.
Additional table information: table: e_learning

Answer: SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id


Question:
How many products are in the 'Spices' category and have a typical price of over 1000?
Additional table information: table: products_gen_characteristics

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


Question:
What are the ids of the students who registered for some courses but had the least number of courses for all students?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Show headquarters with at least two companies in the banking industry.
Additional table information: table: gas_company

Answer: SELECT headquarters FROM company WHERE main_industry = 'Banking' GROUP BY headquarters HAVING COUNT(*) >= 2


Question:
What is the average and total capacity for all dorms who are of gender X?
Additional table information: table: dorm_1

Answer: SELECT AVG(student_capacity), SUM(student_capacity) FROM dorm WHERE gender = 'X'


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

Answer: SELECT COUNT(*) FROM Customers


Question:
Show all flight number from Los Angeles.
Additional table information: table: flight_1

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


Question:
Which events have the number of notes between one and three? List the event id and the property id.
Additional table information: table: local_govt_and_lot

Answer: SELECT T1.Customer_Event_ID, T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID = T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING COUNT(*) BETWEEN 1 AND 3


Question:
Give the ids and names of products with price lower than 600 or higher than 900.
Additional table information: table: department_store

Answer: SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900


Question:
Who is the director of movie Avatar?
Additional table information: table: movie_1

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


Question:
How many courses does the department of Computer Information Systmes offer?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM department AS T1 JOIN course AS T2 ON T1.dept_code = T2.dept_code WHERE dept_name = 'Computer Info. Systems'


Question:
List all names of courses with 1 credit?
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE WHERE Credits = 1


Question:
Which company was started by the entrepreneur with the greatest height?
Additional table information: table: entrepreneur

Answer: SELECT T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Height DESC LIMIT 1


Question:
Return the description for the courses named 'database'.
Additional table information: table: e_learning

Answer: SELECT course_description FROM COURSES WHERE course_name = 'database'


Question:
Show the distinct names of mountains climbed by climbers from country 'West Germany'.
Additional table information: table: climbing

Answer: SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = 'West Germany'


Question:
Show the names of journalists from 'England' or 'Wales'.
Additional table information: table: news_report

Answer: SELECT Name FROM journalist WHERE Nationality = 'England' OR Nationality = 'Wales'


Question:
Show all allergy types and the number of allergies in each type.
Additional table information: table: allergy_1

Answer: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype


Question:
Find the entry name of the catalog with the highest price (in USD).
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1


Question:
Show the flight number and distance of the flight with maximum price.
Additional table information: table: flight_1

Answer: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1


Question:
What are all locations of train stations?
Additional table information: table: train_station

Answer: SELECT DISTINCT LOCATION FROM station


Question:
What are the date of ceremony of music festivals with category 'Best Song' and result 'Awarded'?
Additional table information: table: music_4

Answer: SELECT Date_of_ceremony FROM music_festival WHERE Category = 'Best Song' AND RESULT = 'Awarded'


Question:
What is the average ROM size of phones produced by the company named 'Nokia Corporation'?
Additional table information: table: phone_1

Answer: SELECT AVG(T1.ROM_MiB) FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = 'Nokia Corporation'


Question:
What are the invoice numbers created before 1989-09-03 or after 2007-12-25?
Additional table information: table: tracking_orders

Answer: SELECT invoice_number FROM invoices WHERE invoice_date < '1989-09-03' OR invoice_date > '2007-12-25'


Question:
Show the draft pick numbers and draft classes of players whose positions are defenders.
Additional table information: table: match_season

Answer: SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE POSITION = 'Defender'


Question:
How many editors are there?
Additional table information: table: journal_committee

Answer: SELECT COUNT(*) FROM editor


Question:
In how many cities are there airports in the country of Greenland?
Additional table information: table: flight_4

Answer: SELECT COUNT(DISTINCT city) FROM airports WHERE country = 'Greenland'


Question:
What are the names of races held after 12:00:00 or before 09:00:00?
Additional table information: table: formula_1

Answer: SELECT name FROM races WHERE TIME > '12:00:00' OR TIME < '09:00:00'


Question:
List the date of perpetrators in descending order of the number of people killed.
Additional table information: table: perpetrator

Answer: SELECT Date FROM perpetrator ORDER BY Killed DESC


Question:
Count the number of distinct artists who have volumes.
Additional table information: table: music_4

Answer: SELECT COUNT(DISTINCT Artist_ID) FROM volume


Question:
What is the list of program origins ordered alphabetically?
Additional table information: table: program_share

Answer: SELECT origin FROM program ORDER BY origin NULLS FIRST


Question:
Find the name and nationality of the swimmer who has won (i.e., has a result of 'win') more than 1 time.
Additional table information: table: swimming

Answer: SELECT t1.name, t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' GROUP BY t2.swimmer_id HAVING COUNT(*) > 1


Question:
Which room has the largest number of reservations?
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 ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the department and office location for the professor with the last name of Heffington?
Additional table information: table: college_1

Answer: SELECT T3.dept_name, T2.prof_office 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 T1.emp_lname = 'Heffington'


Question:
Find the number of users who posted some tweets.
Additional table information: table: twitter_1

Answer: SELECT COUNT(DISTINCT UID) FROM tweets


Question:
Find the name of the students and their department names sorted by their total credits in ascending order.
Additional table information: table: college_2

Answer: SELECT name, dept_name FROM student ORDER BY tot_cred NULLS FIRST


Question:
Which police forces operate in both counties that are located in the East and in the West?
Additional table information: table: county_public_safety

Answer: SELECT Police_force FROM county_public_safety WHERE LOCATION = 'East' INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = 'West'


Question:
Find the full names of employees living in the city of Calgary.
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM EMPLOYEE WHERE City = 'Calgary'


Question:
Which 3 wineries produce the most wines made from white grapes?
Additional table information: table: wine_1

Answer: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE = T2.GRAPE WHERE T1.Color = 'White' GROUP BY T2.Winery ORDER BY COUNT(*) DESC LIMIT 3


Question:
Return all the distinct payment methods used by customers.
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT payment_method FROM customers


Question:
Find the state, account type, and credit score of the customer whose number of loan is 0.
Additional table information: table: loan_1

Answer: SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0


Question:
What is the gender and name of the artist who sang the song with the smallest resolution?
Additional table information: table: music_1

Answer: SELECT T1.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution NULLS FIRST LIMIT 1


Question:
Show the id of the employee named Ebba.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Count the total number of clubs.
Additional table information: table: club_1

Answer: SELECT COUNT(*) FROM club


Question:
What is the name and date of the race that occurred most recently?
Additional table information: table: formula_1

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


Question:
When was the school with the largest enrollment founded?
Additional table information: table: university_basketball

Answer: SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1


Question:
Find names of the document without any images.
Additional table information: table: document_management

Answer: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id


Question:
What are the names of enzymes in descending order?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name FROM enzyme ORDER BY name DESC


Question:
What are the distinct names and nationalities of the architects who have ever built a mill?
Additional table information: table: architecture

Answer: SELECT DISTINCT T1.name, T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id


Question:
Give the distinct department ids of departments in which a manager is in charge of 4 or more employees?
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
Find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841?
Additional table information: table: formula_1

Answer: SELECT DISTINCT driverid, STOP FROM pitstops WHERE duration > (SELECT MIN(duration) FROM pitstops WHERE raceid = 841)


Question:
What are the ids of all stations that have a latitude above 37.4 and have never had less than 7 bikes available?
Additional table information: table: bike_1

Answer: SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7


Question:
List the names of the schools without any endowment.
Additional table information: table: school_finance

Answer: SELECT school_name FROM school WHERE NOT school_id IN (SELECT school_id FROM endowment)


Question:
Show all book categories and the number of books in each category.
Additional table information: table: culture_company

Answer: SELECT category, COUNT(*) FROM book_club GROUP BY category


Question:
What are the names of all the dorms that don't have any amenities?
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm WHERE NOT dormid IN (SELECT dormid FROM has_amenity)


Question:
find the number of players whose points are lower than 30 in each position.
Additional table information: table: sports_competition

Answer: SELECT COUNT(*), POSITION FROM player WHERE points < 30 GROUP BY POSITION


Question:
What is the name of the perpetrator with the biggest weight.
Additional table information: table: perpetrator

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


Question:
Which flag is most widely used among all ships?
Additional table information: table: ship_1

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


Question:
Which organisation type hires most research staff?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.organisation_type FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_type ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many calendar items do we have?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM Ref_calendar


Question:
How many captains are in each rank?
Additional table information: table: ship_1

Answer: SELECT COUNT(*), rank FROM captain GROUP BY rank


Question:
list in alphabetic order all course names and their instructors' names in year 2008.
Additional table information: table: college_2

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


Question:
List all the activities we have.
Additional table information: table: activity_1

Answer: SELECT activity_name FROM Activity


Question:
What is the id and name of the enzyme that can interact with the most medicines as an activator?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.id, T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the different names and ages of every friend of either 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:
Sort all the rooms according to the price. Just report the room names.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY basePrice NULLS FIRST


Question:
Find the the customer details and id for the customers who had more than one policy.
Additional table information: table: insurance_policies

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


Question:
What is the number of artists for each gender?
Additional table information: table: music_1

Answer: SELECT COUNT(*), gender FROM artist GROUP BY gender


Question:
Return the hispanic percentage for cities in which the black percentage is greater than 10.
Additional table information: table: county_public_safety

Answer: SELECT Hispanic FROM city WHERE Black > 10


Question:
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
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.job_title_code = 'Sales Person' EXCEPT 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.job_title_code = 'Clerical Staff'


Question:
What are the codes and names of the cheapest products in each category?
Additional table information: table: manufactory_1

Answer: SELECT code, name, MIN(price) FROM products GROUP BY name


Question:
List the number of invoices and the invoice total from California.
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*), SUM(total) FROM invoices WHERE billing_state = 'CA'


Question:
Find the tourist attractions that have parking or shopping as their feature details. What are the names of the attractions?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'park' UNION SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'shopping'


Question:
What are the countries for each market, ordered alphabetically?
Additional table information: table: film_rank

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


Question:
Return the average and minimum ages across artists from the United States.
Additional table information: table: theme_gallery

Answer: SELECT AVG(age), MIN(age) FROM artist WHERE country = 'United States'


Question:
What are the distinct last names of the students who have president votes and have 8741 as the advisor?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = '8741'


Question:
List the first and last name for players who participated in all star game in 1998.
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998


Question:
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name 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:
How many stadiums are not in country 'Russia'?
Additional table information: table: swimming

Answer: SELECT COUNT(*) FROM stadium WHERE country <> 'Russia'


Question:
How many players are from each country?
Additional table information: table: match_season

Answer: SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name


Question:
Find the number of followers for each user.
Additional table information: table: twitter_1

Answer: SELECT COUNT(*) FROM follows GROUP BY f1


Question:
Show the country where people older than 30 and younger than 25 are from.
Additional table information: table: wedding

Answer: SELECT country FROM people WHERE age < 25 INTERSECT SELECT country FROM people WHERE age > 30


Question:
Select the code of the product that is cheapest in each product category.
Additional table information: table: manufactory_1

Answer: SELECT code, name, MIN(price) FROM products GROUP BY name


Question:
List the names of representatives that have not participated in elections listed here.
Additional table information: table: election_representative

Answer: SELECT Name FROM representative WHERE NOT Representative_ID IN (SELECT Representative_ID FROM election)


Question:
List every album's title.
Additional table information: table: store_1

Answer: SELECT title FROM albums


Question:
Find the name of the stadium that has the maximum capacity.
Additional table information: table: swimming

Answer: SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1


Question:
What is the zip code that has the lowest average mean sea level pressure?
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:
What are all the employees without a department number?
Additional table information: table: hr_1

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


Question:
Find the last name of the latest contact individual of the organization 'Labour Party'.
Additional table information: table: e_government

Answer: SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = 'Labour Party' ORDER BY t2.date_contact_to DESC LIMIT 1


Question:
Count the number of characteristics the product 'sesame' has.
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = 'sesame'


Question:
How many distinct parties are there for representatives?
Additional table information: table: election_representative

Answer: SELECT COUNT(DISTINCT Party) FROM representative


Question:
How many diffrent dorm amenities are there?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM dorm_amenity


Question:
Find the name and hours of project that has the most number of scientists.
Additional table information: table: scientist_1

Answer: SELECT T1.name, T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T2.project ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names and cities of the branches that do not have any registered members?
Additional table information: table: shop_membership

Answer: SELECT name, city FROM branch WHERE NOT branch_id IN (SELECT branch_id FROM membership_register_branch)


Question:
What are the names, address roads, and cities of the branches ordered by opening year?
Additional table information: table: shop_membership

Answer: SELECT name, address_road, city FROM branch ORDER BY open_year NULLS FIRST


Question:
Show me the owner of the channel with the highest rating.
Additional table information: table: program_share

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


Question:
what is the GDP of the city with the largest population.
Additional table information: table: city_record

Answer: SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1


Question:
List the organisation id with the maximum outcome count, and the count.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.organisation_id, COUNT(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?
Additional table information: table: chinook_1

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


Question:
Give the names of wrestlers and their elimination moves.
Additional table information: table: wrestler

Answer: SELECT T2.Name, T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID


Question:
Show the people that have been comptroller the most times and the corresponding number of times.
Additional table information: table: election

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


Question:
How many students are older than average for each gender?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), sex FROM student WHERE age > (SELECT AVG(age) FROM student) GROUP BY sex


Question:
What are the headquarters and industries of all companies?
Additional table information: table: company_employee

Answer: SELECT Headquarters, Industry FROM company


Question:
Show all artist name, age, and country ordered by the yeared they joined.
Additional table information: table: theme_gallery

Answer: SELECT name, age, country FROM artist ORDER BY Year_Join NULLS FIRST


Question:
What are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken?
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) NULLS FIRST


Question:
What are the names, details and data types of the characteristics which are never used by 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 are the names of the three artists who have produced the most songs, and how many works did they produce?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the different grant amounts for documents sent before '1986-08-26 20:49:27' and after the grant ended on '1989-03-16 18:27:16'?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date > '1989-03-16 18:27:16'


Question:
Find the total amount of loans offered by each bank branch.
Additional table information: table: loan_1

Answer: SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname


Question:
What are the names of the five oldest people?
Additional table information: table: gymnast

Answer: SELECT Name FROM People ORDER BY Age DESC LIMIT 5


Question:
List the object number of railways that do not have any trains.
Additional table information: table: railway

Answer: SELECT ObjectNumber FROM railway WHERE NOT Railway_ID IN (SELECT Railway_ID FROM train)


Question:
What is the total amount of grant money for research?
Additional table information: table: tracking_grants_for_research

Answer: SELECT SUM(grant_amount) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type = T3.organisation_type WHERE T3.organisation_type_description = 'Research'


Question:
Find the name and id of the team that won the most times in 2008 postseason.
Additional table information: table: baseball_1

Answer: SELECT T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many different types of rooms are there?
Additional table information: table: hospital_1

Answer: SELECT COUNT(DISTINCT roomtype) FROM room


Question:
What is the id, first name, and last name of the driver who was in the first position for laptime at least twice?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE POSITION = '1' GROUP BY T1.driverid HAVING COUNT(*) >= 2


Question:
How many songs, on average, are sung by a female artist?
Additional table information: table: music_1

Answer: SELECT AVG(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female'


Question:
Which college have both players with position midfielder and players with position defender?
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:
Give me the names and prices of furnitures which some companies are manufacturing.
Additional table information: table: manufacturer

Answer: SELECT t1.name, t2.price_in_dollar FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID


Question:
Please list the age and famous title of artists in descending order of age.
Additional table information: table: music_4

Answer: SELECT Famous_Title, Age FROM artist ORDER BY Age DESC


Question:
Show the distinct countries of managers.
Additional table information: table: railway

Answer: SELECT DISTINCT Country FROM manager


Question:
What is the party of the representative that has the smallest number of votes.
Additional table information: table: election_representative

Answer: SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes ASC NULLS FIRST LIMIT 1


Question:
Find the number of stores 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:
How many people are older than every engineer?
Additional table information: table: network_2

Answer: SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer')


Question:
How many exhibitions has each artist had?
Additional table information: table: theme_gallery

Answer: SELECT T2.name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id


Question:
Find the most popular room in the hotel. The most popular room is the room that had seen the largest number of reservations.
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 ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the average number of weeks on top for volumes by artists that are at most 25 years old.
Additional table information: table: music_4

Answer: SELECT AVG(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25


Question:
What are the names of the products that have a color description of 'red' and the 'fast' characteristic?
Additional table information: table: products_gen_characteristics

Answer: SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = 'red' AND t3.characteristic_name = 'fast'


Question:
List the number of people injured by perpetrators in ascending order.
Additional table information: table: perpetrator

Answer: SELECT Injured FROM perpetrator ORDER BY Injured ASC NULLS FIRST


Question:
Give the phone and postal code corresponding to 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 perpetrators?
Additional table information: table: perpetrator

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


Question:
Which submission received the highest score in acceptance result. Show me the result.
Additional table information: table: workshop_paper

Answer: SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1


Question:
Find the titles of items that received both a rating higher than 8 and a rating below 5.
Additional table information: table: epinions_1

Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5


Question:
What is the full name of each student who is not allergic to any type of food.
Additional table information: table: allergy_1

Answer: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food')


Question:
List the project details of the projects with the research outcome described with the substring 'Published'.
Additional table information: table: tracking_grants_for_research

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


Question:
How many rooms does the Lamberton building have?
Additional table information: table: college_2

Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton'


Question:
Find the year and semester when offers the largest number of courses.
Additional table information: table: college_2

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


Question:
Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200.
Additional table information: table: climbing

Answer: SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200


Question:
What are all the different book publishers?
Additional table information: table: culture_company

Answer: SELECT DISTINCT publisher FROM book_club


Question:
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
Additional table information: table: architecture

Answer: SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80


Question:
What are the average, minimum, and maximum ticket prices for exhibitions that happened prior to 2009?
Additional table information: table: theme_gallery

Answer: SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009


Question:
What degrees were conferred in San Francisco State University in the year 2001?
Additional table information: table: csu_1

Answer: SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = 'San Francisco State University' AND t2.year = 2001


Question:
List the names of all distinct wines ordered by price.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE ORDER BY price NULLS FIRST


Question:
How many gymnasts are there?
Additional table information: table: gymnast

Answer: SELECT COUNT(*) FROM gymnast


Question:
Hom many musicians performed in the song 'Flash'?
Additional table information: table: music_2

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


Question:
Which cmi cross reference id is not related to any parking taxes?
Additional table information: table: local_govt_mdm

Answer: SELECT cmi_cross_ref_id FROM cmi_cross_references EXCEPT SELECT cmi_cross_ref_id FROM parking_fines


Question:
Find the team that attended the least number of home games in 1980.
Additional table information: table: baseball_1

Answer: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC NULLS FIRST LIMIT 1


Question:
How many assets does each third party company supply? List the count and the company id.
Additional table information: table: assets_maintenance

Answer: SELECT COUNT(*), T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id


Question:
What is minimum hours of the students playing in different position?
Additional table information: table: soccer_2

Answer: SELECT MIN(T2.HS), T1.pPos FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID GROUP BY T1.pPos


Question:
how many times is the model ge40lfr?
Additional table information: table: "vehicles"."cars"
columns: order_year, manufacturer, model, fleet_series_quantity, powertrain, fuel_propulsion

Answer: SELECT COUNT manufacturer FROM "vehicles"."cars" WHERE model = 'GE40LFR'


Question:
List all cities of addresses in alphabetical order.
Additional table information: table: behavior_monitoring

Answer: SELECT city FROM Addresses ORDER BY city NULLS FIRST


Question:
What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?
Additional table information: table: formula_1

Answer: SELECT AVG(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = 'Monaco Grand Prix'


Question:
What are the balances of checking accounts belonging to people with savings balances greater than the average savings balance?
Additional table information: table: small_bank_1

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


Question:
Give the details of the project with the document name 'King Book'.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
How many different departments are there in each school that has less than 5 apartments?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code HAVING COUNT(DISTINCT dept_name) < 5


Question:
Show the names of counties that have at least two delegates.
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2


Question:
What is the name of the customer who has greatest total loan amount?
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC LIMIT 1


Question:
What is the count of different game types?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT gtype) FROM Video_games


Question:
Find the country that the most papers are affiliated with.
Additional table information: table: icfp_1

Answer: SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the state corresponding to the line number building '6862 Kaitlyn Knolls'.
Additional table information: table: e_government

Answer: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE '%6862 Kaitlyn Knolls%'


Question:
Which city is the headquarter of the store named 'Blackville' in?
Additional table information: table: store_product

Answer: SELECT t3.headquartered_city 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 WHERE t1.store_name = 'Blackville'


Question:
How many different instructors have taught some course?
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT id) FROM teaches


Question:
What are the id of students who registered course 301?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance WHERE course_id = 301


Question:
Give the names of wines with prices above any wine produced in 2006.
Additional table information: table: wine_1

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


Question:
Sort all the distinct products in alphabetical order.
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT product_name FROM products ORDER BY product_name NULLS FIRST


Question:
List the major of each male student.
Additional table information: table: voter_2

Answer: SELECT Major FROM STUDENT WHERE Sex = 'M'


Question:
Show member names that are not in the Progress Party.
Additional table information: table: party_people

Answer: SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> 'Progress Party'


Question:
Find the names of all the employees whose the role name is 'Editor'.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Show the names of customers who have at least 2 mailshots with outcome code 'Order'.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE outcome_code = 'Order' GROUP BY T1.customer_id HAVING COUNT(*) >= 2


Question:
How many students are affected by cat allergies?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = 'Cat'


Question:
Find the three most expensive procedures.
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures ORDER BY cost NULLS FIRST LIMIT 3


Question:
Give me the product type, name and price for all the products supplied by supplier id 3.
Additional table information: table: department_store

Answer: SELECT T2.product_type_code, T2.product_name, T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3


Question:
Show the names and main services for train stations that have the top three total number of passengers.
Additional table information: table: train_station

Answer: SELECT name, main_services FROM station ORDER BY total_passengers DESC LIMIT 3


Question:
Sort the customer names in alphabetical order.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers ORDER BY customer_details NULLS FIRST


Question:
Find the branch names of banks in the New York state.
Additional table information: table: loan_1

Answer: SELECT bname FROM bank WHERE state = 'New York'


Question:
What are the country names, area and population which has both roller coasters with speed higher
Additional table information: table: roller_coaster

Answer: SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed > 60 INTERSECT SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed < 55


Question:
Which employees have the role with code 'HR'? Find their names.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
For which countries are there more than four distinct addresses listed?
Additional table information: table: customers_and_addresses

Answer: SELECT country FROM addresses GROUP BY country HAVING COUNT(address_id) > 4


Question:
What are the first names of all students that are not enrolled in courses?
Additional table information: table: college_3

Answer: SELECT Fname FROM STUDENT WHERE NOT StuID IN (SELECT StuID FROM ENROLLED_IN)


Question:
What are the ids, names and genders of the architects who built two bridges or one mill?
Additional table information: table: architecture

Answer: SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 2 UNION SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 1


Question:
Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name.
Additional table information: table: sakila_1

Answer: SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30


Question:
What are the names of customers who use payment method 'Cash'?
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers WHERE payment_method = 'Cash'


Question:
List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.
Additional table information: table: insurance_policies

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


Question:
What are the title and maximum price of each film?
Additional table information: table: cinema

Answer: SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id


Question:
Find the name and capacity of the stadium where the event named 'World Junior' happened.
Additional table information: table: swimming

Answer: SELECT t1.name, t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior'


Question:
What is the name of the document with the most number of sections?
Additional table information: table: document_management

Answer: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many apartment bookings are there in total?
Additional table information: table: apartment_rentals

Answer: SELECT COUNT(*) FROM Apartment_Bookings


Question:
What are the line 1 and average monthly rentals of all student addresses?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.line_1, AVG(T2.monthly_rental) FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id


Question:
What are the names of departments that have primarily affiliated physicians.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1


Question:
How many times did Boston Red Stockings lose in 2009 postseason?
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009


Question:
What is the project id and detail for the project with at least 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:
How many video games do you have?
Additional table information: table: game_1

Answer: SELECT COUNT(*) FROM Video_games


Question:
Which customers do not have any policies? Find the details of these customers.
Additional table information: table: insurance_policies

Answer: SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id


Question:
Which directors had a movie both in the year 1999 and 2000?
Additional table information: table: culture_company

Answer: SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999


Question:
Show all the planned delivery dates and actual delivery dates of bookings.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Planned_Delivery_Date, Actual_Delivery_Date FROM BOOKINGS


Question:
Find the total amount claimed in the most recently created document.
Additional table information: table: insurance_and_eClaims

Answer: SELECT SUM(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date NULLS FIRST LIMIT 1)


Question:
Show the manager name for gas stations belonging to the ExxonMobil company.
Additional table information: table: gas_company

Answer: SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil'


Question:
What is the product with the highest height? Give me the catalog entry name.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1


Question:
What is the nationality of the journalist with the largest number of years working?
Additional table information: table: news_report

Answer: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1


Question:
What is the maximum training hours for the students whose training hours is greater than 1000 in different positions?
Additional table information: table: soccer_2

Answer: SELECT MAX(T1.HS), pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos


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 is the name of the customer that has purchased the most items?
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY SUM(t3.order_quantity) DESC LIMIT 1


Question:
For each zip code, how many times has the maximum wind speed reached 25 mph?
Additional table information: table: bike_1

Answer: SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code


Question:
What are the names of the people who are older 40 but no friends under age 30?
Additional table information: table: network_2

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


Question:
List the name and cost of all procedures sorted by the cost from the highest to the lowest.
Additional table information: table: hospital_1

Answer: SELECT name, cost FROM procedures ORDER BY cost DESC


Question:
Return the name, location, and seating of the track that was opened in the most recent year.
Additional table information: table: race_track

Answer: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1


Question:
For each reviewer id, what is the title and rating for the movie with the smallest rating?
Additional table information: table: movie_1

Answer: SELECT T2.title, T1.rID, T1.stars, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID


Question:
Which city has the most addresses? List the city name, number of addresses, and city id.
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:
What is the last name of the musicians who has played back position the most?
Additional table information: table: music_2

Answer: SELECT T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE stageposition = 'back' GROUP BY lastname ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names and publication dates of all catalogs that have catalog level number greater than 5.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_name, t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5


Question:
How many female students have milk or egg allergies?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = 'F' AND T1.allergy = 'Milk' OR T1.allergy = 'Eggs'


Question:
What are the first and last names of all the female students who have president votes?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = 'F'


Question:
What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
Additional table information: table: driving_school

Answer: SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000


Question:
What countries are the female artists who sung in the language Bangla from?
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:
For each room, find its name and the number of times reservations were made for it.
Additional table information: table: inn_1

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


Question:
What are the first and last names of all the candidates?
Additional table information: table: student_assessment

Answer: SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id


Question:
How many students did not have any course enrollment?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE NOT student_id IN (SELECT student_id FROM Student_Course_Enrolment)


Question:
What is the full name and id of the customer who has the lowest total amount of payment?
Additional table information: table: sakila_1

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


Question:
what is id of students who registered some courses but the least number of courses in these students?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Show all statement id and the number of accounts for each statement.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Find the description and code of the service type that is performed the most times.
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Find the name and capacity of products with price greater than 700 (in USD).
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700


Question:
How many airlines does Russia has?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM airlines WHERE country = 'Russia'


Question:
Find the max, average, and minimum gpa of all students in each department.
Additional table information: table: college_1

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


Question:
What are the dates that have an average sea level pressure between 30.3 and 31?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31


Question:
What are the total order quantities of photo products?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT SUM(T1.Order_Quantity) FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_Name = 'photo'


Question:
What is 'the date in location from' and 'the date in location to' for the document with name 'Robin CV'?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T1.date_in_location_from, T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = 'Robin CV'


Question:
What are the first names and office of the professors who are in the history department and have a Ph.D?
Additional table information: table: college_1

Answer: SELECT T1.emp_fname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'


Question:
For each sex, what is the name and sex of the candidate with the oppose rate for their sex?
Additional table information: table: candidate_poll

Answer: SELECT t1.name, t1.sex, MIN(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex


Question:
What is the average price range of five star hotels that allow pets?
Additional table information: table: cre_Theme_park

Answer: SELECT AVG(price_range) FROM HOTELS WHERE star_rating_code = '5' AND pets_allowed_yn = 1


Question:
List the name of a building along with the name of a company whose office is in the building.
Additional table information: table: company_office

Answer: SELECT T3.name, T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id


Question:
Count the number of countries.
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM county_public_safety


Question:
Return the day Number and stored date for all the documents.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T2.day_Number, T1.Date_Stored FROM All_documents AS T1 JOIN Ref_calendar AS T2 ON T1.date_stored = T2.calendar_date