Question:
Find the id and city of the student address with the highest average monthly rental.
Additional table information: table: behavior_monitoring

Answer: SELECT T2.address_id, T1.city FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1


Question:
Show the names of the drivers without a school bus.
Additional table information: table: school_bus

Answer: SELECT name FROM driver WHERE NOT driver_id IN (SELECT driver_id FROM school_bus)


Question:
List name and damage for all storms in a descending order of max speed.
Additional table information: table: storm_record

Answer: SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC


Question:
Please show the categories of the music festivals with count more than 1.
Additional table information: table: music_4

Answer: SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1


Question:
what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.
Additional table information: table: manufacturer

Answer: SELECT MAX(num_of_shops), AVG(Num_of_Factories) FROM manufacturer WHERE open_year < 1990


Question:
Find names of all colleges whose enrollment is greater than that of all colleges in the FL state.
Additional table information: table: soccer_2

Answer: SELECT cName FROM college WHERE enr > (SELECT MAX(enr) FROM college WHERE state = 'FL')


Question:
What are the first and last names of the artist who perfomed the song 'Badlands'?
Additional table information: table: music_2

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


Question:
Which club has the most members majoring in '600'?
Additional table information: table: club_1

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


Question:
What are the average prominence of the mountains in country 'Morocco'?
Additional table information: table: mountain_photos

Answer: SELECT AVG(prominence) FROM mountain WHERE country = 'Morocco'


Question:
How many students and instructors are in each department?
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT T2.id), COUNT(DISTINCT T3.id), T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name


Question:
For each city, what is the highest latitude for its stations?
Additional table information: table: bike_1

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


Question:
What campuses are located in Northridge, Los Angeles or in San Francisco, San Francisco?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE LOCATION = 'Northridge' AND county = 'Los Angeles' UNION SELECT campus FROM campuses WHERE LOCATION = 'San Francisco' AND county = 'San Francisco'


Question:
List the ids of the problems from the product 'voluptatem' that are reported after 1995?
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = 'voluptatem' AND T1.date_problem_reported > '1995'


Question:
Find the number of rooms with price higher than 120 for different decor.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor


Question:
What are the distinct classes that races can have?
Additional table information: table: race_track

Answer: SELECT DISTINCT CLASS FROM race


Question:
List the names of all distinct races in reversed  lexicographic order?
Additional table information: table: formula_1

Answer: SELECT DISTINCT name FROM races ORDER BY name DESC


Question:
What are the different types of vocals?
Additional table information: table: music_2

Answer: SELECT DISTINCT TYPE FROM vocals


Question:
List the names of wrestlers that have not been eliminated.
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler WHERE NOT Wrestler_ID IN (SELECT Wrestler_ID FROM elimination)


Question:
What is the number of states that has some colleges whose enrollment is smaller than the average enrollment?
Additional table information: table: soccer_2

Answer: SELECT COUNT(DISTINCT state) FROM college WHERE enr < (SELECT AVG(enr) FROM college)


Question:
What is the average longitude of stations that never had bike availability more than 10?
Additional table information: table: bike_1

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


Question:
Show the date of the tallest perpetrator.
Additional table information: table: perpetrator

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


Question:
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
Additional table information: table: mountain_photos

Answer: SELECT name, prominence FROM mountain EXCEPT SELECT T1.name, T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'


Question:
What are the names of all stations with a latitude smaller than 37.5?
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE lat < 37.5


Question:
Find the code of the document type 'Paper'.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT document_type_code FROM Ref_document_types WHERE document_type_name = 'Paper'


Question:
Find the first and last names of all the female (sex is F) students who have president votes.
Additional table information: table: voter_2

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


Question:
Which studios have never worked with the director Walter Hill?
Additional table information: table: film_rank

Answer: SELECT Studio FROM film EXCEPT SELECT Studio FROM film WHERE Director = 'Walter Hill'


Question:
Show the account id and the number of transactions for each account
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id


Question:
Show all card type codes.
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT card_type_code FROM Customers_Cards


Question:
Sort the list of names and costs of all procedures in the descending order of cost.
Additional table information: table: hospital_1

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


Question:
list all female (sex is F) candidate names in the alphabetical order.
Additional table information: table: candidate_poll

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


Question:
Which part has the least chargeable amount? List the part id and amount.
Additional table information: table: assets_maintenance

Answer: SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount ASC NULLS FIRST LIMIT 1


Question:
Find the delegates who are from counties with population below 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:
Count the number of actors.
Additional table information: table: musical

Answer: SELECT COUNT(*) FROM actor


Question:
Show the number of audience in year 2008 or 2010.
Additional table information: table: entertainment_awards

Answer: SELECT Num_of_Audience FROM festival_detail WHERE YEAR = 2008 OR YEAR = 2010


Question:
What is the description of the club named 'Tennis Club'?
Additional table information: table: club_1

Answer: SELECT clubdesc FROM club WHERE clubname = 'Tennis Club'


Question:
Sort all the distinct product names in alphabetical order.
Additional table information: table: tracking_software_problems

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


Question:
How many international and domestic passengers are there in the airport London Heathrow?
Additional table information: table: aircraft

Answer: SELECT International_Passengers, Domestic_Passengers FROM airport WHERE Airport_Name = 'London Heathrow'


Question:
What are the names of products whose availability equals to 1?
Additional table information: table: products_for_hire

Answer: SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = 1


Question:
Find the ship type that are used by both ships with Panama and Malta flags.
Additional table information: table: ship_1

Answer: SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'


Question:
What are the names of wines with scores higher than 90?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE score > 90


Question:
List the names of states that have more than 2 parks.
Additional table information: table: baseball_1

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


Question:
What are the hometowns of gymnasts and the corresponding number of gymnasts?
Additional table information: table: gymnast

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


Question:
How many drivers did not race in 2009?
Additional table information: table: formula_1

Answer: SELECT COUNT(DISTINCT driverId) FROM results WHERE NOT raceId IN (SELECT raceId FROM races WHERE YEAR <> 2009)


Question:
Count the number of tracks that are of the media type 'AAC audio file'.
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:
Find the name of airports whose altitude is between -50 and 50.
Additional table information: table: flight_4

Answer: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50


Question:
What is the name and city of the airport from most of the routes start?
Additional table information: table: flight_4

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


Question:
What is the most frequent status of 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 are the titles and average ratings for all movies that have the lowest 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) NULLS FIRST LIMIT 1


Question:
Find the name of the genre that is most frequent across all tracks.
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1


Question:
On which day was the order placed whose shipment tracking number is 3452?
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.shipment_tracking_number = 3452


Question:
How many problems did the product called 'voluptatem' have in record?
Additional table information: table: tracking_software_problems

Answer: SELECT COUNT(*) FROM product AS T1 JOIN problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = 'voluptatem'


Question:
Find the average access count of documents with the least popular 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:
How many events have each participants attended? List the participant id, type and the number.
Additional table information: table: local_govt_in_alabama

Answer: SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID


Question:
Which member names are shared among members in the party with the id 3 and the party with the id 1?
Additional table information: table: party_people

Answer: SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1


Question:
What are all the company names that have a book published by Alyson?
Additional table information: table: culture_company

Answer: SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson'


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

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


Question:
What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order.
Additional table information: table: tracking_grants_for_research

Answer: SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_type_description = 'Sponsor' ORDER BY organisation_details NULLS FIRST


Question:
What are the names of shops in ascending order of open year?
Additional table information: table: device

Answer: SELECT Shop_Name FROM shop ORDER BY Open_Year ASC NULLS FIRST


Question:
What are the carriers of devices whose software platforms are not 'Android'?
Additional table information: table: device

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


Question:
What are the types of vocals used in the song 'Demon Kitty Rag'?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Demon Kitty Rag'


Question:
Count the number of tracks that are part of the rock genre.
Additional table information: table: chinook_1

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


Question:
What are characteristic names used at least twice across all 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:
What are the different customer ids, and how many cards does each one hold?
Additional table information: table: customers_card_transactions

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


Question:
Which faculty members are playing either Canoeing or Kayaking? Tell me their first names.
Additional table information: table: activity_1

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


Question:
What is the gender of the teacher with last name 'Medhurst'?
Additional table information: table: behavior_monitoring

Answer: SELECT gender FROM TEACHERS WHERE last_name = 'Medhurst'


Question:
How many architects are female?
Additional table information: table: architecture

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


Question:
What is the total number of professors with a Ph.D. ?
Additional table information: table: college_1

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


Question:
List the name and assets of each company 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:
Find the name of tracks which are in Movies playlist but not in music playlist.
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' EXCEPT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'


Question:
How many stores are there?
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM store


Question:
Show all storm names except for those with at least two affected regions.
Additional table information: table: storm_record

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


Question:
Show ids for all the male faculty.
Additional table information: table: activity_1

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


Question:
Return the names of parties that have two or more events.
Additional table information: table: party_people

Answer: SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2


Question:
List all the services in the alphabetical order.
Additional table information: table: insurance_fnol

Answer: SELECT service_name FROM services ORDER BY service_name NULLS FIRST


Question:
Show names of cities and names of counties they are in.
Additional table information: table: county_public_safety

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


Question:
What is the average score of submissions?
Additional table information: table: workshop_paper

Answer: SELECT AVG(Scores) FROM submission


Question:
What is the total number of customers who use banks in New York City?
Additional table information: table: loan_1

Answer: SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City'


Question:
What are the names of shops that have more than a single kind of device in stock?
Additional table information: table: device

Answer: SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1


Question:
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.
Additional table information: table: train_station

Answer: SELECT name, LOCATION FROM station ORDER BY Annual_entry_exit NULLS FIRST, Annual_interchanges NULLS FIRST


Question:
Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.
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 of customers with credit score less than the average credit score across customers?
Additional table information: table: loan_1

Answer: SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer)


Question:
Find the maximum and total number of followers of all users.
Additional table information: table: twitter_1

Answer: SELECT MAX(followers), SUM(followers) FROM user_profiles


Question:
What is the structure of the document with the least number of accesses?
Additional table information: table: document_management

Answer: SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which members of 'Bootup Baltimore' major in '600'? Give me their first names and last names.
Additional table information: table: club_1

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


Question:
What are the public schools and what are their locations?
Additional table information: table: university_basketball

Answer: SELECT school, LOCATION FROM university WHERE affiliation = 'Public'


Question:
Count the number of services.
Additional table information: table: e_government

Answer: SELECT COUNT(*) FROM services


Question:
Which store owns most items?
Additional table information: table: sakila_1

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


Question:
What are the names of the students who took classes in 2009 or 2010?
Additional table information: table: college_2

Answer: SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010


Question:
How many different types of sports do we offer?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT sportname) FROM Sportsinfo


Question:
Find the wineries that have at least four wines.
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE GROUP BY Winery HAVING COUNT(*) >= 4


Question:
What the full names, ids of each employee and the name of the country they are in?
Additional table information: table: hr_1

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


Question:
What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach?
Additional table information: table: college_1

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


Question:
Find all members of 'Bootup Baltimore' whose major is '600'. Show the first name 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 t3.major = '600'


Question:
Find the total credits of all classes offered by each department.
Additional table information: table: college_1

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


Question:
What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'?
Additional table information: table: tracking_grants_for_research

Answer: SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'


Question:
How many kinds of enzymes are there?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(*) FROM enzyme


Question:
What are the student ids for those on scholarship in major number 600?
Additional table information: table: game_1

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


Question:
Which locations have 2 or more cinemas with capacity over 300?
Additional table information: table: cinema

Answer: SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT(*) >= 2


Question:
Show the times of elimination by 'Punk' or 'Orton'.
Additional table information: table: wrestler

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


Question:
Count the number of different payment method codes used by parties.
Additional table information: table: e_government

Answer: SELECT COUNT(DISTINCT payment_method_code) FROM parties


Question:
Find the names of songs whose genre is modern or language is English.
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE genre_is = 'modern' OR languages = 'english'


Question:
What is the number of days that had an average humity above 50 and an average visibility above 8?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8


Question:
What is the type of vocables that appears most frequently?
Additional table information: table: music_2

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


Question:
How many dorms are in the database?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM dorm


Question:
What is the average salary for each job title?
Additional table information: table: hr_1

Answer: SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title


Question:
Find the distinct student first names of all students that have grade point at least 3.8 in one course.
Additional table information: table: college_3

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


Question:
Show the average, maximum, minimum enrollment of all schools.
Additional table information: table: school_finance

Answer: SELECT AVG(enrollment), MAX(enrollment), MIN(enrollment) FROM school


Question:
What is the average latitude and longitude of the starting points of all trips?
Additional table information: table: bike_1

Answer: SELECT AVG(T1.lat), AVG(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id


Question:
What is the name of the album that has the track Ball to the Wall?
Additional table information: table: store_1

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


Question:
What are the total points for all gymnasts, ordered by total points descending?
Additional table information: table: gymnast

Answer: SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC


Question:
Find the different billing countries for all invoices.
Additional table information: table: chinook_1

Answer: SELECT DISTINCT (BillingCountry) FROM INVOICE


Question:
How many exhibitions have a attendance more than 100 or have a ticket price below 10?
Additional table information: table: theme_gallery

Answer: SELECT COUNT(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10


Question:
Give me the name and description of the location with code x.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_name, location_description FROM Ref_locations WHERE location_code = 'x'


Question:
Count the number of exhibitions that happened in or after 2005.
Additional table information: table: theme_gallery

Answer: SELECT COUNT(*) FROM exhibition WHERE YEAR >= 2005


Question:
What is the total count of enzymes?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(*) FROM enzyme


Question:
Find the major that is studied by the most female students.
Additional table information: table: voter_2

Answer: SELECT Major FROM STUDENT WHERE Sex = 'F' GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many different types of beds are there?
Additional table information: table: inn_1

Answer: SELECT COUNT(DISTINCT bedType) FROM Rooms


Question:
Count the number of programs broadcast for each time section of a day.
Additional table information: table: program_share

Answer: SELECT COUNT(*), time_of_day FROM broadcast GROUP BY time_of_day


Question:
In which year did the least people enter hall of fame?
Additional table information: table: baseball_1

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


Question:
Find the first and last name of all the students of age 18 who have vice president votes.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18


Question:
What is the primary conference of the school that has the lowest acc percent score in the competition?
Additional table information: table: university_basketball

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


Question:
Find the number of routes and airport name for each source airport, order the results by decreasing number of routes.
Additional table information: table: flight_4

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


Question:
What is the type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'


Question:
What are the product id and product type of the cheapest product?
Additional table information: table: department_store

Answer: SELECT product_id, product_type_code FROM products ORDER BY product_price NULLS FIRST LIMIT 1


Question:
Show the reign and days held of wrestlers.
Additional table information: table: wrestler

Answer: SELECT Reign, Days_held FROM wrestler


Question:
Find the name of all students who were in the tryout sorted in alphabetic order.
Additional table information: table: soccer_2

Answer: SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID ORDER BY T1.pName NULLS FIRST


Question:
What are the different account ids that have made financial transactions, as well as how many transactions correspond to each?
Additional table information: table: customers_card_transactions

Answer: SELECT account_id, COUNT(*) FROM Financial_transactions GROUP BY account_id


Question:
Find the name and country of origin for all artists who have release at least one song of resolution above 900.
Additional table information: table: music_1

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


Question:
what are the event details of the services that have the type code 'Marriage'?
Additional table information: table: local_govt_in_alabama

Answer: SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage'


Question:
What are the names of regions that were not affected?
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE NOT region_id IN (SELECT region_id FROM affected_region)


Question:
What is the average time span of contact channels in the database?
Additional table information: table: customers_and_addresses

Answer: SELECT AVG(active_to_date - active_from_date) FROM customer_contact_channels


Question:
How many dorms have amenities?
Additional table information: table: dorm_1

Answer: SELECT COUNT(DISTINCT dormid) FROM has_amenity


Question:
Find the names of schools that have some students playing in goalie and mid positions.
Additional table information: table: soccer_2

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


Question:
Find the name of product that is produced by both companies Creative Labs and Sony.
Additional table information: table: manufactory_1

Answer: SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Creative Labs' INTERSECT SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Sony'


Question:
What are the names of the tourist attractions and the dates when the tourists named Vincent or Vivian visited there?
Additional table information: table: cre_Theme_park

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


Question:
Find the total number of catalog contents.
Additional table information: table: product_catalog

Answer: SELECT COUNT(*) FROM catalog_contents


Question:
What is the city with the most customers?
Additional table information: table: driving_school

Answer: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids and details for each project?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, project_details FROM Projects


Question:
What are the names of all the stores in the largest district by population?
Additional table information: table: store_product

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


Question:
Which enzyme names have the substring 'ALA'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name FROM enzyme WHERE name LIKE '%ALA%'


Question:
Show the teams that have both wrestlers eliminated by 'Orton' and wrestlers eliminated by 'Benjamin'.
Additional table information: table: wrestler

Answer: SELECT Team FROM Elimination WHERE Eliminated_By = 'Orton' INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By = 'Benjamin'


Question:
What are the cities no customers live in?
Additional table information: table: customers_and_addresses

Answer: SELECT city FROM addresses WHERE NOT city IN (SELECT DISTINCT t3.city 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)


Question:
What are the names of the technicians by ascending order of quality rank for the machine they are assigned?
Additional table information: table: machine_repair

Answer: SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank NULLS FIRST


Question:
Show names of actors that have appeared in musical with name 'The Phantom of the Opera'.
Additional table information: table: musical

Answer: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = 'The Phantom of the Opera'


Question:
What is the code of the category that the product with the name 'flax' belongs to?
Additional table information: table: products_gen_characteristics

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


Question:
For each county, find the name of the county and the number of delegates from that county.
Additional table information: table: election

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


Question:
Show the id, name of each editor and the number of journal committees they are on.
Additional table information: table: journal_committee

Answer: SELECT T1.editor_id, T1.Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.editor_id


Question:
Which classes have more than two captains?
Additional table information: table: ship_1

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


Question:
Return the name of the youngest captain.
Additional table information: table: ship_1

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


Question:
Show the name, street address, and number of floors for all buildings ordered by the number of floors.
Additional table information: table: protein_institute

Answer: SELECT name, street_address, floors FROM building ORDER BY floors NULLS FIRST


Question:
How many routes end in a Canadian 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 country = 'Canada'


Question:
Show all allergies with type food.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = 'food'


Question:
Find the titles of all movies directed by steven spielberg.
Additional table information: table: movie_1

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


Question:
What are the names and ids of artists with 3 or more albums, listed in alphabetical order?
Additional table information: table: chinook_1

Answer: SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name NULLS FIRST


Question:
Find the phone number of all the customers and staff.
Additional table information: table: customer_complaints

Answer: SELECT phone_number FROM customers UNION SELECT phone_number FROM staff


Question:
What is the total amount of all payments?
Additional table information: table: sakila_1

Answer: SELECT SUM(amount) FROM payment


Question:
Find the number of vocal types used in song 'Demon Kitty Rag'?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Demon Kitty Rag'


Question:
Who has friends that are older than the average age? Print their friends and their ages as well
Additional table information: table: network_2

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


Question:
What are the names of the activities Mark Giuliano is involved in
Additional table information: table: activity_1

Answer: SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = 'Mark' AND T1.lname = 'Giuliano'


Question:
What is the name of the institution that 'Matthias Blume' belongs to?
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:
What are the dates for the documents with both 'GV' type and 'SF' type expenses?
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Show the height of the mountain climbed by the climber with the maximum points.
Additional table information: table: climbing

Answer: SELECT T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID ORDER BY T1.Points DESC LIMIT 1


Question:
What are the chip model and screen mode of the phone with hardware model name 'LG-P760'?
Additional table information: table: phone_1

Answer: SELECT chip_model, screen_mode FROM phone WHERE Hardware_Model_name = 'LG-P760'


Question:
List the first and last names of all distinct staff members who are assigned to the problem whose id is 1.
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:
Show student ids who are female and play football.
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = 'Football'


Question:
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
Additional table information: table: flight_company

Answer: SELECT vehicle_flight_number, date, pilot FROM flight ORDER BY altitude ASC NULLS FIRST


Question:
What instrument is used the most?
Additional table information: table: music_2

Answer: SELECT instrument FROM instruments GROUP BY instrument ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the id and name of customers whose address contains WY state and do not use credit card for payment.
Additional table information: table: department_store

Answer: SELECT customer_id, customer_name FROM customers WHERE customer_address LIKE '%WY%' AND payment_method_code <> 'Credit Card'


Question:
How many distinct birth places are there?
Additional table information: table: body_builder

Answer: SELECT COUNT(DISTINCT Birth_Place) FROM people


Question:
Find the average unit price of tracks from the Rock genre.
Additional table information: table: chinook_1

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


Question:
Find the names of the students who are in the position of striker and got a yes tryout decision.
Additional table information: table: soccer_2

Answer: SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker'


Question:
What are the names of players whose training hours is between 500 and 1500?
Additional table information: table: soccer_2

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


Question:
List the state in the US with the most invoices.
Additional table information: table: store_1

Answer: SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the type of the services in alphabetical order.
Additional table information: table: local_govt_in_alabama

Answer: SELECT service_type_code FROM services ORDER BY service_type_code NULLS FIRST


Question:
find the names of people who are taller than 200 or lower than 190.
Additional table information: table: candidate_poll

Answer: SELECT name FROM people WHERE height > 200 OR height < 190


Question:
What is the date of birth for the staff member named Janessa Sawayn?
Additional table information: table: driving_school

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


Question:
What are the names of all instructors in the Comp. Sci. department?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.'


Question:
What are the last names of students studying major 50?
Additional table information: table: voter_2

Answer: SELECT LName FROM STUDENT WHERE Major = 50


Question:
Find number of products which Sony does not make.
Additional table information: table: manufactory_1

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


Question:
Find the total population of the top 3 districts with the largest area.
Additional table information: table: store_product

Answer: SELECT SUM(city_population) FROM district ORDER BY city_area DESC LIMIT 3


Question:
Show all the distinct product names with price higher than the average.
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Find the average age of students living in each dorm and the name of dorm.
Additional table information: table: dorm_1

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


Question:
How many leagues are there in England?
Additional table information: table: soccer_1

Answer: SELECT COUNT(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = 'England'


Question:
How many languages are in these films?
Additional table information: table: sakila_1

Answer: SELECT COUNT(DISTINCT language_id) FROM film


Question:
Which problems were reported by the staff named Dameon Frami or Jolie Weber? Give me the ids of the problems.
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:
Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance.
Additional table information: table: small_bank_1

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


Question:
How many gymnasts are from each hometown?
Additional table information: table: gymnast

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


Question:
Find the total amount of loans provided by bank branches in the state of New York.
Additional table information: table: loan_1

Answer: SELECT SUM(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York'


Question:
Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.
Additional table information: table: college_3

Answer: SELECT T2.Dname, T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = 'INTRODUCTION TO COMPUTER SCIENCE'


Question:
What are the open dates and years for the shop named Apple?
Additional table information: table: device

Answer: SELECT Open_Date, Open_Year FROM shop WHERE Shop_Name = 'Apple'


Question:
Find the name and checking balance of the account with the lowest saving balance.
Additional table information: table: small_bank_1

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


Question:
Find the names of procedures which physician John Wen was trained in.
Additional table information: table: hospital_1

Answer: 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:
What is the average and total transaction amount?
Additional table information: table: customers_card_transactions

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


Question:
What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'


Question:
Give me ids for all the trip that took place in a zip code area with average mean temperature above 60.
Additional table information: table: bike_1

Answer: SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60


Question:
Which film has the highest rental rate? And what is the rate?
Additional table information: table: sakila_1

Answer: SELECT title, rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1


Question:
Show the delegates and the names of county they belong to.
Additional table information: table: election

Answer: SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District


Question:
What are the names of all directors who have made one movie except for the director named NULL?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie WHERE director <> 'null' GROUP BY director HAVING COUNT(*) = 1


Question:
List the type of bed and name of all traditional rooms.
Additional table information: table: inn_1

Answer: SELECT roomName, bedType FROM Rooms WHERE decor = 'traditional'


Question:
What is the language that was used most often in songs with resolution above 500?
Additional table information: table: music_1

Answer: SELECT artist_name FROM song WHERE resolution > 500 GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which cities have 2 to 4 parks?
Additional table information: table: baseball_1

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


Question:
How many medicines are offered by each trade name?
Additional table information: table: medicine_enzyme_interaction

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


Question:
What are the names and buildings of the deparments, sorted by budget descending?
Additional table information: table: college_2

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


Question:
What are the catalog entry names of the products with next entry ID above 8?
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8


Question:
What is each customer's move in date, and the corresponding customer id and details?
Additional table information: table: local_govt_and_lot

Answer: SELECT T2.date_moved_in, T1.customer_id, T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id


Question:
List roles that have more than one employee. List the role description and number of employees.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Roles.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1


Question:
What are the maximum scores the team Boston Red Stockings got when the team won in postseason?
Additional table information: table: baseball_1

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


Question:
What is the school color of the school with the largest enrollment?
Additional table information: table: school_player

Answer: SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1


Question:
Find the country that has the most stadiums.
Additional table information: table: swimming

Answer: SELECT country FROM stadium GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many students have cat allergies?
Additional table information: table: allergy_1

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


Question:
How many sports do we have?
Additional table information: table: game_1

Answer: SELECT COUNT(DISTINCT sportname) FROM Sportsinfo


Question:
For each director, what are the titles and ratings for all the movies they reviewed?
Additional table information: table: movie_1

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


Question:
What are the classes of races that have two or more corresponding races?
Additional table information: table: race_track

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


Question:
What are the names of the ships that are not from the United States?
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship WHERE Nationality <> 'United States'


Question:
What is the description of the club 'Pen and Paper Gaming'?
Additional table information: table: club_1

Answer: SELECT clubdesc FROM club WHERE clubname = 'Pen and Paper Gaming'


Question:
Which member names corresponding to members who are not in the Progress Party?
Additional table information: table: party_people

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


Question:
Show different tourist attractions' names, ids, and the corresponding number of visits.
Additional table information: table: cre_Theme_park

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


Question:
What is the country of the airport with the highest elevation?
Additional table information: table: flight_4

Answer: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1


Question:
What are the ids and details of all statements?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT STATEMENT_ID, statement_details FROM Statements


Question:
Which marketing region has the most drama workshop groups? Give me the region code.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Marketing_Region_Code FROM Drama_Workshop_Groups GROUP BY Marketing_Region_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the first name and gender of the students who have allergy to milk but can put up with cats?
Additional table information: table: allergy_1

Answer: SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Milk' EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = 'Cat')


Question:
Count the number of female Professors we have.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Sex = 'F' AND Rank = 'Professor'


Question:
Find the number of distinct stages in claim processing.
Additional table information: table: insurance_and_eClaims

Answer: SELECT COUNT(*) FROM claims_processing_stages


Question:
What is the type of the document whose description starts with the word 'Initial'?
Additional table information: table: tracking_grants_for_research

Answer: SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%'


Question:
Which districts have at least two addresses?
Additional table information: table: sakila_1

Answer: SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2


Question:
What is the least common faculty rank?
Additional table information: table: college_3

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


Question:
Find the zip code in which the average mean visibility is lower than 10.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10


Question:
What is the average fee on a CSU campus in 2005?
Additional table information: table: csu_1

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


Question:
Which city does has most number of customers?
Additional table information: table: driving_school

Answer: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC LIMIT 1


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

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


Question:
What are the names of instructors who didn't teach?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches)


Question:
Find the state and country of all cities with post code starting with 4.
Additional table information: table: customers_and_addresses

Answer: SELECT state_province_county, country FROM addresses WHERE zip_postcode LIKE '4%'


Question:
Which guests have apartment bookings with status code 'Confirmed'? Return their first names and last names.
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:
Find the name of captains whose rank are either Midshipman or Lieutenant.
Additional table information: table: ship_1

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


Question:
List the project details of the projects which did not hire any staff for a researcher role.
Additional table information: table: tracking_grants_for_research

Answer: SELECT project_details FROM Projects WHERE NOT project_id IN (SELECT project_id FROM Project_Staff WHERE role_code = 'researcher')


Question:
Find the names of the items that did not receive any review.
Additional table information: table: epinions_1

Answer: SELECT title FROM item WHERE NOT i_id IN (SELECT i_id FROM review)


Question:
What are the campuses that had between 600 and 1000 faculty members in 2004?
Additional table information: table: csu_1

Answer: SELECT T1.campus FROM campuses AS t1 JOIN faculty AS t2 ON t1.id = t2.campus WHERE t2.faculty >= 600 AND t2.faculty <= 1000 AND T1.year = 2004


Question:
What is the total number of clubs that have less than 10 medals in total?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club_rank WHERE Total < 10


Question:
Show the names of editors of age either 24 or 25.
Additional table information: table: journal_committee

Answer: SELECT Name FROM editor WHERE Age = 24 OR Age = 25


Question:
List name, dates active, and number of deaths for all storms with at least 1 death.
Additional table information: table: storm_record

Answer: SELECT name, dates_active, number_deaths FROM storm WHERE number_deaths >= 1


Question:
find the name of driver who is driving the school bus with the longest working history.
Additional table information: table: school_bus

Answer: SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1


Question:
Which job titles correspond to jobs with salaries over 9000?
Additional table information: table: hr_1

Answer: SELECT job_title FROM jobs WHERE min_salary > 9000


Question:
What is the maximum and mininum number of stars a rating can receive?
Additional table information: table: movie_1

Answer: SELECT MAX(stars), MIN(stars) FROM Rating


Question:
Give the class of races that is most common.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of students who did not enroll in any course.
Additional table information: table: e_learning

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


Question:
What are the name and phone of the customer with the most ordered product quantity?
Additional table information: table: customers_and_products_contacts

Answer: SELECT T1.customer_name, T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY SUM(T3.order_quantity) DESC LIMIT 1


Question:
How many faculty members do we have for each rank and gender?
Additional table information: table: activity_1

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


Question:
Which cities have higher temperature in Feb than in Jun or have once served as host cities?
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city


Question:
Show the id and salary of Mark Young.
Additional table information: table: flight_1

Answer: SELECT eid, salary FROM Employee WHERE name = 'Mark Young'


Question:
Show the minimum, maximum, average price for all products.
Additional table information: table: customers_and_products_contacts

Answer: SELECT MIN(product_price), MAX(product_price), AVG(product_price) FROM products


Question:
List the ids, names and market shares of all browsers.
Additional table information: table: browser_web

Answer: SELECT id, name, market_share FROM browser


Question:
What are the albums produced in year 2010?
Additional table information: table: music_2

Answer: SELECT * FROM Albums WHERE YEAR = 2010


Question:
What is the phone number of the performer Ashley?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = 'Ashley'


Question:
How many events are there for each party?
Additional table information: table: party_people

Answer: SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id


Question:
Show the membership level with most number of members.
Additional table information: table: shop_membership

Answer: SELECT LEVEL FROM member GROUP BY LEVEL ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the average enrollment number?
Additional table information: table: soccer_2

Answer: SELECT AVG(enr) FROM College


Question:
Find the room number of the rooms which can sit 50 to 100 students and their buildings.
Additional table information: table: college_2

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


Question:
What are the songs in volumes that have resulted in a nomination at music festivals?
Additional table information: table: music_4

Answer: SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = 'Nominated'


Question:
How many different roles are there 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 student ids for all male students?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE Sex = 'M'


Question:
What are the names of teams that do no have match season record?
Additional table information: table: match_season

Answer: SELECT Name FROM team WHERE NOT Team_id IN (SELECT Team FROM match_season)


Question:
Show all publishers which do not have a book in 1989.
Additional table information: table: culture_company

Answer: SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989


Question:
What are the names of artists who are Male and are from UK?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' AND gender = 'Male'


Question:
What are the names of colleges in LA that have more than 15,000 students and of colleges in AZ with less than 13,000 students?
Additional table information: table: soccer_2

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


Question:
How many restaurant is the Sandwich type restaurant?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'


Question:
Find the number of rooms with more than 50 capacity for each building.
Additional table information: table: college_2

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


Question:
What are the card numbers of members from Kentucky?
Additional table information: table: shop_membership

Answer: SELECT card_number FROM member WHERE Hometown LIKE '%Kentucky%'


Question:
What are the emails and phone numbers of all customers, sorted by email address and phone number?
Additional table information: table: customer_complaints

Answer: SELECT email_address, phone_number FROM customers ORDER BY email_address NULLS FIRST, phone_number NULLS FIRST


Question:
How many products have the color description 'red' and the characteristic name 'slow'?
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = 'red' AND t3.characteristic_name = 'slow'


Question:
Which schools do not have any player? Give me the school locations.
Additional table information: table: school_player

Answer: SELECT LOCATION FROM school WHERE NOT School_ID IN (SELECT School_ID FROM Player)


Question:
Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
Additional table information: table: game_1

Answer: SELECT lname, sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = 'Call of Destiny' INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = 'Works of Widenius')


Question:
What is the most common amenity in the dorms?
Additional table information: table: dorm_1

Answer: SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY COUNT(*) DESC LIMIT 1


Question:
List all info about all people.
Additional table information: table: candidate_poll

Answer: SELECT * FROM people


Question:
How many registed students do each course have? List course name and the number of their registered students?
Additional table information: table: student_assessment

Answer: SELECT T3.course_name, COUNT(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id


Question:
For each payment method, how many payments were made?
Additional table information: table: driving_school

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


Question:
How many times does ROY SWEAZY has reserved a room.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
Find courses that ran in Fall 2009 and in Spring 2010.
Additional table information: table: college_2

Answer: SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 INTERSECT SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010


Question:
What are the names of all movies that were 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:
List the customer event id and the corresponding move in date and property id.
Additional table information: table: local_govt_and_lot

Answer: SELECT customer_event_id, date_moved_in, property_id FROM customer_events


Question:
Find names and times of trains that run through stations for the local authority Chiltern.
Additional table information: table: station_weather

Answer: SELECT t3.name, t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = 'Chiltern'


Question:
Show all the distinct buildings that have faculty rooms.
Additional table information: table: activity_1

Answer: SELECT DISTINCT building FROM Faculty


Question:
Find the most prominent max page size among all the products.
Additional table information: table: store_product

Answer: SELECT max_page_size FROM product GROUP BY max_page_size ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the origins from which more than 1 train starts.
Additional table information: table: station_weather

Answer: SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1


Question:
How many kinds of different ratings are listed?
Additional table information: table: sakila_1

Answer: SELECT COUNT(DISTINCT rating) FROM film


Question:
How many camera lenses are not used in taking any photos?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(*) FROM camera_lens WHERE NOT id IN (SELECT camera_lens_id FROM photos)


Question:
What are all company names that have a corresponding movie directed in the year 1999?
Additional table information: table: culture_company

Answer: SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999


Question:
Find the first name of students who is older than 20.
Additional table information: table: dorm_1

Answer: SELECT fname FROM student WHERE age > 20


Question:
List the names of wrestlers and the teams in elimination in descending order of days held.
Additional table information: table: wrestler

Answer: SELECT T2.Name, T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC


Question:
How many assessment notes are there in total?
Additional table information: table: behavior_monitoring

Answer: SELECT COUNT(*) FROM ASSESSMENT_NOTES


Question:
List the themes of parties in ascending order of number of hosts.
Additional table information: table: party_host

Answer: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC NULLS FIRST


Question:
Find the name of project that continues for the longest time.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects ORDER BY hours DESC LIMIT 1


Question:
Show the census ranking of cities whose status are not 'Village'.
Additional table information: table: farm

Answer: SELECT Census_Ranking FROM city WHERE Status <> 'Village'


Question:
How many airports are there per country? Order the countries by decreasing number of airports.
Additional table information: table: flight_4

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


Question:
What are the names of all of Bob's friends?
Additional table information: table: network_2

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


Question:
Show the official names of the cities that have hosted more than one competition.
Additional table information: table: farm

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


Question:
Please list all album titles in alphabetical order.
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM ORDER BY Title NULLS FIRST


Question:
Find id of the candidate whose email is stanley.monahan@example.org?
Additional table information: table: student_assessment

Answer: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = 'stanley.monahan@example.org'


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

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


Question:
What are the procedures that cost more than 1000 or are specialized in by physician John Wen?
Additional table information: table: hospital_1

Answer: SELECT name FROM procedures WHERE cost > 1000 UNION 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:
What are the different regions of clubs in ascending alphabetical order?
Additional table information: table: sports_competition

Answer: SELECT DISTINCT Region FROM club ORDER BY Region ASC NULLS FIRST


Question:
What is the the phone number of Nancy Edwards?
Additional table information: table: store_1

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


Question:
Return the different countries for artists.
Additional table information: table: theme_gallery

Answer: SELECT DISTINCT country FROM artist


Question:
Find the name of all customers.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers


Question:
What is the race class with most number of races.
Additional table information: table: race_track

Answer: SELECT CLASS FROM race GROUP BY CLASS ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names, classes, and ranks of all captains?
Additional table information: table: ship_1

Answer: SELECT name, CLASS, rank FROM captain


Question:
How many different FDA approval statuses exist for medicines?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(DISTINCT FDA_approved) FROM medicine


Question:
Which student are enrolled in at least two courses? Give me the student ID and personal name.
Additional table information: table: e_learning

Answer: SELECT T1.student_id, T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2


Question:
Who performed the song named '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'


Question:
Show the company name and the main industry for all companies whose headquarters are not from USA.
Additional table information: table: gas_company

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


Question:
What are the names of actors who are not 20 years old?
Additional table information: table: musical

Answer: SELECT Name FROM actor WHERE Age <> 20


Question:
Give me the star rating descriptions of the hotels that cost more than 10000.
Additional table information: table: cre_Theme_park

Answer: SELECT T2.star_rating_description FROM HOTELS AS T1 JOIN Ref_Hotel_Star_Ratings AS T2 ON T1.star_rating_code = T2.star_rating_code WHERE T1.price_range > 10000


Question:
Give me the start station and end station for the trips with the three oldest id.
Additional table information: table: bike_1

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


Question:
What are the names of all students who successfully tried out for the position of striker?
Additional table information: table: soccer_2

Answer: SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker'


Question:
Which employees do not authorize destruction for any document? Give me their employee ids.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
List the 3 highest salaries of the players in 2001?
Additional table information: table: baseball_1

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


Question:
Return the characters for actors, ordered by age descending.
Additional table information: table: musical

Answer: SELECT Character FROM actor ORDER BY age DESC


Question:
How many members are there?
Additional table information: table: decoration_competition

Answer: SELECT COUNT(*) FROM member


Question:
What are the schools that were either founded before 1850 or are public?
Additional table information: table: university_basketball

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


Question:
What are the names of customers who never made an order.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id


Question:
List the names of technicians in ascending order of age.
Additional table information: table: machine_repair

Answer: SELECT Name FROM technician ORDER BY Age ASC NULLS FIRST


Question:
What are the names of all movies that received 3 or 4 stars?
Additional table information: table: movie_1

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


Question:
For each city, return the highest latitude among its stations.
Additional table information: table: bike_1

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


Question:
What are names of stations that have average bike availability above 10 and are not located in San Jose city?
Additional table information: table: bike_1

Answer: SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = 'San Jose'


Question:
How many companies were created by Andy?
Additional table information: table: manufactory_1

Answer: SELECT COUNT(*) FROM manufacturers WHERE founder = 'Andy'


Question:
Find the name and address of the customers who have both New and Pending orders.
Additional table information: table: department_store

Answer: SELECT T1.customer_name, T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'New' INTERSECT SELECT T1.customer_name, T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Pending'


Question:
Show the party that has the most people.
Additional table information: table: debate

Answer: SELECT Party FROM people GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the maximum level of managers in countries that are not 'Australia'?
Additional table information: table: railway

Answer: SELECT MAX(LEVEL) FROM manager WHERE Country <> 'Australia	'


Question:
How many accounts have a savings balance above the average savings balance?
Additional table information: table: small_bank_1

Answer: SELECT COUNT(*) FROM savings WHERE balance > (SELECT AVG(balance) FROM savings)


Question:
What are the last names of staff with email addressed containing the substring 'wrau'?
Additional table information: table: customer_complaints

Answer: SELECT last_name FROM staff WHERE email_address LIKE '%wrau%'


Question:
Find the location of the club 'Pen and Paper Gaming'.
Additional table information: table: club_1

Answer: SELECT clublocation FROM club WHERE clubname = 'Pen and Paper Gaming'


Question:
Who are the members of the club named 'Hopkins Student Enterprises'? Show the last name.
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 = 'Hopkins Student Enterprises'


Question:
Count the number of authors.
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM authors


Question:
What are the names of representatives with more than 10000 votes in election?
Additional table information: table: election_representative

Answer: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000


Question:
What is the address for the customer with id 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:
How many movie directors are there?
Additional table information: table: culture_company

Answer: SELECT COUNT(DISTINCT director) FROM movie


Question:
What are the names of customers who have taken both Mortgage and Auto loans?
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE loan_type = 'Auto'


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

Answer: SELECT COUNT(DISTINCT class_code) FROM CLASS


Question:
How many addresses are there in country USA?
Additional table information: table: customers_and_products_contacts

Answer: SELECT COUNT(*) FROM addresses WHERE country = 'USA'


Question:
Find the first name and major of the students who are not allegry to soy.
Additional table information: table: allergy_1

Answer: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = 'Soy')


Question:
Return the ids of documents that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
Find the number of checking accounts for each account name.
Additional table information: table: small_bank_1

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


Question:
List the addresses of all the course authors or tutors.
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors


Question:
Find the first names of all professors in the Accounting department who is teaching some course and the class room.
Additional table information: table: college_1

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


Question:
Show the musical nominee with award 'Bob Fosse' or 'Cleavant Derricks'.
Additional table information: table: musical

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


Question:
Who has written a paper that has the word 'Functional' in its title? Return the first names of the authors.
Additional table information: table: icfp_1

Answer: SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE '%Functional%'


Question:
List the company name and rank for all companies in the decreasing order of their sales.
Additional table information: table: gas_company

Answer: SELECT company, rank FROM company ORDER BY Sales_billion DESC


Question:
Show all sport name and the number of students.
Additional table information: table: game_1

Answer: SELECT sportname, COUNT(*) FROM Sportsinfo GROUP BY sportname


Question:
For each zip code, what is the average mean temperature for all dates that start with '8'?
Additional table information: table: bike_1

Answer: SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE '8/%' GROUP BY zip_code


Question:
Show the names of aircrafts that are associated with both an airport named 'London Heathrow' and an airport named '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 Heathrow' INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = 'London Gatwick'


Question:
How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?
Additional table information: table: baseball_1

Answer: SELECT SUM(T1.games) 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 1990 AND 2000


Question:
Please show the team that has the most number of technicians.
Additional table information: table: machine_repair

Answer: SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1


Question:
List all the dates of enrollment and completion of students.
Additional table information: table: e_learning

Answer: SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment


Question:
How many transactions correspond to each invoice number?
Additional table information: table: customers_and_invoices

Answer: SELECT invoice_number, COUNT(*) FROM Financial_transactions GROUP BY invoice_number


Question:
Show the most common type code across products.
Additional table information: table: solvency_ii

Answer: SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What products are sold at the store named Miramichi?
Additional table information: table: store_product

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


Question:
How many different status codes of things are there?
Additional table information: table: local_govt_and_lot

Answer: SELECT COUNT(DISTINCT Status_of_Thing_Code) FROM Timed_Status_of_Things


Question:
Find the name of customer who has the highest amount of loans.
Additional table information: table: loan_1

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


Question:
What are the first names of students, ordered by age from greatest to least?
Additional table information: table: college_3

Answer: SELECT Fname FROM STUDENT ORDER BY Age DESC


Question:
Find the distinct driver id and the stop number of all drivers that have a shorter pit stop duration than some drivers 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:
List all the information about course authors and tutors in alphabetical order of the personal name.
Additional table information: table: e_learning

Answer: SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name NULLS FIRST


Question:
What are the names of the people who have no friends who are students?
Additional table information: table: network_2

Answer: SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student'


Question:
Sort the company names in descending order of the company's market value.
Additional table information: table: company_office

Answer: SELECT name FROM Companies ORDER BY Market_Value_billion DESC


Question:
What are the ids and full names of customers who hold two or more cards?
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2


Question:
Show the party with drivers from Hartford and drivers older than 40.
Additional table information: table: school_bus

Answer: SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40


Question:
What is the name of the course that has the most student enrollment?
Additional table information: table: e_learning

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


Question:
How old is each student and how many students are each age?
Additional table information: table: allergy_1

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


Question:
Find the names of the channels that are broadcast in the morning.
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'


Question:
Which buildings do not have any company office? Give me the building names.
Additional table information: table: company_office

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


Question:
What are the names of catalog entries with level number 8?
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.catalog_level_number = '8'


Question:
For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Regular' INTERSECT SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Initial Application'


Question:
What are the majors of male (sex is M) students?
Additional table information: table: voter_2

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


Question:
how many female dependents are there?
Additional table information: table: company_1

Answer: SELECT COUNT(*) FROM dependent WHERE sex = 'F'


Question:
Show all city with a branch opened in 2001 and a branch with more than 100 membership.
Additional table information: table: shop_membership

Answer: SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100


Question:
What are the GDP and population of the city that already served as a host more than once?
Additional table information: table: city_record

Answer: SELECT t1.gdp, t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING COUNT(*) > 1


Question:
Show the names of all the clients with no booking.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Customer_Name FROM Clients EXCEPT SELECT T2.Customer_Name FROM Bookings AS T1 JOIN Clients AS T2 ON T1.Customer_ID = T2.Client_ID


Question:
Show all distinct region names ordered by their labels.
Additional table information: table: party_people

Answer: SELECT DISTINCT region_name FROM region ORDER BY Label NULLS FIRST


Question:
What is the maximum and minimum height of all players?
Additional table information: table: soccer_1

Answer: SELECT MAX(weight), MIN(weight) FROM Player


Question:
What is the installation date for each ending station on all the trips?
Additional table information: table: bike_1

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


Question:
Find the id and local authority of the station whose maximum precipitation is higher than 50.
Additional table information: table: station_weather

Answer: SELECT t2.id, t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING MAX(t1.precipitation) > 50


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

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


Question:
Find the number of routes operated by American Airlines.
Additional table information: table: flight_4

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


Question:
What are the names for tracks without a race in class 'GT'.
Additional table information: table: race_track

Answer: SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'


Question:
List the name of film studio that have the most number of films.
Additional table information: table: film_rank

Answer: SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the poll resource associated with the most candidates.
Additional table information: table: candidate_poll

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


Question:
What is the first name, GPA, and phone number of the students with the top 5 GPAs?
Additional table information: table: college_1

Answer: SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5


Question:
Find the captain rank that has no captain in Third-rate ship of the line class.
Additional table information: table: ship_1

Answer: SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'


Question:
Please show the most common age of editors.
Additional table information: table: journal_committee

Answer: SELECT Age FROM editor GROUP BY Age ORDER BY COUNT(*) DESC LIMIT 1


Question:
display the department name and number of employees in each of the department.
Additional table information: table: hr_1

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


Question:
List the names of players in ascending order of votes.
Additional table information: table: riding_club

Answer: SELECT Player_name FROM player ORDER BY Votes ASC NULLS FIRST


Question:
How many distinct currency codes are there for all drama workshop groups?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT COUNT(DISTINCT Currency_Code) FROM Drama_Workshop_Groups


Question:
Which products have problems reported by both the staff named Lacey Bosco and the staff named Kenton Champlin?
Additional table information: table: tracking_software_problems

Answer: SELECT T2.product_name FROM problems AS T1, product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = 'Lacey' AND T3.staff_last_name = 'Bosco' INTERSECT SELECT T2.product_name FROM problems AS T1, product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T3.staff_first_name = 'Kenton' AND T3.staff_last_name = 'Champlin'


Question:
How many different cities do have some airport in the country of Greenland?
Additional table information: table: flight_4

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


Question:
How many customers are there in the customer type with the most customers?
Additional table information: table: customer_complaints

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


Question:
Give the address of the staff member who has the first name Elsa.
Additional table information: table: sakila_1

Answer: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'


Question:
What is the average price of wines produced in appelations in Sonoma County?
Additional table information: table: wine_1

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


Question:
What is the total number of hours for all projects?
Additional table information: table: scientist_1

Answer: SELECT SUM(hours) FROM projects


Question:
Which gender makes up the majority of the staff?
Additional table information: table: assets_maintenance

Answer: SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number of patients' prescriptions physician John Dorian made.
Additional table information: table: hospital_1

Answer: SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = 'John Dorian'


Question:
What are the names of manufacturers with revenue greater than the average of all revenues?
Additional table information: table: manufactory_1

Answer: SELECT name FROM manufacturers WHERE revenue > (SELECT AVG(revenue) FROM manufacturers)


Question:
Show the budget type code and description and the corresponding document id.
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:
Show id, first and last names for all customers with at least two cards.
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) >= 2


Question:
What is the reviewer name, film title, movie rating, and rating date  for every movie ordered by reviewer name, movie title, then finally rating?
Additional table information: table: movie_1

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


Question:
What are the ids of the problems that are from the product 'voluptatem' and are reported after 1995?
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id WHERE T2.product_name = 'voluptatem' AND T1.date_problem_reported > '1995'