Question:
Return the weights of entrepreneurs, ordered descending by amount of money requested.
Additional table information: table: entrepreneur

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


Question:
Show all role codes with at least 3 employees.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_code FROM Employees GROUP BY role_code HAVING COUNT(*) >= 3


Question:
Which friend of Zach has the longest-lasting friendship?
Additional table information: table: network_2

Answer: SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')


Question:
Show the countries that have managers of age above 50 or below 46.
Additional table information: table: railway

Answer: SELECT Country FROM manager WHERE Age > 50 OR Age < 46


Question:
What was the most popular position at tryouts?
Additional table information: table: soccer_2

Answer: SELECT pPos FROM tryout GROUP BY pPos ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the code of the course which the student whose last name is Smithson took?
Additional table information: table: college_1

Answer: SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'


Question:
What is the area of the appelation that produces the highest number of wines before the year of 2010?
Additional table information: table: wine_1

Answer: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING T2.year < 2010 ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the snatch score and clean jerk score of body builders in ascending order of snatch score.
Additional table information: table: body_builder

Answer: SELECT Snatch, Clean_Jerk FROM body_builder ORDER BY Snatch ASC NULLS FIRST


Question:
Find the number of distinct courses that have enrolled students.
Additional table information: table: e_learning

Answer: SELECT COUNT(course_id) FROM Student_Course_Enrolment


Question:
What are the different positions for match season?
Additional table information: table: match_season

Answer: SELECT DISTINCT POSITION FROM match_season


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

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


Question:
Count the number of submissions.
Additional table information: table: workshop_paper

Answer: SELECT COUNT(*) FROM submission


Question:
What is the total student capacity of all dorms?
Additional table information: table: dorm_1

Answer: SELECT SUM(student_capacity) FROM dorm


Question:
Show the names of members whose country is 'United States' or 'Canada'.
Additional table information: table: decoration_competition

Answer: SELECT Name FROM member WHERE Country = 'United States' OR Country = 'Canada'


Question:
Who are all the directors?
Additional table information: table: cinema

Answer: SELECT DISTINCT directed_by FROM film


Question:
Find the names of the artists who are from Bangladesh and have never received rating higher than 7.
Additional table information: table: music_1

Answer: SELECT DISTINCT artist_name FROM artist WHERE country = 'Bangladesh' EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7


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

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


Question:
What are the hosts of competitions whose theme is not 'Aliens'?
Additional table information: table: farm

Answer: SELECT Hosts FROM farm_competition WHERE Theme <> 'Aliens'


Question:
What are the statement id and statement detail for the statement that has the most corresponding accounts?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids of all students for courses and what are the names of those courses?
Additional table information: table: student_assessment

Answer: SELECT T1.student_id, T2.course_name FROM student_course_registrations AS T1 JOIN courses AS T2 ON T1.course_id = T2.course_id


Question:
List the names of climbers whose country is not Switzerland.
Additional table information: table: climbing

Answer: SELECT Name FROM climber WHERE Country <> 'Switzerland'


Question:
What are the different ship flags, and how many ships have each?
Additional table information: table: ship_1

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


Question:
What are the names of storms that did not affect any regions?
Additional table information: table: storm_record

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


Question:
What is the headquarter of the company with the largest sales?
Additional table information: table: company_employee

Answer: SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1


Question:
Find the names of all the customers and staff members.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers UNION SELECT staff_details FROM staff


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

Answer: SELECT COUNT(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Pen and Paper Gaming'


Question:
For each zip code, return how many times max wind speed reached 25?
Additional table information: table: bike_1

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


Question:
how many ships are there?
Additional table information: table: ship_1

Answer: SELECT COUNT(*) FROM ship


Question:
What are the student ID and login name of the student who are enrolled in the most courses?
Additional table information: table: e_learning

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


Question:
What are the distinct last names of the students who have president votes but do not have 2192 as the advisor?
Additional table information: table: voter_2

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


Question:
Give me a list of all the channel names sorted by the channel rating in descending order.
Additional table information: table: program_share

Answer: SELECT name FROM channel ORDER BY rating_in_percent DESC


Question:
For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description.
Additional table information: table: assets_maintenance

Answer: SELECT T1.fault_short_name, T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id


Question:
Show the names and heights of buildings with at least two institutions founded after 1880.
Additional table information: table: protein_institute

Answer: SELECT T1.name, T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded > 1880 GROUP BY T1.building_id HAVING COUNT(*) >= 2


Question:
What are the different statement ids on accounts, and the number of accounts for each?
Additional table information: table: cre_Docs_and_Epenses

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


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

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


Question:
List the name and number of followers for each user, and sort the results by the number of followers in descending order.
Additional table information: table: twitter_1

Answer: SELECT name, followers FROM user_profiles ORDER BY followers DESC


Question:
What are the medicine and trade names that can interact as an inhibitor and activitor with enzymes?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'


Question:
Show the name for regions 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:
Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
Additional table information: table: customers_and_addresses

Answer: SELECT address_content FROM addresses WHERE city = 'East Julianaside' AND state_province_county = 'Texas' UNION SELECT address_content FROM addresses WHERE city = 'Gleasonmouth' AND state_province_county = 'Arizona'


Question:
Give the order ids for all orders, as well as the total product quantity in each.
Additional table information: table: customers_and_invoices

Answer: SELECT order_id, SUM(product_quantity) FROM Order_items GROUP BY order_id


Question:
What city does the employee who helps the customer with postal code 70174 live in?
Additional table information: table: chinook_1

Answer: SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'


Question:
How many faculty lines are there in the university that conferred the least number of degrees in year 2001?
Additional table information: table: csu_1

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


Question:
List the names of companies by ascending number of sales.
Additional table information: table: company_employee

Answer: SELECT Name FROM company ORDER BY Sales_in_Billion ASC NULLS FIRST


Question:
Show the average price range of hotels that have 5 star ratings and allow pets.
Additional table information: table: cre_Theme_park

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


Question:
What are the maximum fastest lap speed in races held after 2004 grouped by race name and ordered by year?
Additional table information: table: formula_1

Answer: SELECT MAX(T2.fastestlapspeed), T1.name, T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year NULLS FIRST


Question:
What is the most common hometown of gymnasts?
Additional table information: table: gymnast

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


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

Answer: SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1


Question:
Show all artist names with an average exhibition attendance over 200.
Additional table information: table: theme_gallery

Answer: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING AVG(T1.attendance) > 200


Question:
What is the total revenue of companies with revenue greater than the lowest revenue of any manufacturer in Austin?
Additional table information: table: manufactory_1

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


Question:
Return the issue dates of volumes by artists who are at most 23 years old?
Additional table information: table: music_4

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


Question:
List the names of people that are not entrepreneurs.
Additional table information: table: entrepreneur

Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM entrepreneur)


Question:
How many tasks are there in total?
Additional table information: table: tracking_grants_for_research

Answer: SELECT COUNT(*) FROM Tasks


Question:
Which course author teaches the 'advanced database' course? Give me his or her login name.
Additional table information: table: e_learning

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


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

Answer: SELECT COUNT(DISTINCT StuID) FROM Plays_games


Question:
Find the name and age of all males in order of their age.
Additional table information: table: network_2

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


Question:
find all dependent names who have a spouse relation with some employee.
Additional table information: table: company_1

Answer: SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse'


Question:
What is the name of tracks whose genre is Rock?
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'


Question:
How many professors have a Ph.D. in each department?
Additional table information: table: college_1

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


Question:
Return the distinct name of customers whose order status is Pending, in the order of customer id.
Additional table information: table: department_store

Answer: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Pending' ORDER BY T2.customer_id NULLS FIRST


Question:
Return the names of entrepreneurs do no not have the investor Rachel Elnaugh.
Additional table information: table: entrepreneur

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


Question:
What is the code of each role and the number of employees in each role?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_code, COUNT(*) FROM Employees GROUP BY role_code


Question:
Which assets did not incur any fault log? List the asset model.
Additional table information: table: assets_maintenance

Answer: SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log)


Question:
What is the average quantities ordered with payment method code 'MasterCard' on invoices?
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Show all headquarters without a company in banking industry.
Additional table information: table: gas_company

Answer: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'


Question:
Who are the players that have names containing the letter a?
Additional table information: table: soccer_2

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


Question:
What are the customer phone numbers under the policy 'Life Insurance'?
Additional table information: table: insurance_fnol

Answer: SELECT customer_phone FROM available_policies WHERE policy_type_code = 'Life Insurance'


Question:
Find the name and level of catalog structure with level between 5 and 10.
Additional table information: table: product_catalog

Answer: SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10


Question:
Show all product names and the number of customers having an order on each product.
Additional table information: table: customers_and_invoices

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


Question:
Return the account details with the greatest value, as well as those that include the character 5.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT MAX(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE '%5%'


Question:
What is the number of employees?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Employee


Question:
Show each location and the number of cinemas there.
Additional table information: table: cinema

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


Question:
Show all student ids who are older than 20.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age > 20


Question:
How many female people are older than 30 in our record?
Additional table information: table: wedding

Answer: SELECT COUNT(*) FROM people WHERE is_male = 'F' AND age > 30


Question:
What is the location of the festival with the largest number of audience?
Additional table information: table: entertainment_awards

Answer: SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1


Question:
What are the themes and locations of parties?
Additional table information: table: party_host

Answer: SELECT Party_Theme, LOCATION FROM party


Question:
Show the names of mountains with height more than 5000 or prominence more than 1000.
Additional table information: table: climbing

Answer: SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000


Question:
Count the number of artists.
Additional table information: table: music_4

Answer: SELECT COUNT(*) FROM artist


Question:
Show the most common nationality of hosts.
Additional table information: table: party_host

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


Question:
Find the job ID for those jobs which average salary is above 8000.
Additional table information: table: hr_1

Answer: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000


Question:
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
Additional table information: table: journal_committee

Answer: SELECT date, theme, sales FROM journal EXCEPT SELECT T1.date, T1.theme, T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID


Question:
Who served as an advisor for students who have treasurer votes in the spring election cycle?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = 'Spring'


Question:
What are the unique labels for the albums?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT label) FROM albums


Question:
Sort the first names of all the authors in alphabetical order.
Additional table information: table: icfp_1

Answer: SELECT fname FROM authors ORDER BY fname NULLS FIRST


Question:
What are the maximum and minimum age of students with major 600?
Additional table information: table: voter_2

Answer: SELECT MAX(Age), MIN(Age) FROM STUDENT WHERE Major = 600


Question:
What city is the headquarter of the store Blackville?
Additional table information: table: store_product

Answer: SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = 'Blackville'


Question:
How many storms occured in each region?
Additional table information: table: storm_record

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


Question:
List the distinct ranges of the mountains with the top 3 prominence.
Additional table information: table: climbing

Answer: SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3


Question:
How old are the students with allergies to food and animal types on average?
Additional table information: table: allergy_1

Answer: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'food' INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = 'animal')


Question:
Find the first names of all the authors who have written a paper with title containing the word 'Functional'.
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:
What are all the different food allergies?
Additional table information: table: allergy_1

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


Question:
How many clubs are there?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club


Question:
What are the ids and names of customers with addressed that contain WY and who do not use a 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:
display the first and last name, department, city, and state province for each employee.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province 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


Question:
Return the names of singers who are from UK and released an English song.
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english'


Question:
What is the highest acc percent score in the competition?
Additional table information: table: university_basketball

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


Question:
What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT DISTINCT T1.name, T1.location, T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'


Question:
What are the id of songs whose format is mp3.
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp3'


Question:
How many churches opened before 1850 are there?
Additional table information: table: wedding

Answer: SELECT COUNT(*) FROM Church WHERE Open_Date < 1850


Question:
List the forenames of all distinct drivers in alphabetical order?
Additional table information: table: formula_1

Answer: SELECT DISTINCT forename FROM drivers ORDER BY forename ASC NULLS FIRST


Question:
How many different projects are there?
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT name) FROM projects


Question:
What are the team and the location of school each player belongs to?
Additional table information: table: school_player

Answer: SELECT T1.Team, T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID


Question:
Return the description of the document type name 'Film'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_description FROM Ref_document_types WHERE document_type_name = 'Film'


Question:
Find the number of adults for the room reserved and checked in by CONRAD SELBIG on Oct 23, 2010.
Additional table information: table: inn_1

Answer: SELECT Adults FROM Reservations WHERE CheckIn = '2010-10-23' AND FirstName = 'CONRAD' AND LastName = 'SELBIG'


Question:
Find the first names and last names of the authors whose institution affiliation is 'University of Oxford'.
Additional table information: table: icfp_1

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


Question:
Show the product ids and the number of unique orders containing each product.
Additional table information: table: customers_and_invoices

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


Question:
What are the countries that have never participated in any friendly-type competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'


Question:
Find the average elevation of all airports for each country.
Additional table information: table: flight_4

Answer: SELECT AVG(elevation), country FROM airports GROUP BY country


Question:
Find the committees that have delegates both from from the democratic party and the liberal party.
Additional table information: table: election

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


Question:
What is the latitude, longitude, and city of the station from which the trip with smallest duration started?
Additional table information: table: bike_1

Answer: SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
What is the cell phone number of the student whose address has the lowest monthly rental?
Additional table information: table: behavior_monitoring

Answer: SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental ASC NULLS FIRST LIMIT 1


Question:
Find the name and city of the airport which is the source for the most number of flight routes.
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:
Which party has the largest number of delegates?
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids and names of accounts with 4 or more transactions?
Additional table information: table: customers_and_invoices

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


Question:
Show name and distance for all aircrafts.
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft


Question:
get the details of employees who manage a department.
Additional table information: table: hr_1

Answer: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id


Question:
Which room has the highest rate? List the room's full name, rate, check in and check out date.
Additional table information: table: inn_1

Answer: SELECT T2.roomName, T1.Rate, T1.CheckIn, T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1


Question:
Count the number of gymnasts.
Additional table information: table: gymnast

Answer: SELECT COUNT(*) FROM gymnast


Question:
List the names of all the customers in alphabetical order.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers ORDER BY customer_details NULLS FIRST


Question:
Find the distinct years when the governor was named 'Eliot Spitzer'.
Additional table information: table: election

Answer: SELECT DISTINCT YEAR FROM party WHERE Governor = 'Eliot Spitzer'


Question:
List the project details of the project both producing patent and paper as outcomes.
Additional table information: table: tracking_grants_for_research

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


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

Answer: SELECT COUNT(*), AVG(age), city_code FROM student GROUP BY city_code


Question:
What are the cities with exactly two airports?
Additional table information: table: flight_4

Answer: SELECT city FROM airports GROUP BY city HAVING COUNT(*) = 2


Question:
Show ids for all employees who don't have a certificate.
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate


Question:
What are the forenames and surnames of drivers who participated in the races named Australian Grand Prix but not the races named Chinese Grand Prix?
Additional table information: table: formula_1

Answer: SELECT T3.forename, T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = 'Australian Grand Prix' EXCEPT SELECT T3.forename, T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = 'Chinese Grand Prix'


Question:
Find the ids and names of stations from which at least 200 trips started.
Additional table information: table: bike_1

Answer: SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200


Question:
Find the names of departments that are either in division AS or in division EN and in Building NEB.
Additional table information: table: college_3

Answer: SELECT DName FROM DEPARTMENT WHERE Division = 'AS' UNION SELECT DName FROM DEPARTMENT WHERE Division = 'EN' AND Building = 'NEB'


Question:
Find the number of routes that have destination John F Kennedy International Airport.
Additional table information: table: flight_4

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


Question:
What is the name of the 3 employees who get paid the least?
Additional table information: table: flight_1

Answer: SELECT name FROM Employee ORDER BY salary ASC NULLS FIRST LIMIT 3


Question:
What is the phone number of the customer who has filed the most recent complaint?
Additional table information: table: customer_complaints

Answer: SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1


Question:
What is the name of the entrepreneur with the greatest weight?
Additional table information: table: entrepreneur

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


Question:
Give the full name and staff id of the staff who has handled the fewest payments.
Additional table information: table: sakila_1

Answer: SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the unit of measuerment of the product category code 'Herbs'?
Additional table information: table: products_gen_characteristics

Answer: SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = 'Herbs'


Question:
What are the nicknames of schools whose division is not 1?
Additional table information: table: school_player

Answer: SELECT Nickname FROM school_details WHERE Division <> 'Division 1'


Question:
What are the distinct customers who have orders with status 'On Road'? Give me the customer details?
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT T1.customer_details FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road'


Question:
Return the name of the party with the most members.
Additional table information: table: party_people

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


Question:
What is the id and name of the aircraft that can cover the maximum distance?
Additional table information: table: flight_1

Answer: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1


Question:
Show all distinct lot details.
Additional table information: table: tracking_share_transactions

Answer: SELECT DISTINCT lot_details FROM LOTS


Question:
What is the last name of the staff member in charge of the complaint on the product with the lowest price?
Additional table information: table: customer_complaints

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


Question:
What is the maximum fastest lap speed in the Monaco Grand Prix in 2008?
Additional table information: table: formula_1

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


Question:
Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Employees.employee_name, COUNT(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id, Circulation_History.draft_number, Circulation_History.copy_number ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the name of the products that have a color description 'yellow'.
Additional table information: table: products_gen_characteristics

Answer: SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'


Question:
What are the full names, departments, cities, and state provinces for each employee?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province 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


Question:
Find the names and descriptions of the photos taken at the tourist attraction called 'film festival'.
Additional table information: table: cre_Theme_park

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


Question:
What are the names of enzymes that include the string 'ALA'?
Additional table information: table: medicine_enzyme_interaction

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


Question:
What is the name of the movie that is rated by most of times?
Additional table information: table: movie_1

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


Question:
Find the names of Japanese constructors that have once earned more than 5 points?
Additional table information: table: formula_1

Answer: SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = 'Japanese' AND T2.points > 5


Question:
Which projects have no outcome? List the project details.
Additional table information: table: tracking_grants_for_research

Answer: SELECT project_details FROM Projects WHERE NOT project_id IN (SELECT project_id FROM Project_outcomes)


Question:
Which vocal type is the most frequently appearring type?
Additional table information: table: music_2

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


Question:
Return the names of all counties sorted by population in ascending order.
Additional table information: table: election

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


Question:
What are the teams with the most technicians?
Additional table information: table: machine_repair

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


Question:
How many students does LORIA ONDERSMA teaches?
Additional table information: table: student_1

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


Question:
Count the number of climbers.
Additional table information: table: climbing

Answer: SELECT COUNT(*) FROM climber


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

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


Question:
Return the names and ids of all products whose price is between 600 and 700.
Additional table information: table: department_store

Answer: SELECT product_name, product_id FROM products WHERE product_price BETWEEN 600 AND 700


Question:
List the id, country, city and name of the airports ordered alphabetically by the name.
Additional table information: table: flight_company

Answer: SELECT id, country, city, name FROM airport ORDER BY name NULLS FIRST


Question:
What is the average and maximum number of hours students who made the team practiced?
Additional table information: table: soccer_2

Answer: SELECT AVG(T1.HS), MAX(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'


Question:
Show the names of companies and the number of employees they have
Additional table information: table: company_employee

Answer: SELECT T3.Name, COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID GROUP BY T3.Name


Question:
What si the youngest employee's first and last name?
Additional table information: table: store_1

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


Question:
Give the full name and phone of the customer who has the account name 162.
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '162'


Question:
Find the department name that is in Building 'Mergenthaler'.
Additional table information: table: college_3

Answer: SELECT DName FROM DEPARTMENT WHERE Building = 'Mergenthaler'


Question:
Find the match ids of the cities that hosted competition '1994 FIFA World Cup qualification'?
Additional table information: table: city_record

Answer: SELECT match_id FROM MATCH WHERE competition = '1994 FIFA World Cup qualification'


Question:
Show all train names and times in stations in London in descending order by train time.
Additional table information: table: train_station

Answer: SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC


Question:
Return the names of all regions other than Denmark.
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE region_name <> 'Denmark'


Question:
What are the majors only less than three students are studying?
Additional table information: table: voter_2

Answer: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3


Question:
Find the classroom that the most students use.
Additional table information: table: student_1

Answer: SELECT classroom FROM list GROUP BY classroom ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the host year of city 'Taizhou ( Zhejiang )'?
Additional table information: table: city_record

Answer: SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = 'Taizhou ( Zhejiang )'


Question:
When do all the researcher role staff start to work, and when do they stop working?
Additional table information: table: tracking_grants_for_research

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


Question:
Show the transportation method most people choose to get to tourist attractions.
Additional table information: table: cre_Theme_park

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


Question:
What is the shop name corresponding to the shop that opened in the most recent year?
Additional table information: table: device

Answer: SELECT Shop_Name FROM shop ORDER BY Open_Year DESC LIMIT 1


Question:
What are the first, middle, and last names of all individuals, ordered by last name?
Additional table information: table: e_government

Answer: SELECT individual_first_name, individual_middle_name, individual_last_name FROM individuals ORDER BY individual_last_name NULLS FIRST


Question:
Which sport has most number of students on scholarship?
Additional table information: table: game_1

Answer: SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the duration, file size and format of songs whose genre is pop, ordered by title?
Additional table information: table: music_1

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


Question:
Find the name of the patient who made the appointment with the most recent start date.
Additional table information: table: hospital_1

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


Question:
Find the first names of all customers that live in Brazil and have an invoice.
Additional table information: table: chinook_1

Answer: SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = 'Brazil'


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

Answer: SELECT AVG(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Tennis Club'


Question:
What are the total number of Domestic Passengers of airports that contain the word 'London'.
Additional table information: table: aircraft

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


Question:
Which customers have used the service named 'Close a policy' or 'Upgrade a policy'? Give me the customer names.
Additional table information: table: insurance_fnol

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = 'Close a policy' OR t3.service_name = 'Upgrade a policy'


Question:
What are the last names of the author of the paper titled 'Binders Unbound'?
Additional table information: table: icfp_1

Answer: SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = 'Binders Unbound'


Question:
How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
Additional table information: table: assets_maintenance

Answer: SELECT T1.staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name


Question:
Return the names of tracks that have no had any races.
Additional table information: table: race_track

Answer: SELECT name FROM track WHERE NOT track_id IN (SELECT track_id FROM race)


Question:
What zip codes have a station with a max temperature greater than or equal to 80 and when did it reach that temperature?
Additional table information: table: bike_1

Answer: SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80


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

Answer: SELECT SUM(no_of_customers) FROM bank


Question:
Show the name of the party that has the most delegates.
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids for courses that were offered in both Fall of 2009 and Spring of 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:
Find the id and local authority of the station with has the highest average high temperature.
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 ORDER BY AVG(high_temperature) DESC LIMIT 1


Question:
Please show different software platforms and the corresponding number of devices using each.
Additional table information: table: device

Answer: SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform


Question:
What are the names of the technicians aged either 36 or 37?
Additional table information: table: machine_repair

Answer: SELECT Name FROM technician WHERE Age = 36 OR Age = 37


Question:
How many songs have a shared vocal?
Additional table information: table: music_2

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


Question:
What is the average gradepoint for students with the last name Smith?
Additional table information: table: college_3

Answer: SELECT AVG(T2.gradepoint) FROM ENROLLED_IN AS T1, GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = 'Smith'


Question:
What are the salaries and manager ids for employees who have managers?
Additional table information: table: hr_1

Answer: SELECT salary, manager_id FROM employees WHERE manager_id <> 'null'


Question:
Show me the number of parks the state of NY has.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM park WHERE state = 'NY'


Question:
Find the state which has the most number of customers.
Additional table information: table: loan_1

Answer: SELECT state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC LIMIT 1


Question:
Which author has written the most papers? Find his or her last name.
Additional table information: table: icfp_1

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


Question:
What are the names and ages of editors?
Additional table information: table: journal_committee

Answer: SELECT Name, Age FROM editor


Question:
What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating?
Additional table information: table: movie_1

Answer: SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron')


Question:
What is the name of the movie that has been reviewed the most?
Additional table information: table: movie_1

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


Question:
What are the names of departments either in division AS, or in division EN and in building NEB?
Additional table information: table: college_3

Answer: SELECT DName FROM DEPARTMENT WHERE Division = 'AS' UNION SELECT DName FROM DEPARTMENT WHERE Division = 'EN' AND Building = 'NEB'


Question:
What are the ages of all of Zach's friends who are in the longest relationship?
Additional table information: table: network_2

Answer: SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')


Question:
What are the first and last name of the president of the club 'Bootup Baltimore'?
Additional table information: table: club_1

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


Question:
What are the ids and names of the web accelerators that are compatible with two or more browsers?
Additional table information: table: browser_web

Answer: SELECT T1.id, T1.Name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2


Question:
Find the name of the department that offers the highest total credits?
Additional table information: table: college_2

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


Question:
Count the number of markets that have a number of cities lower than 300.
Additional table information: table: film_rank

Answer: SELECT COUNT(*) FROM market WHERE Number_cities < 300


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

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


Question:
Find the name of amenity that is most common in all 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:
Show the result of the submission with the highest score.
Additional table information: table: workshop_paper

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


Question:
Find all the stage positions of the musicians with first name 'Solveig'
Additional table information: table: music_2

Answer: SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = 'Solveig'


Question:
What are the advisors
Additional table information: table: game_1

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


Question:
Find all the customer information in state NY.
Additional table information: table: chinook_1

Answer: SELECT * FROM CUSTOMER WHERE State = 'NY'


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

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


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

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


Question:
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.
Additional table information: table: pilot_record

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


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

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


Question:
How many drivers did not participate in the races held 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:
Find all the forenames of distinct drivers who was in position 1 as standing and won?
Additional table information: table: formula_1

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


Question:
What is the total quantity of products purchased by 'Rodrick Heaney'?
Additional table information: table: customers_and_addresses

Answer: SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = 'Rodrick Heaney'


Question:
Find the ids of all distinct customers who made order after some orders that were Cancelled.
Additional table information: table: department_store

Answer: SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT MIN(order_date) FROM Customer_Orders WHERE order_status_code = 'Cancelled')


Question:
What are the names of the songs that are modern or sung in English?
Additional table information: table: music_1

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


Question:
What are the details of all products?
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT product_details FROM products


Question:
List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000


Question:
What are the destinations and number of flights to each one?
Additional table information: table: flight_1

Answer: SELECT destination, COUNT(*) FROM Flight GROUP BY destination


Question:
What are the different names for all songs that have a higher resolution than English songs?
Additional table information: table: music_1

Answer: SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = 'english')


Question:
What is the maximum page size for everything that has more than 3 products listed?
Additional table information: table: store_product

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


Question:
What are the names of the regions in alphabetical order?
Additional table information: table: storm_record

Answer: SELECT region_name FROM region ORDER BY region_name NULLS FIRST


Question:
Find the average price of wines that are not produced from Sonoma county.
Additional table information: table: wine_1

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


Question:
How many students participated in tryouts for each college by descennding count?
Additional table information: table: soccer_2

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


Question:
Find the number of users in each role.
Additional table information: table: document_management

Answer: SELECT COUNT(*), role_code FROM users GROUP BY role_code


Question:
What is the time of elimination for the wrestler with the most days held?
Additional table information: table: wrestler

Answer: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1


Question:
What are the players who played for Columbus Crew, and how many years did each play for?
Additional table information: table: match_season

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


Question:
Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000.
Additional table information: table: book_2

Answer: SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000


Question:
How many staff does each project has? List the project id and the number in an ascending order.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.project_id, COUNT(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY COUNT(*) ASC NULLS FIRST


Question:
Show the role code with the least employees.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Show the names of players and names of their coaches in descending order of the votes of players.
Additional table information: table: riding_club

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


Question:
List the titles of all items in alphabetic order .
Additional table information: table: epinions_1

Answer: SELECT title FROM item ORDER BY title NULLS FIRST


Question:
Count the number of stores the chain South has.
Additional table information: table: department_store

Answer: SELECT COUNT(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = 'South'


Question:
What is the name of each aircraft and how many flights does each one complete?
Additional table information: table: flight_1

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


Question:
What are the headquarters without companies that are in the banking industry?
Additional table information: table: gas_company

Answer: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'


Question:
Show the crime rate of counties with a city having white percentage more than 90.
Additional table information: table: county_public_safety

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


Question:
What is all the information regarding employees with salaries above the minimum and under 2500?
Additional table information: table: hr_1

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


Question:
Show me all the restaurants.
Additional table information: table: restaurant_1

Answer: SELECT ResName FROM Restaurant


Question:
How many clubs does 'Linda Smith' have membership for?
Additional table information: table: club_1

Answer: SELECT COUNT(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = 'Linda' AND t3.lname = 'Smith'


Question:
Find the top 3 artists who have the largest number of songs works whose language is Bangla.
Additional table information: table: music_1

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


Question:
Find the number of students in one classroom.
Additional table information: table: student_1

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


Question:
What campuses are in Los Angeles county?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE county = 'Los Angeles'


Question:
Find the number of distinct currency codes used in drama workshop groups.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT COUNT(DISTINCT Currency_Code) FROM Drama_Workshop_Groups


Question:
Find the name of scientists who are assigned to some project.
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn


Question:
How many students play each sport?
Additional table information: table: game_1

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


Question:
What is the sum of checking and savings balances for all customers, ordered by the total balance?
Additional table information: table: small_bank_1

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


Question:
Show the invoice number and the number of transactions for each invoice.
Additional table information: table: customers_and_invoices

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


Question:
What is the maximum elevation of all airports in the country of Iceland?
Additional table information: table: flight_4

Answer: SELECT MAX(elevation) FROM airports WHERE country = 'Iceland'


Question:
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
Additional table information: table: soccer_1

Answer: SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot


Question:
What cities do students live in?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT city_code FROM Student


Question:
Find all the customer last names that do not have invoice totals larger than 20.
Additional table information: table: chinook_1

Answer: SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20


Question:
Show the countries that have both managers of age above 50 and managers of age below 46.
Additional table information: table: railway

Answer: SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46


Question:
Show the city and the number of branches opened before 2010 for each city.
Additional table information: table: shop_membership

Answer: SELECT city, COUNT(*) FROM branch WHERE open_year < 2010 GROUP BY city


Question:
Which headquarter locations are used by more than 2 companies?
Additional table information: table: company_office

Answer: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2


Question:
How many professors who are from either Accounting or Biology department?
Additional table information: table: college_1

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


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

Answer: SELECT COUNT(*) FROM Ref_budget_codes


Question:
Show the names of products and the number of events they are in, sorted by the number of events in descending order.
Additional table information: table: solvency_ii

Answer: SELECT T1.Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY COUNT(*) DESC


Question:
What are the ids, full names, and salaries for employees making more than average and who work in a department with employees who have the letter J in their first name?
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) AND department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%J%')


Question:
What is the budget type code with most number of documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the minimum, mean, and maximum age across all students?
Additional table information: table: allergy_1

Answer: SELECT MIN(age), AVG(age), MAX(age) FROM Student


Question:
What are the id and name of the photos for mountains?
Additional table information: table: mountain_photos

Answer: SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000


Question:
Show the locations that have more than one railways.
Additional table information: table: railway

Answer: SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1


Question:
Find the maximum and minimum durations of tracks in milliseconds.
Additional table information: table: chinook_1

Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK


Question:
What are the names of the mills which are not located in 'Donceel'?
Additional table information: table: architecture

Answer: SELECT name FROM mill WHERE LOCATION <> 'Donceel'


Question:
Find the name of the campuses opened before 1800.
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE YEAR < 1800


Question:
List the hardware model name and company name for the phone whose screen mode type is 'Graphics.'
Additional table information: table: phone_1

Answer: SELECT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = 'Graphics'


Question:
Find the names of all the products whose stock number starts with '2'.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE '2%'


Question:
Find the physician who was trained in the most expensive procedure?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1


Question:
How many cities have a stadium that was opened before the year of 2006?
Additional table information: table: swimming

Answer: SELECT COUNT(DISTINCT city) FROM stadium WHERE opening_year < 2006


Question:
What is the first name, last name, and phone of the customer with account name 162?
Additional table information: table: customers_card_transactions

Answer: SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '162'


Question:
What is the average number of attendees for performances?
Additional table information: table: performance_attendance

Answer: SELECT AVG(Attendance) FROM performance


Question:
List all the image name and URLs in the order of their names.
Additional table information: table: document_management

Answer: SELECT image_name, image_url FROM images ORDER BY image_name NULLS FIRST


Question:
Show names for all aircrafts of which John Williams has certificates.
Additional table information: table: flight_1

Answer: SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = 'John Williams'


Question:
What are the names of parties and their respective regions?
Additional table information: table: party_people

Answer: SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id


Question:
Count the total number of available services.
Additional table information: table: insurance_fnol

Answer: SELECT COUNT(*) FROM services


Question:
What are the names and ages of every person who is a friend of both Dan and Alice?
Additional table information: table: network_2

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


Question:
How many distinct cities does the employees live in?
Additional table information: table: chinook_1

Answer: SELECT COUNT(DISTINCT city) FROM EMPLOYEE


Question:
Which customer uses the most policies? Give me the customer name.
Additional table information: table: insurance_fnol

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


Question:
Please show different denominations and the corresponding number of schools.
Additional table information: table: school_player

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


Question:
What is the name of customers who do not use Cash as payment method.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers WHERE payment_method <> 'Cash'


Question:
What are the maximum, minimum, and average booked count for the products booked?
Additional table information: table: products_for_hire

Answer: SELECT MAX(booked_count), MIN(booked_count), AVG(booked_count) FROM products_booked


Question:
What is the school code of the accounting department?
Additional table information: table: college_1

Answer: SELECT school_code FROM department WHERE dept_name = 'Accounting'


Question:
What is the document type code with most number of documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the distinct ages of the heads who are acting?
Additional table information: table: department_management

Answer: SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'


Question:
Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT order_shipping_charges, customer_id FROM customer_orders WHERE order_status_code = 'Cancelled' OR order_status_code = 'Paid'


Question:
Return the unique name for stations that have ever had 7 bikes available.
Additional table information: table: bike_1

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


Question:
What are the headquarters with at least two companies in the banking industry?
Additional table information: table: gas_company

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


Question:
Retrieve the open and close dates of all the policies associated with the customer whose name contains 'Diana'
Additional table information: table: insurance_fnol

Answer: SELECT t2.date_opened, t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE '%Diana%'


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

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


Question:
For each headquarter, what are the headquarter and how many companies are centered there?
Additional table information: table: gas_company

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


Question:
Find the total credits of courses provided by different department.
Additional table information: table: college_2

Answer: SELECT SUM(credits), dept_name FROM course GROUP BY dept_name


Question:
What is the number of invoices and total money billed in them from CA?
Additional table information: table: store_1

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


Question:
What are the tracks that Dean Peeters bought?
Additional table information: table: store_1

Answer: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = 'Daan' AND T4.last_name = 'Peeters'


Question:
What are the checking and savings balances in accounts belonging to Brown?
Additional table information: table: small_bank_1

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


Question:
Which order has the most recent shipment? Give me the order id.
Additional table information: table: tracking_orders

Answer: SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)


Question:
What are the grapes, appelations, and wines with scores above 93, sorted by Name?
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name NULLS FIRST


Question:
List the name for storms and the number of affected regions for each storm.
Additional table information: table: storm_record

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


Question:
How many cities are there in state 'Colorado'?
Additional table information: table: e_government

Answer: SELECT COUNT(*) FROM addresses WHERE state_province_county = 'Colorado'


Question:
What are the products that have problems reported after 1986-11-13? Give me the product id and the count of problems reported after 1986-11-13.
Additional table information: table: tracking_software_problems

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


Question:
What are the names of documents that have both one of the three most common types and one of three most common structures?
Additional table information: table: document_management

Answer: SELECT document_name FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the official names of cities that have not hosted a farm competition?
Additional table information: table: farm

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


Question:
What are the names of all colleges that have two or more players?
Additional table information: table: match_season

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


Question:
What are the course names for courses taught on MTW?
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE WHERE Days = 'MTW'


Question:
Which courses are taught on days MTW?
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE WHERE Days = 'MTW'


Question:
What are the distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'?
Additional table information: table: tracking_grants_for_research

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


Question:
Count the number of voting records for each election cycle.
Additional table information: table: voter_2

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


Question:
Find the maximum and minimum monthly rental for all student addresses.
Additional table information: table: behavior_monitoring

Answer: SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses


Question:
Give the name of the student in the History department with the most credits.
Additional table information: table: college_2

Answer: SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1


Question:
What are all the friends of Alice who are female?
Additional table information: table: network_2

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


Question:
Which problems are reported before 1978-06-26? Give me the ids of the problems.
Additional table information: table: tracking_software_problems

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


Question:
Show flight number for all flights with more than 2000 distance.
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE distance > 2000


Question:
What is the name of the medication used for the patient staying in room 111?
Additional table information: table: hospital_1

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


Question:
How many rooms in total are there in the apartments in the building with short name 'Columbus Square'?
Additional table information: table: apartment_rentals

Answer: SELECT SUM(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = 'Columbus Square'


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

Answer: SELECT DISTINCT product_size FROM Products


Question:
How many female students (sex is F) whose age is below 25?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25


Question:
Find the number of albums by the artist 'Metallica'.
Additional table information: table: chinook_1

Answer: SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'


Question:
Show member names without any registered branch.
Additional table information: table: shop_membership

Answer: SELECT name FROM member WHERE NOT member_id IN (SELECT member_id FROM membership_register_branch)


Question:
List the name of the school with the smallest enrollment.
Additional table information: table: school_finance

Answer: SELECT school_name FROM school ORDER BY enrollment NULLS FIRST LIMIT 1


Question:
What are the invoice dates, order ids, and order details for all invoices?
Additional table information: table: customers_and_invoices

Answer: SELECT T1.invoice_date, T1.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id


Question:
What are the memories and carriers of phones?
Additional table information: table: phone_market

Answer: SELECT Memory_in_G, Carrier FROM phone


Question:
How many staff have the first name Ludie?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff WHERE first_name = 'Ludie'


Question:
Find the name and savings balance of the top 3 accounts with the highest saving balance sorted by savings balance in descending order.
Additional table information: table: small_bank_1

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


Question:
How many products are never booked with amount higher than 200?
Additional table information: table: products_for_hire

Answer: SELECT COUNT(*) FROM Products_for_hire WHERE NOT product_id IN (SELECT product_id FROM products_booked WHERE booked_amount > 200)


Question:
What is maximum, minimum and average amount of outstanding of customer?
Additional table information: table: driving_school

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


Question:
Find the name and email of the user whose name contains the word ‘Swift’.
Additional table information: table: twitter_1

Answer: SELECT name, email FROM user_profiles WHERE name LIKE '%Swift%'


Question:
What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?
Additional table information: table: storm_record

Answer: 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 INTERSECT 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 SUM(T2.number_city_affected) >= 10


Question:
What is the booking status code of the apartment with apartment number 'Suite 634'?
Additional table information: table: apartment_rentals

Answer: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = 'Suite 634'


Question:
Find how many different affiliation types there are.
Additional table information: table: university_basketball

Answer: SELECT COUNT(DISTINCT affiliation) FROM university


Question:
What are the names of all students who tried out in alphabetical 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:
Show the headquarters shared by more than two companies.
Additional table information: table: company_office

Answer: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2


Question:
What is the average snatch score of body builders?
Additional table information: table: body_builder

Answer: SELECT AVG(Snatch) FROM body_builder


Question:
What are the names of the managers for gas stations that are operated by the ExxonMobil company?
Additional table information: table: gas_company

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


Question:
How many teachers does the student named MADLOCK RAY have?
Additional table information: table: student_1

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


Question:
Find the name of rooms whose price is higher than the average price.
Additional table information: table: inn_1

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


Question:
What is all the information about employees who have never had a job in the past?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT employee_id IN (SELECT employee_id FROM job_history)


Question:
What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = 'Zinfandel'


Question:
What is the description of the type of the company who concluded its contracts most recently?
Additional table information: table: assets_maintenance

Answer: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1


Question:
List each birth place along with the number of people from there.
Additional table information: table: body_builder

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


Question:
What are the songs in volumes with more than 1 week on top?
Additional table information: table: music_4

Answer: SELECT Song FROM volume WHERE Weeks_on_Top > 1


Question:
What are the name and population of each county?
Additional table information: table: election

Answer: SELECT County_name, Population FROM county


Question:
List the problem id and log id which are assigned to the staff named Rylan Homenick.
Additional table information: table: tracking_software_problems

Answer: SELECT DISTINCT T2.problem_id, T2.problem_log_id FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = 'Rylan' AND T1.staff_last_name = 'Homenick'


Question:
What are the names and scores of all wines?
Additional table information: table: wine_1

Answer: SELECT Name, Score FROM WINE


Question:
Show the names of schools with a total budget amount greater than 100 or a total endowment greater than 10.
Additional table information: table: school_finance

Answer: SELECT T2.school_name FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN endowment AS T3 ON T2.school_id = T3.school_id GROUP BY T2.school_name HAVING SUM(T1.budgeted) > 100 OR SUM(T3.amount) > 10


Question:
Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.
Additional table information: table: department_store

Answer: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000


Question:
Which physician was trained in the procedure that costs the most.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1


Question:
What is average age for different job title?
Additional table information: table: network_2

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


Question:
What are the names of people in ascending alphabetical order?
Additional table information: table: gymnast

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


Question:
What are the names of each scientist, the names of the projects that they work on, and the hours for each of those projects, listed in alphabetical order by project name, then scientist name.
Additional table information: table: scientist_1

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


Question:
Return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'.
Additional table information: table: sakila_1

Answer: SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01')


Question:
Return the name and country corresponding to the artist who has had the most exhibitions.
Additional table information: table: theme_gallery

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


Question:
What is the address of the restaurant Subway?
Additional table information: table: restaurant_1

Answer: SELECT Address FROM Restaurant WHERE ResName = 'Subway'


Question:
Return the average age across all artists.
Additional table information: table: music_4

Answer: SELECT AVG(Age) FROM artist


Question:
What are the first and last names of all the employees and how many people report to them?
Additional table information: table: store_1

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


Question:
Which major has between 2 and 30 number of students? List major and the number of students.
Additional table information: table: restaurant_1

Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major HAVING COUNT(Major) BETWEEN 2 AND 30


Question:
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?
Additional table information: table: election

Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2


Question:
Count the products that have the color description 'white' or have the characteristic name 'hot'.
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 = 'white' OR t3.characteristic_name = 'hot'


Question:
What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50?
Additional table information: table: hr_1

Answer: SELECT email FROM employees WHERE commission_pct = 'null' AND salary BETWEEN 7000 AND 12000 AND department_id = 50


Question:
What are the names of the clubs that have players in the position of 'Right Wing'?
Additional table information: table: sports_competition

Answer: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = 'Right Wing'


Question:
How many artists are male and how many are female?
Additional table information: table: music_1

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


Question:
Return the top 3 greatest support rates.
Additional table information: table: candidate_poll

Answer: SELECT support_rate FROM candidate ORDER BY support_rate DESC LIMIT 3


Question:
Show all information on the airport that has the largest number of international passengers.
Additional table information: table: aircraft

Answer: SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1


Question:
How many available hotels are there in total?
Additional table information: table: cre_Theme_park

Answer: SELECT COUNT(*) FROM HOTELS


Question:
What are the 3 most common cloud covers in the zip code of 94107?
Additional table information: table: bike_1

Answer: SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3


Question:
Count the total number of counties.
Additional table information: table: election

Answer: SELECT COUNT(*) FROM county


Question:
Give me the name of the customer who ordered the most items in total.
Additional table information: table: customers_and_addresses

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


Question:
What is the average age for all person?
Additional table information: table: network_2

Answer: SELECT AVG(age) FROM Person


Question:
What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'


Question:
List the name of staff who has been assigned multiple jobs.
Additional table information: table: department_store

Answer: SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT(*) > 1


Question:
Find the student ID and login name of the student with the most course enrollments
Additional table information: table: e_learning

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


Question:
Show the minimum, average, and maximum age of all students.
Additional table information: table: allergy_1

Answer: SELECT MIN(age), AVG(age), MAX(age) FROM Student


Question:
What are the first and last names of the 5 customers who purchased something most recently?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY T2.invoice_date DESC LIMIT 5


Question:
List the campus that have between 600 and 1000 faculty lines in year 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:
Find the title and score of the movie with the lowest rating among all movies directed by each director.
Additional table information: table: movie_1

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


Question:
How many books are there for each publisher?
Additional table information: table: culture_company

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


Question:
Find the average price of all product clothes.
Additional table information: table: department_store

Answer: SELECT AVG(product_price) FROM products WHERE product_type_code = 'Clothes'


Question:
Which major has the most students?
Additional table information: table: voter_2

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


Question:
What is the name of the bank branch with the greatest number of customers?
Additional table information: table: loan_1

Answer: SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1


Question:
Return all the distinct secretary votes made in the fall election cycle.
Additional table information: table: voter_2

Answer: SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = 'Fall'


Question:
What is all the information about employees with D or S in their first name, ordered by salary descending?
Additional table information: table: hr_1

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


Question:
What is the id of the account with the most transactions?
Additional table information: table: customers_and_invoices

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


Question:
Show the players from college UCLA.
Additional table information: table: match_season

Answer: SELECT Player FROM match_season WHERE College = 'UCLA'


Question:
Which apartment type code appears the most often?
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ages of all music artists?
Additional table information: table: music_4

Answer: SELECT Age FROM artist


Question:
Return the gender and name of artist who produced the song with the lowest resolution.
Additional table information: table: music_1

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


Question:
What are the minimum and maximum membership amounts for all branches that either opened in 2011 or are located in London?
Additional table information: table: shop_membership

Answer: SELECT MIN(membership_amount), MAX(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'London'


Question:
How many campuses are there in Los Angeles county?
Additional table information: table: csu_1

Answer: SELECT COUNT(*) FROM campuses WHERE county = 'Los Angeles'


Question:
Find the name of the target user with the lowest trust score.
Additional table information: table: epinions_1

Answer: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust NULLS FIRST LIMIT 1


Question:
Show the authors who have submissions to more than one workshop.
Additional table information: table: workshop_paper

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


Question:
Find the titles of items that received any rating below 5.
Additional table information: table: epinions_1

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


Question:
Which tests have 'Pass' results? Return the dates when the tests were taken.
Additional table information: table: e_learning

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


Question:
Show the price ranges of hotels with 5 star ratings.
Additional table information: table: cre_Theme_park

Answer: SELECT price_range FROM HOTELS WHERE star_rating_code = '5'


Question:
What is the id and name of the staff who has been assigned for the least amount of time?
Additional table information: table: department_store

Answer: SELECT T1.staff_id, T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from NULLS FIRST LIMIT 1


Question:
List the names of all distinct nurses ordered by alphabetical order?
Additional table information: table: hospital_1

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


Question:
Show the id of each employee and the number of document destruction authorised by that employee.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT Destruction_Authorised_by_Employee_ID, COUNT(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID


Question:
List the types of competition and the number of competitions of each type.
Additional table information: table: sports_competition

Answer: SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type