Question:
Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?
Additional table information: table: hospital_1

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


Question:
Show the addresses and phones of all the buildings managed by 'Brenden'.
Additional table information: table: apartment_rentals

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


Question:
What is the name and price of the cheapest product?
Additional table information: table: manufactory_1

Answer: SELECT name, price FROM Products ORDER BY price ASC NULLS FIRST LIMIT 1


Question:
How many products were not included in any order?
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items)


Question:
Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department.
Additional table information: table: college_2

Answer: SELECT name, salary FROM instructor WHERE salary < (SELECT AVG(salary) FROM instructor WHERE dept_name = 'Physics')


Question:
What are the names of all campuses located at Chico?
Additional table information: table: csu_1

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


Question:
Find the texts of assessment notes for teachers with last name 'Schuster'.
Additional table information: table: behavior_monitoring

Answer: SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schuster'


Question:
Find the id and address of the shops whose score is below the average score.
Additional table information: table: coffee_shop

Answer: SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)


Question:
Find the name of the activity that has the largest number of student participants.
Additional table information: table: activity_1

Answer: SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which students participate in both Canoeing and Kayaking as their activities? Tell me their student ids.
Additional table information: table: activity_1

Answer: SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Canoeing' INTERSECT SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Kayaking'


Question:
What details are there on the research staff? List the result in ascending alphabetical order.
Additional table information: table: tracking_grants_for_research

Answer: SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC NULLS FIRST


Question:
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
Additional table information: table: train_station

Answer: SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25


Question:
What are the authors of submissions and their colleges?
Additional table information: table: workshop_paper

Answer: SELECT Author, College FROM submission


Question:
Find the Char cells, Pixels and Hardware colours for the screen of the phone whose hardware model name is 'LG-P760'.
Additional table information: table: phone_1

Answer: SELECT T1.Char_cells, T1.Pixels, T1.Hardware_colours FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Hardware_Model_name = 'LG-P760'


Question:
What is the name of each course and the corresponding number of student enrollment?
Additional table information: table: e_learning

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


Question:
display all the information for all employees who have the letters D or S in their first name and also arrange the result in descending order by salary.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC


Question:
How many students live in each city?
Additional table information: table: allergy_1

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


Question:
What are the three largest cities in terms of regional population?
Additional table information: table: city_record

Answer: SELECT city FROM city ORDER BY regional_population DESC LIMIT 3


Question:
What are the song titles on the album 'A Kiss Before You Go: Live in Hamburg'?
Additional table information: table: music_2

Answer: SELECT T3.title FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE T1.title = 'A Kiss Before You Go: Live in Hamburg'


Question:
Which head's name has the substring 'Ha'? List the id and name.
Additional table information: table: department_management

Answer: SELECT head_id, name FROM head WHERE name LIKE '%Ha%'


Question:
What are the issue dates of volumes associated with the artist aged 23 or younger?
Additional table information: table: music_4

Answer: SELECT Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 23


Question:
What are the names of all the subjects.
Additional table information: table: e_learning

Answer: SELECT subject_name FROM SUBJECTS


Question:
Give the unit of measure for the product with the name 'cumin'.
Additional table information: table: products_gen_characteristics

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


Question:
What is the average age of all gymnasts?
Additional table information: table: gymnast

Answer: SELECT AVG(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID


Question:
What are the average prices of products for each manufacturer?
Additional table information: table: manufactory_1

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


Question:
What is the first name of each student enrolled in class ACCT-211?
Additional table information: table: college_1

Answer: SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'


Question:
In which country and state does Janessa Sawayn live?
Additional table information: table: driving_school

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


Question:
Find the total access count of all documents in the most popular document type.
Additional table information: table: document_management

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


Question:
What is the code of the city with the most students?
Additional table information: table: dorm_1

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


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

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


Question:
Which range contains the most mountains?
Additional table information: table: climbing

Answer: SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the title and director of the films without any schedule?
Additional table information: table: cinema

Answer: SELECT title, directed_by FROM film WHERE NOT film_id IN (SELECT film_id FROM schedule)


Question:
Return the famous titles of the artist called 'Triumfall'.
Additional table information: table: music_4

Answer: SELECT Famous_Title FROM artist WHERE Artist = 'Triumfall'


Question:
How many students are taught by teacher 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 the ids of all employees who have either destroyed a document or made an authorization to do this.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
Show the number of trains
Additional table information: table: train_station

Answer: SELECT COUNT(*) FROM train


Question:
Find the dates of the tests taken with result 'Pass'.
Additional table information: table: e_learning

Answer: SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = 'Pass'


Question:
Find the first names of all instructors who have taught some course and the course description.
Additional table information: table: college_1

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


Question:
Find the names of users whose emails contain ‘superstar’ or ‘edu’.
Additional table information: table: twitter_1

Answer: SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%'


Question:
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name 'Meaghan'?
Additional table information: table: customers_and_invoices

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


Question:
List the names of studios that have at least two films.
Additional table information: table: film_rank

Answer: SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2


Question:
Find the first name and age of the students who are playing both Football and Lacrosse.
Additional table information: table: game_1

Answer: SELECT fname, age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = 'Football' INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = 'Lacrosse')


Question:
Find the patient who most recently stayed in room 111.
Additional table information: table: hospital_1

Answer: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1


Question:
Find the number of trains for each station, as well as the station network name and services.
Additional table information: table: station_weather

Answer: SELECT COUNT(*), t1.network_name, t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id


Question:
List the top 5 genres by number of tracks. List genres name and total tracks.
Additional table information: table: store_1

Answer: SELECT T1.name, COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 5


Question:
List the names of journalists who have not reported any event.
Additional table information: table: news_report

Answer: SELECT Name FROM journalist WHERE NOT journalist_ID IN (SELECT journalist_ID FROM news_report)


Question:
Show the premise type and address type code for all customer addresses.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT T2.premises_type, T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id = T2.premise_id


Question:
What is the description, code and the corresponding count of each service type?
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Find the total number of instructors who teach a course in the Spring 2010 semester.
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010


Question:
What are the names of the reviewers who have rated a movie more than 3 stars before?
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3


Question:
What is the minimum snatch score?
Additional table information: table: body_builder

Answer: SELECT MIN(snatch) FROM body_builder


Question:
In which buildings are there at least ten professors?
Additional table information: table: activity_1

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


Question:
What is the last name of the musician who was in 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:
What is the average, minimum, maximum, and total transaction amount?
Additional table information: table: customers_and_invoices

Answer: SELECT AVG(transaction_amount), MIN(transaction_amount), MAX(transaction_amount), SUM(transaction_amount) FROM Financial_transactions


Question:
What is the name of the activity with the most students?
Additional table information: table: activity_1

Answer: SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names and year of construction for the mills of 'Grondzeiler' type?
Additional table information: table: architecture

Answer: SELECT name, built_year FROM mill WHERE TYPE = 'Grondzeiler'


Question:
For each type, how many ships are there?
Additional table information: table: ship_mission

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


Question:
Show all student IDs with the number of sports and total number of games played
Additional table information: table: game_1

Answer: SELECT StuID, COUNT(*), SUM(gamesplayed) FROM Sportsinfo GROUP BY StuID


Question:
What are the ids of the students who are not involved in any activity
Additional table information: table: activity_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in


Question:
How many hosts does each nationality have? List the nationality and the count.
Additional table information: table: party_host

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


Question:
What are the names of companies with revenue between 100 and 150?
Additional table information: table: manufactory_1

Answer: SELECT name FROM manufacturers WHERE revenue BETWEEN 100 AND 150


Question:
What are the names of products with price at most 200?
Additional table information: table: manufactory_1

Answer: SELECT name FROM products WHERE price <= 200


Question:
Who is the instructor with the highest salary?
Additional table information: table: college_2

Answer: SELECT name FROM instructor ORDER BY salary DESC LIMIT 1


Question:
List the first name middle name and last name of all staff.
Additional table information: table: driving_school

Answer: SELECT first_name, middle_name, last_name FROM Staff


Question:
How many customers have an account?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


Question:
Give the number of students living in either HKG or CHI.
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI'


Question:
How many instructors are in the department with the highest budget, and what is their average salary?
Additional table information: table: college_2

Answer: SELECT AVG(T1.salary), COUNT(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1


Question:
What are the names of wines made from red grapes?
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red'


Question:
Please show the names of aircrafts associated with airport with name 'London Gatwick'.
Additional table information: table: aircraft

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


Question:
What are all the customer phone numbers under the most popular policy type?
Additional table information: table: insurance_fnol

Answer: SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What is the maximum and minimum resolution of all songs that are approximately 3 minutes long?
Additional table information: table: music_1

Answer: SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '3:%'


Question:
What is the id and last name of the driver with the longest laptime?
Additional table information: table: formula_1

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


Question:
What are the names of the top 8 countries by total invoice size and what are those sizes?
Additional table information: table: store_1

Answer: SELECT billing_country, SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8


Question:
Show names and phones of customers who do not have address information.
Additional table information: table: customers_and_products_contacts

Answer: SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_address_history)


Question:
How many different card types are there?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(DISTINCT card_type_code) FROM Customers_Cards


Question:
What are the starting years shared by the technicians from the team 'CLE' or 'CWS'?
Additional table information: table: machine_repair

Answer: SELECT Starting_Year FROM technician WHERE Team = 'CLE' INTERSECT SELECT Starting_Year FROM technician WHERE Team = 'CWS'


Question:
What are the names of hosts who did not host any party in our record?
Additional table information: table: party_host

Answer: SELECT Name FROM HOST WHERE NOT Host_ID IN (SELECT Host_ID FROM party_host)


Question:
Return the address of customer 10.
Additional table information: table: department_store

Answer: SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10


Question:
Find the name of the department that has the biggest number of students minored in?
Additional table information: table: college_3

Answer: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the first and last name of the students who do not have any food type allergy.
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:
Which customer made the most orders? Find the customer name.
Additional table information: table: tracking_orders

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


Question:
Find the id and color description of the products with at least 2 characteristics.
Additional table information: table: products_gen_characteristics

Answer: SELECT t1.product_id, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING COUNT(*) >= 2


Question:
What are the names of circuits that belong to UK or Malaysia?
Additional table information: table: formula_1

Answer: SELECT name FROM circuits WHERE country = 'UK' OR country = 'Malaysia'


Question:
How many products are there under the category 'Seeds'?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products WHERE product_category_code = 'Seeds'


Question:
What is the minimum salary in each department?
Additional table information: table: hr_1

Answer: SELECT MIN(salary), department_id FROM employees GROUP BY department_id


Question:
Show the country name and capital of all countries.
Additional table information: table: match_season

Answer: SELECT Country_name, Capital FROM country


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

Answer: SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC


Question:
When did the staff member named Janessa Sawayn join the company?
Additional table information: table: driving_school

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


Question:
What are the dates when customers with ids between 10 and 20 became customers?
Additional table information: table: customers_and_addresses

Answer: SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20


Question:
What is the id, forname and surname of the driver who had the first position in terms of 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:
What is the name of the district with the most residents?
Additional table information: table: store_product

Answer: SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1


Question:
Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.
Additional table information: table: hospital_1

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


Question:
What is the name of the oldest manager?
Additional table information: table: railway

Answer: SELECT Name FROM manager ORDER BY Age DESC LIMIT 1


Question:
Show the ids of students whose advisors are professors.
Additional table information: table: activity_1

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


Question:
What are the different police forces of counties that are not located in the East?
Additional table information: table: county_public_safety

Answer: SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION <> 'East'


Question:
How many customers are there of each gender?
Additional table information: table: customers_and_invoices

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


Question:
what are the details of the cmi masters that have the cross reference code 'Tax'?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T2.source_system_code = 'Tax'


Question:
List names for drivers from Hartford city and younger than 40.
Additional table information: table: school_bus

Answer: SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40


Question:
Which room has the highest base price?
Additional table information: table: inn_1

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


Question:
Show the number of buildings with a height above the average or a number of floors above the average.
Additional table information: table: protein_institute

Answer: SELECT COUNT(*) FROM building WHERE height_feet > (SELECT AVG(height_feet) FROM building) OR floors > (SELECT AVG(floors) FROM building)


Question:
What is the entry name of the most expensive catalog (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:
Find the maximum and minimum sales of the companies that are not in the 'Banking' industry.
Additional table information: table: company_office

Answer: SELECT MAX(Sales_billion), MIN(Sales_billion) FROM Companies WHERE Industry <> 'Banking'


Question:
What are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1 AND T2.points > 20


Question:
Tell me the the date when the first claim was made.
Additional table information: table: insurance_policies

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


Question:
What are the last names of employees who serve at most 20 customers?
Additional table information: table: chinook_1

Answer: SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20


Question:
How many products have prices of at least 180?
Additional table information: table: manufactory_1

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


Question:
List the name, nationality and id of all male architects ordered by their names lexicographically.
Additional table information: table: architecture

Answer: SELECT name, nationality, id FROM architect WHERE gender = 'male' ORDER BY name NULLS FIRST


Question:
Count the number of tracks.
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM track


Question:
How many rooms are there?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms


Question:
What is the most common company type, and how many are there?
Additional table information: table: flight_company

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


Question:
How many customers does Steve Johnson support?
Additional table information: table: store_1

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


Question:
List the locations of schools in descending order of founded year.
Additional table information: table: school_player

Answer: SELECT LOCATION FROM school ORDER BY Founded DESC


Question:
What are the ids of all students along with how many sports and games did they play?
Additional table information: table: game_1

Answer: SELECT StuID, COUNT(*), SUM(gamesplayed) FROM Sportsinfo GROUP BY StuID


Question:
Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009.
Additional table information: table: hr_1

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


Question:
What is the weight of the shortest person?
Additional table information: table: entrepreneur

Answer: SELECT Weight FROM people ORDER BY Height ASC NULLS FIRST LIMIT 1


Question:
HOw many engineers are older than 30?
Additional table information: table: network_2

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


Question:
Show the names of authors from college 'Florida' or 'Temple'
Additional table information: table: workshop_paper

Answer: SELECT Author FROM submission WHERE College = 'Florida' OR College = 'Temple'


Question:
Find the number of settlements each claim corresponds to. Show the number together with the claim id.
Additional table information: table: insurance_policies

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


Question:
Show all member names who are not in charge of any event.
Additional table information: table: party_people

Answer: SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id


Question:
Which tourist attractions can we get to by bus? Tell me the names of the attractions.
Additional table information: table: cre_Theme_park

Answer: SELECT Name FROM TOURIST_ATTRACTIONS WHERE How_to_Get_There = 'bus'


Question:
What are the numbers of races for each constructor id?
Additional table information: table: formula_1

Answer: SELECT COUNT(*), constructorid FROM constructorStandings GROUP BY constructorid


Question:
What are the greatest and average capacity for rooms in each building?
Additional table information: table: college_2

Answer: SELECT MAX(capacity), AVG(capacity), building FROM classroom GROUP BY building


Question:
What is the name of the technician whose team is not 'NYY'?
Additional table information: table: machine_repair

Answer: SELECT Name FROM technician WHERE Team <> 'NYY'


Question:
Show the first names and last names of all the guests that have apartment bookings with status code 'Confirmed'.
Additional table information: table: apartment_rentals

Answer: SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = 'Confirmed'


Question:
What country is the artist who made the fewest songs 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 GROUP BY T2.artist_name ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Return the device carriers that do not have Android as their software platform.
Additional table information: table: device

Answer: SELECT Carrier FROM device WHERE Software_Platform <> 'Android'


Question:
What is the average access count of documents that have the least common structure?
Additional table information: table: document_management

Answer: SELECT AVG(access_count) FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Find the birth dates corresponding to employees who live in the city of Edmonton.
Additional table information: table: chinook_1

Answer: SELECT BirthDate FROM EMPLOYEE WHERE City = 'Edmonton'


Question:
Find the name and position of physicians who prescribe some medication whose brand is X?
Additional table information: table: hospital_1

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


Question:
What are the claim dates and settlement dates of all the settlements?
Additional table information: table: insurance_policies

Answer: SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements


Question:
What is the id of the reviewer named Daniel Lewis?
Additional table information: table: movie_1

Answer: SELECT rID FROM Reviewer WHERE name = 'Daniel Lewis'


Question:
On what day was the order with invoice number 10 placed?
Additional table information: table: tracking_orders

Answer: SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10


Question:
What is the number of distinct cities the stations are located at?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT city) FROM station


Question:
How many residents does each property have? List property id and resident count.
Additional table information: table: local_govt_and_lot

Answer: SELECT T1.property_id, COUNT(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id


Question:
What is the flight number, origin, and destination for all flights in alphabetical order by departure cities?
Additional table information: table: flight_1

Answer: SELECT flno, origin, destination FROM Flight ORDER BY origin NULLS FIRST


Question:
Return the full name and phone of the customer who has card number 4560596484842.
Additional table information: table: customers_card_transactions

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


Question:
List the names of the city with the top 5 white percentages.
Additional table information: table: county_public_safety

Answer: SELECT Name FROM city ORDER BY White DESC LIMIT 5


Question:
Which channels broadcast both in the morning and at night? Give me the channel names.
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'


Question:
What is the id and stop number for each driver that has a shorter pit stop than the driver in the race with id 841?
Additional table information: table: formula_1

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


Question:
Retrieve the list of all cities.
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT city FROM addresses


Question:
Return the most frequent result across all musicals.
Additional table information: table: musical

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


Question:
In which year were most departments established?
Additional table information: table: department_management

Answer: SELECT creation FROM department GROUP BY creation ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names, color descriptions, and product descriptions for products in the 'Herbs' category?
Additional table information: table: products_gen_characteristics

Answer: SELECT T1.product_name, T2.color_description, T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = 'Herbs'


Question:
Show each premise type and the number of premises in that type.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT premises_type, COUNT(*) FROM premises GROUP BY premises_type


Question:
Find the login name of the course author that teaches the course with name 'advanced database'.
Additional table information: table: e_learning

Answer: SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'advanced database'


Question:
Find the policy type the most customers choose.
Additional table information: table: insurance_policies

Answer: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many customers have email that contains 'gmail.com'?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE '%gmail.com%'


Question:
Count the number of films whose title contains the word 'Dummy'.
Additional table information: table: cinema

Answer: SELECT COUNT(*) FROM film WHERE title LIKE '%Dummy%'


Question:
What are the order dates of orders with price higher than 1000?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000


Question:
What are the first and last name of the faculty who has the most students?
Additional table information: table: activity_1

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


Question:
What are the codes of all the courses that are located in room KLR209?
Additional table information: table: college_1

Answer: SELECT class_code FROM CLASS WHERE class_room = 'KLR209'


Question:
Find the names of users who have more than one tweet.
Additional table information: table: twitter_1

Answer: SELECT T1.name FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING COUNT(*) > 1


Question:
Show the employee ids for all employees with role name 'Human Resource' or 'Manager'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = 'Human Resource' OR T2.role_name = 'Manager'


Question:
List the names and the locations that the enzymes can make an effect.
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name, LOCATION FROM enzyme


Question:
Show the name of the party that has at least two records.
Additional table information: table: election

Answer: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2


Question:
What is the course title of the prerequisite of course Mobile Computing?
Additional table information: table: college_2

Answer: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'Mobile Computing')


Question:
What are the staff ids and genders of all staffs whose job title is Department Manager?
Additional table information: table: department_store

Answer: SELECT T1.staff_id, 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 = 'Department Manager'


Question:
Count the number of products that were never ordered.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM products WHERE NOT product_id IN (SELECT product_id FROM Order_items)


Question:
What are the top three apartment types in terms of the average room count? Give me the
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3


Question:
How many universities have a campus fee greater than the average?
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 youngest editor?
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor ORDER BY Age ASC NULLS FIRST LIMIT 1


Question:
What is the state and enrollment of the colleges where have any students who got accepted in the tryout decision.
Additional table information: table: soccer_2

Answer: SELECT DISTINCT T1.state, T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'


Question:
What are the ids of songs that are available in either mp4 format or have resolution above 720?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' UNION SELECT f_id FROM song WHERE resolution > 720


Question:
Show all allergy type with number of students affected.
Additional table information: table: allergy_1

Answer: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype


Question:
Which countries have at least 3 cities?
Additional table information: table: sakila_1

Answer: SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING COUNT(*) >= 3


Question:
Show all main industry and total market value in each industry.
Additional table information: table: gas_company

Answer: SELECT main_industry, SUM(market_value) FROM company GROUP BY main_industry


Question:
Which status code is the most common of all the bookings?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the least popular kind of decor?
Additional table information: table: inn_1

Answer: SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) ASC NULLS FIRST LIMIT 1


Question:
Return the names of entrepreneurs.
Additional table information: table: entrepreneur

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


Question:
Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000.
Additional table information: table: tracking_share_transactions

Answer: SELECT date_of_transaction FROM TRANSACTIONS WHERE share_count > 100 OR amount_of_transaction > 1000


Question:
What is the average salary of employees who have a commission percentage that is not null?
Additional table information: table: hr_1

Answer: SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> 'null' GROUP BY department_id


Question:
What are the names, locations, and years of opening for tracks with seating higher than average?
Additional table information: table: race_track

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


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

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


Question:
Which institution is the author 'Matthias Blume' belong to? Give me the name of the institution.
Additional table information: table: icfp_1

Answer: SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = 'Matthias' AND t1.lname = 'Blume'


Question:
Find the last name and age of the student who has allergy to both milk and cat.
Additional table information: table: allergy_1

Answer: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Milk' INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = 'Cat')


Question:
How many climbers are there?
Additional table information: table: climbing

Answer: SELECT COUNT(*) FROM climber


Question:
In the year 2000, what is the campus fee for San Francisco State University?
Additional table information: table: csu_1

Answer: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = 'San Francisco State University' AND t1.year = 2000


Question:
What are all the different zip codes that have a maximum dew point that was always below 70?
Additional table information: table: bike_1

Answer: SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70


Question:
Show all distinct city where branches with at least 100 memberships are located.
Additional table information: table: shop_membership

Answer: SELECT DISTINCT city FROM branch WHERE membership_amount >= 100


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

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


Question:
What is the name and hours for the project which has the most scientists assigned to it?
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 is the total number of gas stations that opened between 2000 and 2005?
Additional table information: table: gas_company

Answer: SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005


Question:
Return the different nominees of musicals that have an award that is not the Tony Award.
Additional table information: table: musical

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


Question:
Show the names of people who have been on the negative side of debates at least twice.
Additional table information: table: debate

Answer: SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2


Question:
What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21'
Additional table information: table: local_govt_and_lot

Answer: SELECT DISTINCT T2.thing_id, T2.Type_of_Thing_Code FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21'


Question:
Which payment method is used the most often?
Additional table information: table: insurance_policies

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


Question:
What is the name of the highest mountain?
Additional table information: table: climbing

Answer: SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1


Question:
What type of game is Call of Destiny?
Additional table information: table: game_1

Answer: SELECT gtype FROM Video_games WHERE gname = 'Call of Destiny'


Question:
What is the total home game attendance of team Boston Red Stockings from 2000 to 2010?
Additional table information: table: baseball_1

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


Question:
What are the names of all reviewers that have rated 3 or more movies?
Additional table information: table: movie_1

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


Question:
Which staff members are assigned to the problem with id 1? Give me their first and last names.
Additional table information: table: tracking_software_problems

Answer: SELECT DISTINCT staff_first_name, staff_last_name FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T2.problem_id = 1


Question:
What is the starting year for the oldest technician?
Additional table information: table: machine_repair

Answer: SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1


Question:
What are the names of workshop groups in which services with product name 'film' are performed?
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Who is performing in the back stage position for the song 'Badlands'? Show the first name and the last name.
Additional table information: table: music_2

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


Question:
Find the product names that are colored 'white' but do not have unit of measurement 'Handful'.
Additional table information: table: products_gen_characteristics

Answer: SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = 'white' AND t2.unit_of_measure <> 'Handful'


Question:
How many tourists did not make any visit?
Additional table information: table: cre_Theme_park

Answer: SELECT COUNT(*) FROM Visitors WHERE NOT Tourist_ID IN (SELECT Tourist_ID FROM Visits)


Question:
Which poll resource provided the most number of candidate information?
Additional table information: table: candidate_poll

Answer: SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the ids of the problems reported after 1978-06-26.
Additional table information: table: tracking_software_problems

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


Question:
Show the names of all the donors except those whose donation amount less than 9.
Additional table information: table: school_finance

Answer: SELECT donator_name FROM endowment EXCEPT SELECT donator_name FROM endowment WHERE amount < 9


Question:
What are the drivers' first, last names and id who had more than 8 pit stops or participated in more than 5 race results?
Additional table information: table: formula_1

Answer: SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 8 UNION SELECT T1.forename, T1.surname, T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING COUNT(*) > 5


Question:
What is the average price for wines not produced in Sonoma county?
Additional table information: table: wine_1

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


Question:
Show the start dates and end dates of all the apartment bookings.
Additional table information: table: apartment_rentals

Answer: SELECT booking_start_date, booking_end_date FROM Apartment_Bookings


Question:
how many programs are there?
Additional table information: table: program_share

Answer: SELECT COUNT(*) FROM program


Question:
Who are the friends of Alice that are doctors?
Additional table information: table: network_2

Answer: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor'


Question:
Find the id of the candidate who got the lowest oppose rate.
Additional table information: table: candidate_poll

Answer: SELECT Candidate_ID FROM candidate ORDER BY oppose_rate NULLS FIRST LIMIT 1


Question:
Find all the papers published by 'Aaron Turon'.
Additional table information: table: icfp_1

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


Question:
Find all phones that have word 'Full' in their accreditation types. List the Hardware Model name and Company name.
Additional table information: table: phone_1

Answer: SELECT Hardware_Model_name, Company_name FROM phone WHERE Accreditation_type LIKE 'Full'


Question:
List the position of players and the average number of points of players of each position.
Additional table information: table: sports_competition

Answer: SELECT POSITION, AVG(Points) FROM player GROUP BY POSITION


Question:
What is the language used most often in the songs?
Additional table information: table: music_1

Answer: SELECT languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many female students live in Smith Hall?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F'


Question:
What are the name, phone number and email address of the customer who made the largest number of orders?
Additional table information: table: department_store

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


Question:
Which physicians have never taken any appointment? Find their names.
Additional table information: table: hospital_1

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


Question:
Show the investors shared by entrepreneurs that requested more than 140000 and entrepreneurs that requested less than 120000.
Additional table information: table: entrepreneur

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


Question:
Find the max, average and min training hours of all players.
Additional table information: table: soccer_2

Answer: SELECT AVG(HS), MAX(HS), MIN(HS) FROM Player


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

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


Question:
List the names of gymnasts in ascending order by their heights.
Additional table information: table: gymnast

Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC NULLS FIRST


Question:
Show all ministers and parties they belong to in descending order of the time they took office.
Additional table information: table: party_people

Answer: SELECT minister, party_name FROM party ORDER BY took_office DESC


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

Answer: SELECT COUNT(*) FROM student


Question:
For each branch id, what are the names of the branches that were registered after 2015?
Additional table information: table: shop_membership

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


Question:
Show the name of drivers in descending order of age.
Additional table information: table: school_bus

Answer: SELECT name FROM driver ORDER BY age DESC


Question:
Count the number of schools.
Additional table information: table: school_finance

Answer: SELECT COUNT(*) FROM school


Question:
Find the number of scientists involved for each project name.
Additional table information: table: scientist_1

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


Question:
List the name of the county with the largest population.
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1


Question:
Find the id of the customer who made the most orders.
Additional table information: table: tracking_orders

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


Question:
What are the different schools and their nicknames, ordered by their founding years?
Additional table information: table: university_basketball

Answer: SELECT school, nickname FROM university ORDER BY founded NULLS FIRST


Question:
What are the first names for all faculty professors, ordered by first name?
Additional table information: table: college_3

Answer: SELECT Fname FROM FACULTY WHERE Rank = 'Professor' ORDER BY Fname NULLS FIRST


Question:
What are the entry names of catalog with the attribute possessed by 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 film has the most copies in the inventory? List both title and id.
Additional table information: table: sakila_1

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


Question:
Who has a friend that is from new york city?
Additional table information: table: network_2

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


Question:
Show the locations of parties with hosts older than 50.
Additional table information: table: party_host

Answer: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50


Question:
How many documents are with document type code BK for each product id?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = 'BK' GROUP BY project_id


Question:
What are the names of the different artists that have produced a song in English but have never receieved a rating higher than 8?
Additional table information: table: music_1

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


Question:
Show the school name and type for schools without a school bus.
Additional table information: table: school_bus

Answer: SELECT school, TYPE FROM school WHERE NOT school_id IN (SELECT school_id FROM school_bus)


Question:
Find the number of employees of each gender whose salary is lower than 50000.
Additional table information: table: company_1

Answer: SELECT COUNT(*), sex FROM employee WHERE salary < 50000 GROUP BY sex


Question:
Which club has the most female students as their members? Give me the name of the club.
Additional table information: table: club_1

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


Question:
What is the average hours across all projects?
Additional table information: table: scientist_1

Answer: SELECT AVG(hours) FROM projects


Question:
Find the starting date and ending data in location for the document named '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:
Find the average fee on a CSU campus in 1996
Additional table information: table: csu_1

Answer: SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 1996


Question:
Find the names of channels that are not owned by CCTV.
Additional table information: table: program_share

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


Question:
What are the names of different tracks, and how many races has each had?
Additional table information: table: race_track

Answer: SELECT T2.name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id


Question:
List the details of the customers who do not have any policies.
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:
What are the names of the airports which are not in the country 'Iceland'?
Additional table information: table: flight_company

Answer: SELECT name FROM airport WHERE country <> 'Iceland'


Question:
Find all the catalog publishers whose name contains 'Murray'
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE '%Murray%'


Question:
How many distinct students are enrolled in courses?
Additional table information: table: e_learning

Answer: SELECT COUNT(DISTINCT student_id) FROM Student_Course_Enrolment


Question:
From which hometowns did no gymnasts come from?
Additional table information: table: gymnast

Answer: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID


Question:
What is the name of the department with the most students minoring in it?
Additional table information: table: college_3

Answer: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the average base price of different bed type? List bed type and average base price.
Additional table information: table: inn_1

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


Question:
Find the names and phone numbers of customers living in California state.
Additional table information: table: customer_deliveries

Answer: SELECT t1.customer_name, t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'


Question:
Count the number of different positions in the club 'Bootup Baltimore'.
Additional table information: table: club_1

Answer: SELECT COUNT(DISTINCT t2.position) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid WHERE t1.clubname = 'Bootup Baltimore'


Question:
What are the first names and support rep ids for employees serving 10 or more customers?
Additional table information: table: chinook_1

Answer: SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10


Question:
What are the case burdens of counties, ordered descending by population?
Additional table information: table: county_public_safety

Answer: SELECT Case_burden FROM county_public_safety ORDER BY Population DESC


Question:
What is the partition id of the user named 'Iron Man'.
Additional table information: table: twitter_1

Answer: SELECT partitionid FROM user_profiles WHERE name = 'Iron Man'


Question:
How many tracks are in the AAC audio file media type?
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = 'AAC audio file'


Question:
Show the location codes and the number of documents in each location.
Additional table information: table: cre_Doc_Tracking_DB

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


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

Answer: SELECT COUNT(*) FROM Staff


Question:
Return the issue dates of volumes that are by the artist named Gorgoroth.
Additional table information: table: music_4

Answer: SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = 'Gorgoroth'


Question:
Show me the distinct payment method codes from the invoice record.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT DISTINCT payment_method_code FROM INVOICES


Question:
What is the list of school locations sorted in ascending order of school enrollment?
Additional table information: table: school_player

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


Question:
Show the names of people aged either 35 or 36.
Additional table information: table: debate

Answer: SELECT Name FROM people WHERE Age = 35 OR Age = 36


Question:
What is the list of program names, sorted by the order of launch date?
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch NULLS FIRST


Question:
Show the minimum, average, maximum order quantity of all invoices.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT MIN(Order_Quantity), AVG(Order_Quantity), MAX(Order_Quantity) FROM INVOICES


Question:
What are the names and types of the dorms that have a capacity greater than 300 or less than 100?
Additional table information: table: dorm_1

Answer: SELECT dorm_name, gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100


Question:
What is the name and country for the artist with most number of exhibitions?
Additional table information: table: theme_gallery

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


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

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


Question:
Who are the members of the club named 'Bootup Baltimore'? Give me their last names.
Additional table information: table: club_1

Answer: SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Bootup Baltimore'


Question:
What is the average capacity of the stadiums that were opened in year 2005?
Additional table information: table: swimming

Answer: SELECT AVG(capacity) FROM stadium WHERE opening_year = 2005


Question:
What is the name and age of every male? Order the results by age.
Additional table information: table: network_2

Answer: SELECT name FROM Person WHERE gender = 'male' ORDER BY age NULLS FIRST


Question:
What are the maximum duration and resolution of all songs, for each language, ordered alphabetically by language?
Additional table information: table: music_1

Answer: SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages NULLS FIRST


Question:
Find the number and averaged salary of all instructors who are in the department with the highest budget.
Additional table information: table: college_2

Answer: SELECT AVG(T1.salary), COUNT(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1


Question:
Return the total revenue of companies with headquarters in Tokyo or Taiwan.
Additional table information: table: manufactory_1

Answer: SELECT SUM(revenue) FROM manufacturers WHERE Headquarter = 'Tokyo' OR Headquarter = 'Taiwan'


Question:
How many architects haven't built a mill before year 1850?
Additional table information: table: architecture

Answer: SELECT COUNT(*) FROM architect WHERE NOT id IN (SELECT architect_id FROM mill WHERE built_year < 1850)


Question:
Find the titles of papers whose first author is affiliated with an institution in the country 'Japan' and has last name 'Ohori'?
Additional table information: table: icfp_1

Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = 'Japan' AND t2.authorder = 1 AND t1.lname = 'Ohori'


Question:
Return the address content for the customer whose name is 'Maudie Kertzmann'.
Additional table information: table: customers_and_addresses

Answer: SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = 'Maudie Kertzmann'


Question:
List the description of all aircrafts.
Additional table information: table: aircraft

Answer: SELECT Description FROM aircraft


Question:
How many instrument does the musician with last name 'Heilo' use?
Additional table information: table: music_2

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


Question:
Show the cinema name and location for cinemas with capacity above average.
Additional table information: table: cinema

Answer: SELECT name, LOCATION FROM cinema WHERE capacity > (SELECT AVG(capacity) FROM cinema)


Question:
Which customers have ever canceled the purchase of the product 'food' (the item status is 'Cancel')?
Additional table information: table: tracking_orders

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


Question:
What is the campus fee of 'San Francisco State University' in year 2000?
Additional table information: table: csu_1

Answer: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = 'San Francisco State University' AND t1.year = 2000


Question:
What are the different product names for products that have the 'warm' characteristic:?
Additional table information: table: products_gen_characteristics

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


Question:
Which party has two or more records?
Additional table information: table: election

Answer: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2


Question:
List the names of all distinct wines that are made of red color grape.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red'


Question:
Return each apartment type code along with the maximum and minimum number of rooms among each type.
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM Apartments GROUP BY apt_type_code


Question:
List the most common type of artworks.
Additional table information: table: entertainment_awards

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


Question:
What is the id of the product that is booked for 3 times?
Additional table information: table: products_for_hire

Answer: SELECT product_id FROM products_booked GROUP BY product_id HAVING COUNT(*) = 3


Question:
Find the first name and office of history professor who did not get a Ph.D. degree.
Additional table information: table: college_1

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


Question:
What is the carrier of the most expensive phone?
Additional table information: table: phone_market

Answer: SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1


Question:
What are the name and id of the team with the most victories 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 faculty members did the university that conferred the most degrees in 2002 have?
Additional table information: table: csu_1

Answer: SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1


Question:
Give the maximum and minimum weeks on top across all volumes.
Additional table information: table: music_4

Answer: SELECT MAX(Weeks_on_Top), MIN(Weeks_on_Top) FROM volume


Question:
Which authors belong to the institution 'Google'? Show the first names and last names.
Additional table information: table: icfp_1

Answer: SELECT DISTINCT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = 'Google'


Question:
What is the name of party with most number of members?
Additional table information: table: party_people

Answer: SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which states have more than 2 parks?
Additional table information: table: baseball_1

Answer: SELECT state FROM park GROUP BY state HAVING COUNT(*) > 2


Question:
List the research staff details, and order in ascending order.
Additional table information: table: tracking_grants_for_research

Answer: SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC NULLS FIRST


Question:
Find the first names of students whose first names contain letter 'a'.
Additional table information: table: college_3

Answer: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%'


Question:
How many accounts are there?
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Accounts


Question:
What are the first names of students in room 108?
Additional table information: table: student_1

Answer: SELECT firstname FROM list WHERE classroom = 108


Question:
What are the names of all songs that are ordered by their resolution numbers?
Additional table information: table: music_1

Answer: SELECT song_name FROM song ORDER BY resolution NULLS FIRST


Question:
Which Payments were processed with Visa? List the payment Id, the date and the amount.
Additional table information: table: insurance_policies

Answer: SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa'


Question:
Which advisors have more than two students?
Additional table information: table: voter_2

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


Question:
Find all the phone numbers.
Additional table information: table: insurance_fnol

Answer: SELECT customer_phone FROM available_policies


Question:
What are the name of rooms that cost more than the average.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice > (SELECT AVG(basePrice) FROM Rooms)


Question:
List the names of hosts who did not serve as a host of any party in our record.
Additional table information: table: party_host

Answer: SELECT Name FROM HOST WHERE NOT Host_ID IN (SELECT Host_ID FROM party_host)


Question:
What is the name of the song that was released in the most recent year?
Additional table information: table: music_1

Answer: SELECT song_name, releasedate FROM song ORDER BY releasedate DESC LIMIT 1


Question:
What are the years of film market estimation for the market of Japan, ordered by year descending?
Additional table information: table: film_rank

Answer: SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T2.Country = 'Japan' ORDER BY T1.Year DESC


Question:
Which delegates are from counties with population smaller than 100000?
Additional table information: table: election

Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000


Question:
How many accounts do we have?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Accounts


Question:
What are the names and seatings for all tracks opened after 2000, ordered by seating?
Additional table information: table: race_track

Answer: SELECT name, seating FROM track WHERE year_opened > 2000 ORDER BY seating NULLS FIRST


Question:
List the names of all routes in alphabetic order.
Additional table information: table: customer_deliveries

Answer: SELECT route_name FROM Delivery_Routes ORDER BY route_name NULLS FIRST


Question:
Who is the president of the club 'Bootup Baltimore'? Give me the first and last name.
Additional table information: table: club_1

Answer: SELECT t3.fname, t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Bootup Baltimore' AND t2.position = 'President'


Question:
Give the average quantity of stocks.
Additional table information: table: device

Answer: SELECT AVG(Quantity) FROM stock


Question:
How many project members were leaders or started working before '1989-04-24 23:51:54'?
Additional table information: table: tracking_grants_for_research

Answer: SELECT COUNT(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54'


Question:
What is the maximum, minimum, and average amount of money outsanding for all customers?
Additional table information: table: driving_school

Answer: SELECT MAX(amount_outstanding), MIN(amount_outstanding), AVG(amount_outstanding) FROM Customers


Question:
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
Additional table information: table: movie_1

Answer: SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2.year > 2000


Question:
order all gas station locations by the opening year.
Additional table information: table: gas_company

Answer: SELECT LOCATION FROM gas_station ORDER BY open_year NULLS FIRST


Question:
What are the statement ids, statement details, and account details, for all accounts?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details, T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id


Question:
What are the types and nationalities of every ship?
Additional table information: table: ship_mission

Answer: SELECT TYPE, Nationality FROM ship


Question:
Find the catalog publisher that has the most catalogs.
Additional table information: table: product_catalog

Answer: SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the description of the product called 'Chocolate'.
Additional table information: table: customer_complaints

Answer: SELECT product_description FROM products WHERE product_name = 'Chocolate'


Question:
What are the names of the songs that have a lower rating than at least one blues song?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MAX(rating) FROM song WHERE genre_is = 'blues')


Question:
What are the names of organizations that contain the word 'Party'?
Additional table information: table: e_government

Answer: SELECT organization_name FROM organizations WHERE organization_name LIKE '%Party%'


Question:
What instruments did the musician with the last name 'Heilo' play in 'Badlands'?
Additional table information: table: music_2

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


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

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


Question:
Find the name of physicians who are affiliated with Surgery or Psychiatry department.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'


Question:
What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20?
Additional table information: table: products_for_hire

Answer: SELECT product_name, product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND daily_hire_cost < 20


Question:
Find id of the candidate who most recently accessed the course?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1


Question:
Show the 3 counties with the smallest population.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population ASC NULLS FIRST LIMIT 3


Question:
What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.
Additional table information: table: perpetrator

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


Question:
What are the different instruments listed in the database?
Additional table information: table: music_2

Answer: SELECT DISTINCT instrument FROM Instruments


Question:
display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M and make the result set in ascending order by department number.
Additional table information: table: hr_1

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


Question:
Show the different headquarters and number of companies at each headquarter.
Additional table information: table: company_employee

Answer: SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters


Question:
How many patents outcomes were listed for all the projects?
Additional table information: table: tracking_grants_for_research

Answer: SELECT COUNT(*) FROM Project_outcomes WHERE outcome_code = 'Patent'


Question:
Find the movies with the highest average rating. Return the movie titles and average rating.
Additional table information: table: movie_1

Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) DESC LIMIT 1


Question:
What are the different states that had students successfully try out?
Additional table information: table: soccer_2

Answer: SELECT DISTINCT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'


Question:
What are the id of problems reported by the staff named Dameon Frami or Jolie Weber?
Additional table information: table: tracking_software_problems

Answer: SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Dameon' AND T2.staff_last_name = 'Frami' UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Jolie' AND T2.staff_last_name = 'Weber'


Question:
How many lessons have been cancelled?
Additional table information: table: driving_school

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


Question:
Which paper's title contains the word 'Database'?
Additional table information: table: icfp_1

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


Question:
How much amount in total were 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:
List all role codes, role names, and role descriptions.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_code, role_name, role_description FROM ROLES


Question:
What is the total population for all the districts that have an area larger tahn the average city area?
Additional table information: table: store_product

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


Question:
List all the policy types used by the customer enrolled in the most policies.
Additional table information: table: insurance_fnol

Answer: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What are all the payment methods?
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT payment_method FROM customers


Question:
What is the name of the patient who made the most recent appointment?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1


Question:
What is the last name of the author that has published the most papers?
Additional table information: table: icfp_1

Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname, t1.lname ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the most common location of performances.
Additional table information: table: performance_attendance

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


Question:
Show the number of projects.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Projects


Question:
Show the headquarters that have both companies in banking industry and companies in oil and gas industry.
Additional table information: table: company_employee

Answer: SELECT Headquarters FROM company WHERE Industry = 'Banking' INTERSECT SELECT Headquarters FROM company WHERE Industry = 'Oil and gas'


Question:
Return the first names and last names of all guests
Additional table information: table: apartment_rentals

Answer: SELECT guest_first_name, guest_last_name FROM Guests


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

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


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

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


Question:
How many buildings are there?
Additional table information: table: protein_institute

Answer: SELECT COUNT(*) FROM building


Question:
Find the name, class and rank of all captains.
Additional table information: table: ship_1

Answer: SELECT name, CLASS, rank FROM captain


Question:
Show the title and director for all films.
Additional table information: table: cinema

Answer: SELECT title, directed_by FROM film


Question:
Which park did the most people attend in 2008?
Additional table information: table: baseball_1

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


Question:
What are the names of the stations which serve both 'Ananthapuri Express' and 'Guruvayur Express' trains?
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = 'Ananthapuri Express' INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = 'Guruvayur Express'


Question:
What is the payment method code and party phone of the party with the email 'enrico09@example.com'?
Additional table information: table: e_government

Answer: SELECT payment_method_code, party_phone FROM parties WHERE party_email = 'enrico09@example.com'


Question:
Show all distinct building descriptions.
Additional table information: table: apartment_rentals

Answer: SELECT DISTINCT building_description FROM Apartment_Buildings


Question:
Give the names of characteristics that are in two or more products?
Additional table information: table: products_gen_characteristics

Answer: SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING COUNT(*) >= 2


Question:
How many film are there?
Additional table information: table: film_rank

Answer: SELECT COUNT(*) FROM film


Question:
What is the average number of years spent working as a journalist?
Additional table information: table: news_report

Answer: SELECT AVG(Years_working) FROM journalist


Question:
What are the descriptions of the service types with product price above 100?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100


Question:
Give the distinct famous release dates for all artists.
Additional table information: table: music_4

Answer: SELECT DISTINCT (Famous_Release_date) FROM artist


Question:
Show the different countries and the number of members from each.
Additional table information: table: decoration_competition

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


Question:
What is the type of vocals that the band member with the last name 'Heilo' played the most?
Additional table information: table: music_2

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


Question:
what are the names and classes of the ships that do not have any captain yet?
Additional table information: table: ship_1

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


Question:
What are the number of different course codes?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT crs_code) FROM CLASS


Question:
Count the number of clubs for which the student named 'Eric Tai' is a member.
Additional table information: table: club_1

Answer: SELECT COUNT(DISTINCT t1.clubname) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = 'Eric' AND t3.lname = 'Tai'


Question:
Find the total hours of all projects.
Additional table information: table: scientist_1

Answer: SELECT SUM(hours) FROM projects


Question:
What are the login names used both by some course authors and some students?
Additional table information: table: e_learning

Answer: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students


Question:
Which nationality has the most hosts?
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many different departments are there?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_name) FROM department


Question:
What is the date of enrollment of the course named 'Spanish'?
Additional table information: table: e_learning

Answer: SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish'


Question:
Which contact channel codes were used less than 5 times?
Additional table information: table: customers_and_addresses

Answer: SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING COUNT(customer_id) < 5


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

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


Question:
Which major has most number of students?
Additional table information: table: allergy_1

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


Question:
What is the campus fee for San Jose State University in 1996?
Additional table information: table: csu_1

Answer: SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = 'San Jose State University' AND T2.year = 1996


Question:
What are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor?
Additional table information: table: entrepreneur

Answer: SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor


Question:
Find names and ids of all documents with document type code BK.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
What are the id and name of the stations that have ever had more than 12 bikes available?
Additional table information: table: bike_1

Answer: SELECT DISTINCT T1.id, T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12


Question:
Find the number of papers published by the institution 'University of Pennsylvania'.
Additional table information: table: icfp_1

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


Question:
List Aerosmith's albums.
Additional table information: table: store_1

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


Question:
What are the full names of faculty members who are a part of department 520?
Additional table information: table: college_3

Answer: SELECT T1.Fname, T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520


Question:
List the most common result of the musicals.
Additional table information: table: musical

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


Question:
What is the average price range of hotels for each each star rating code?
Additional table information: table: cre_Theme_park

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


Question:
What is the average balance in checking accounts?
Additional table information: table: small_bank_1

Answer: SELECT AVG(balance) FROM checking


Question:
Return the low and high estimates for all film markets.
Additional table information: table: film_rank

Answer: SELECT Low_Estimate, High_Estimate FROM film_market_estimation


Question:
What is the number of routes that end at John F Kennedy International Airport?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport'


Question:
Return the maximum and minimum customer codes.
Additional table information: table: department_store

Answer: SELECT MAX(customer_code), MIN(customer_code) FROM Customers


Question:
What are the names of enzymes whose product is not 'Heme'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name FROM enzyme WHERE product <> 'Heme'


Question:
Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.
Additional table information: table: storm_record

Answer: SELECT SUM(number_deaths), SUM(damage_millions_USD) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)


Question:
What are the name and assets of each company, sorted in ascending order of company name?
Additional table information: table: company_office

Answer: SELECT name, Assets_billion FROM Companies ORDER BY name ASC NULLS FIRST


Question:
Which skill is used in fixing the most number of faults? List the skill id and description.
Additional table information: table: assets_maintenance

Answer: SELECT T1.skill_id, T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the budget type codes, budget type descriptions and document ids for documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T2.budget_type_code, T2.budget_type_description, T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code


Question:
What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
Additional table information: table: baseball_1

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


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

Answer: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'


Question:
Find the players whose names contain letter 'a'.
Additional table information: table: soccer_2

Answer: SELECT DISTINCT pName FROM Player WHERE pName LIKE '%a%'


Question:
Find all information about student addresses, and sort by monthly rental in descending order.
Additional table information: table: behavior_monitoring

Answer: SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC


Question:
Find the title of the course that is offered by more than one department.
Additional table information: table: college_2

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


Question:
Find the name of the storm that affected both Afghanistan and Albania regions.
Additional table information: table: storm_record

Answer: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'


Question:
Find the personal names of students not enrolled in any course.
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