Question:
Which tourist attractions does the visitor with detail 'Vincent' visit?
Additional table information: table: cre_Theme_park

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


Question:
Find the first names of the teachers that teach first grade.
Additional table information: table: student_1

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


Question:
How many customers are living in city 'Lake Geovannyton'?
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = 'Lake Geovannyton'


Question:
List the id of students who attended some courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM student_course_attendance


Question:
For each customer status code, how many customers are classified that way?
Additional table information: table: driving_school

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


Question:
Which cities' temperature in March is lower than that in July or higher than that in Oct?
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct


Question:
Show the types of schools that have two schools.
Additional table information: table: school_bus

Answer: SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2


Question:
What campus has the most degrees  conferrred over its entire existence?
Additional table information: table: csu_1

Answer: SELECT campus FROM degrees GROUP BY campus ORDER BY SUM(degrees) DESC LIMIT 1


Question:
What are the movie titles and average rating of the movies with the lowest average rating?
Additional table information: table: movie_1

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


Question:
What are the names of the characteristics of the product 'sesame' that have the characteristic type code 'Grade'?
Additional table information: table: products_gen_characteristics

Answer: SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = 'sesame' AND t3.characteristic_type_code = 'Grade'


Question:
What is the id, forename, and number of races for all drivers that have participated in at least 2 races?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, T1.forename, COUNT(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING COUNT(*) >= 2


Question:
List the codes of all courses that take place in room KLR209.
Additional table information: table: college_1

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


Question:
Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit.
Additional table information: table: college_2

Answer: SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred NULLS FIRST


Question:
Show the pair of male and female names in all weddings after year 2014
Additional table information: table: wedding

Answer: SELECT T2.name, T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014


Question:
What are the allergies and their types?
Additional table information: table: allergy_1

Answer: SELECT allergy, allergytype FROM Allergy_type


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

Answer: SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job


Question:
Find the distinct names of all wines that have prices higher than some wines from John Anthony winery.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = 'John Anthony')


Question:
List the id of students who registered course statistics in the order of registration date.
Additional table information: table: student_assessment

Answer: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'statistics' ORDER BY T2.registration_date NULLS FIRST


Question:
Show the names of cities in counties that have a crime rate less than 100.
Additional table information: table: county_public_safety

Answer: SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)


Question:
Find products with max page size as 'A4' and pages per minute color smaller than 5.
Additional table information: table: store_product

Answer: SELECT product FROM product WHERE max_page_size = 'A4' AND pages_per_minute_color < 5


Question:
How many games in 1885 postseason resulted in ties (that is, the value of 'ties' is '1')?
Additional table information: table: baseball_1

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


Question:
What categories have two or more corresponding books that were made after 1989?
Additional table information: table: culture_company

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


Question:
What are the titles of films that do not have a film market estimation?
Additional table information: table: film_rank

Answer: SELECT Title FROM film WHERE NOT Film_ID IN (SELECT Film_ID FROM film_market_estimation)


Question:
Return the names of all counties sorted by county name in descending alphabetical order.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY County_name DESC


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

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


Question:
Show the names of products that are in at least two events in ascending alphabetical order of product name.
Additional table information: table: solvency_ii

Answer: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2 ORDER BY T1.Product_Name NULLS FIRST


Question:
What is the day Number and date of all the documents?
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to?
Additional table information: table: scientist_1

Answer: SELECT SUM(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'


Question:
List the wheels and locations of the railways.
Additional table information: table: railway

Answer: SELECT Wheels, LOCATION FROM railway


Question:
find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion.
Additional table information: table: gas_company

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


Question:
Find the name and building of the department with the highest budget.
Additional table information: table: college_2

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


Question:
What are the distinct first names for students with a grade point of 3.8 or above in at least one course?
Additional table information: table: college_3

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


Question:
How many tracks do we have?
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM track


Question:
What is the winery at which the wine with the highest score was made?
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE ORDER BY SCORE NULLS FIRST LIMIT 1


Question:
How many trips did not end in San Francisco?
Additional table information: table: bike_1

Answer: SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> 'San Francisco'


Question:
Give me a list of cities whose temperature in Mar is lower than that in July and which have also served as host cities?
Additional table information: table: city_record

Answer: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city


Question:
Find the titles of all the papers written by 'Jeremy Gibbons'
Additional table information: table: icfp_1

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


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

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


Question:
Give the section titles of the document with the name 'David CV'.
Additional table information: table: document_management

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


Question:
For each position, what is the average number of points for players in that position?
Additional table information: table: sports_competition

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


Question:
Give the maximum and minimum product prices for each product type, grouped and ordered by product type.
Additional table information: table: department_store

Answer: SELECT MAX(product_price), MIN(product_price), product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code NULLS FIRST


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

Answer: SELECT COUNT(*) FROM inst


Question:
For each classroom, show the classroom number and find how many students are using it.
Additional table information: table: student_1

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


Question:
Which tourist attractions are related to royal family? Tell me their details and how we can get there.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Royal_Family_Details, T2.How_to_Get_There FROM ROYAL_FAMILY AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID


Question:
List the countries having more than 4 addresses listed.
Additional table information: table: customers_and_addresses

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


Question:
Show the description and code of the attraction type most tourist attractions belong to.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Attraction_Type_Description, T2.Attraction_Type_Code FROM Ref_Attraction_Types AS T1 JOIN Tourist_Attractions AS T2 ON T1.Attraction_Type_Code = T2.Attraction_Type_Code GROUP BY T2.Attraction_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Who advises student 1004?
Additional table information: table: allergy_1

Answer: SELECT Advisor FROM Student WHERE StuID = 1004


Question:
What are the average profits of companies?
Additional table information: table: company_office

Answer: SELECT AVG(Profits_billion) FROM Companies


Question:
How many friends does Dan have?
Additional table information: table: network_2

Answer: SELECT COUNT(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'


Question:
How many rooms have king beds? Report the number for each decor type.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE bedType = 'King' GROUP BY decor


Question:
Which patient is undergoing the most recent treatment?
Additional table information: table: hospital_1

Answer: SELECT patient FROM undergoes ORDER BY dateundergoes NULLS FIRST LIMIT 1


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

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


Question:
What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?
Additional table information: table: department_management

Answer: SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'


Question:
What are the names of customers who live in Colorado state?
Additional table information: table: customers_and_addresses

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


Question:
Show each author and the number of workshops they submitted to.
Additional table information: table: workshop_paper

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


Question:
How many books fall into each category?
Additional table information: table: culture_company

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


Question:
What are the names and ids of products costing 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:
What is the last name of the student who received an A in the class with the code 10018?
Additional table information: table: college_1

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


Question:
What is the average and minimum age of all artists from United States.
Additional table information: table: theme_gallery

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


Question:
How many different teams have had eliminated wrestlers?
Additional table information: table: wrestler

Answer: SELECT COUNT(DISTINCT team) FROM elimination


Question:
List the season, home team, away team of all the games.
Additional table information: table: game_injury

Answer: SELECT season, home_team, away_team FROM game


Question:
Which county do the delegates on 'Appropriations' committee belong to? Give me the county names.
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = 'Appropriations'


Question:
Show the names of journalists and the number of events they reported.
Additional table information: table: news_report

Answer: SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name


Question:
display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.
Additional table information: table: hr_1

Answer: SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')


Question:
Find the number of distinct gender for dorms.
Additional table information: table: dorm_1

Answer: SELECT COUNT(DISTINCT gender) FROM dorm


Question:
Show the name of the shop that has the most kind of devices in stock.
Additional table information: table: device

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


Question:
Which players won awards in both 1960 and 1961? Return their first names and last names.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first, T1.name_last FROM player AS T1, player_award AS T2 WHERE T2.year = 1961


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

Answer: SELECT COUNT(DISTINCT advisor) FROM Student


Question:
How many kids stay in the room DAMIEN TRACHSEL checked in on Sep 21, 2010?
Additional table information: table: inn_1

Answer: SELECT Kids FROM Reservations WHERE CheckIn = '2010-09-21' AND FirstName = 'DAMIEN' AND LastName = 'TRACHSEL'


Question:
Count the number of universities that do not participate in the baketball match.
Additional table information: table: university_basketball

Answer: SELECT COUNT(*) FROM university WHERE NOT school_id IN (SELECT school_id FROM basketball_match)


Question:
Return the minister who left office at the latest time.
Additional table information: table: party_people

Answer: SELECT minister FROM party ORDER BY left_office DESC LIMIT 1


Question:
Show all calendar dates and day Numbers.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT calendar_date, day_Number FROM Ref_calendar


Question:
Find the name and training hours of players whose hours are below 1500.
Additional table information: table: soccer_2

Answer: SELECT pName, HS FROM Player WHERE HS < 1500


Question:
Find the names of the customers who have an deputy policy.
Additional table information: table: insurance_and_eClaims

Answer: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = 'Deputy'


Question:
Find the distinct winery of wines having price between 50 and 100.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100


Question:
Find the name of the organization that has published the largest number of papers.
Additional table information: table: icfp_1

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


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

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


Question:
What is the average number of audience for festivals?
Additional table information: table: entertainment_awards

Answer: SELECT AVG(Num_of_Audience) FROM festival_detail


Question:
Give me the the customer details and id for the customers who had two or more policies but did not file any claims.
Additional table information: table: insurance_policies

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


Question:
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.
Additional table information: table: hr_1

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


Question:
What are the names of cities that are in counties that have a crime rate below 100?
Additional table information: table: county_public_safety

Answer: SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)


Question:
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS FIRST LIMIT 1


Question:
How many companies are headquartered in the US?
Additional table information: table: company_employee

Answer: SELECT COUNT(*) FROM company WHERE Headquarters = 'USA'


Question:
Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.
Additional table information: table: loan_1

Answer: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100 GROUP BY T2.bname ORDER BY SUM(T1.amount) DESC LIMIT 1


Question:
How many different cities are they from?
Additional table information: table: network_2

Answer: SELECT COUNT(DISTINCT city) FROM Person


Question:
For each product which has problems, what are the number of problems and the product id?
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 GROUP BY T2.product_id


Question:
Find the names of all instructors in computer science department
Additional table information: table: college_2

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


Question:
How many different cities have these stations?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT city) FROM station


Question:
Count the number of statements.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Statements


Question:
Show the leader names and locations of colleges.
Additional table information: table: decoration_competition

Answer: SELECT Leader_Name, College_Location FROM college


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

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


Question:
What are the first names of all the students aged above 22?
Additional table information: table: voter_2

Answer: SELECT Fname FROM STUDENT WHERE Age > 22


Question:
Find the number of bands.
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM Band


Question:
What is the total number of ratings that has more than 3 stars?
Additional table information: table: movie_1

Answer: SELECT COUNT(*) FROM Rating WHERE stars > 3


Question:
What are the drivers' first names,last names, and ids for all those that had more than 8 stops or participated in more than 5 races?
Additional table information: table: formula_1

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


Question:
What are the different allergy types?
Additional table information: table: allergy_1

Answer: SELECT DISTINCT allergytype FROM Allergy_type


Question:
Show the names of products that are in at least two events.
Additional table information: table: solvency_ii

Answer: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2


Question:
What is the average number of bedrooms of all apartments?
Additional table information: table: apartment_rentals

Answer: SELECT AVG(bedroom_count) FROM Apartments


Question:
Which document has the most draft copies? List its document id and number of draft copies.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id, COUNT(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY COUNT(copy_number) DESC LIMIT 1


Question:
List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.
Additional table information: table: flight_company

Answer: SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services'


Question:
Find the start and end dates of detentions of teachers with last name 'Schultz'.
Additional table information: table: behavior_monitoring

Answer: SELECT T1.datetime_detention_start, datetime_detention_end FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schultz'


Question:
What are the names of 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:
What are the clean and jerk score of the body builder with the highest total score?
Additional table information: table: body_builder

Answer: SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1


Question:
What are the investors that have invested in at least two entrepreneurs?
Additional table information: table: entrepreneur

Answer: SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2


Question:
Find the number of rooms with king bed for each decor type.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE bedType = 'King' GROUP BY decor


Question:
What are the different locations of the school with the code BUS?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'


Question:
Find the names of all reviewers who rated Gone with the Wind.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'


Question:
Please show the date of ceremony of the volumes that last more than 2 weeks on top.
Additional table information: table: music_4

Answer: SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2


Question:
Return the completion date for all the tests that have 'Fail' result.
Additional table information: table: e_learning

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


Question:
What are the opening years in which at least two shops opened?
Additional table information: table: shop_membership

Answer: SELECT open_year FROM branch GROUP BY open_year HAVING COUNT(*) >= 2


Question:
What are the types of vocals that the band member with the first name 'Solveig' played the most?
Additional table information: table: music_2

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


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

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


Question:
Return the last name of the staff member who handled the complaint with the earliest date raised.
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 ORDER BY t2.date_complaint_raised NULLS FIRST LIMIT 1


Question:
What is the number of professors who are in the Accounting or Biology departments?
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:
Give me a list of the names of all songs ordered by their resolution.
Additional table information: table: music_1

Answer: SELECT song_name FROM song ORDER BY resolution NULLS FIRST


Question:
When did the first staff for the projects started working?
Additional table information: table: tracking_grants_for_research

Answer: SELECT date_from FROM Project_Staff ORDER BY date_from ASC NULLS FIRST LIMIT 1


Question:
Find the physicians who are trained in a procedure that costs more than 5000.
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 WHERE T3.cost > 5000


Question:
Find the number of characteristics that the product 'flax' has.
Additional table information: table: products_gen_characteristics

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


Question:
Find the name of the candidates whose oppose percentage is the lowest for each sex.
Additional table information: table: candidate_poll

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


Question:
What is the description for the results whose project detail is 'sint'?
Additional table information: table: tracking_grants_for_research

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


Question:
What are the names of the colleges that are larger than at least one college in Florida?
Additional table information: table: soccer_2

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


Question:
What is the status code with the least number of customers?
Additional table information: table: driving_school

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


Question:
What are the IDs of customers who have 'Diana' in part of their names?
Additional table information: table: insurance_fnol

Answer: SELECT customer_id FROM customers WHERE customer_name LIKE '%Diana%'


Question:
What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?
Additional table information: table: department_store

Answer: SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = 'Cancelled' ORDER BY order_date NULLS FIRST


Question:
What are the 3 counties that have the smallest population? Give me the county names.
Additional table information: table: election

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


Question:
List the phone numbers of all employees.
Additional table information: table: chinook_1

Answer: SELECT Phone FROM EMPLOYEE


Question:
What is the average number of international passengers of all airports?
Additional table information: table: aircraft

Answer: SELECT AVG(International_Passengers) FROM airport


Question:
Return the number of kids for the room reserved and checked in by DAMIEN TRACHSEL on  Sep 21, 2010.
Additional table information: table: inn_1

Answer: SELECT Kids FROM Reservations WHERE CheckIn = '2010-09-21' AND FirstName = 'DAMIEN' AND LastName = 'TRACHSEL'


Question:
For each project id, how many tasks are there?
Additional table information: table: tracking_grants_for_research

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


Question:
What is the card type code with most number of cards?
Additional table information: table: customers_card_transactions

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


Question:
List the countries that have more than one mountain.
Additional table information: table: climbing

Answer: SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1


Question:
Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.
Additional table information: table: apartment_rentals

Answer: SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC


Question:
For each company id, what are the companies and how many gas stations does each one operate?
Additional table information: table: gas_company

Answer: SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id


Question:
Show the names of products and the number of events they are in.
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


Question:
What are the maximum price and score of wines produced by St. Helena appelation?
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = 'St. Helena'


Question:
Count the number of exhibitions that have had an attendnance of over 100 or a ticket prices under 10.
Additional table information: table: theme_gallery

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


Question:
Find the number of items without any review.
Additional table information: table: epinions_1

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


Question:
What are the names of all employees who have a salary higher than average?
Additional table information: table: flight_1

Answer: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)


Question:
Find the total number of students living in the male dorm (with gender M).
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M'


Question:
How many songs have used the instrument 'drums'?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM instruments WHERE instrument = 'drums'


Question:
What are the ids of all students who have advisor number 1121?
Additional table information: table: game_1

Answer: SELECT StuID FROM Student WHERE Advisor = 1121


Question:
Which team has the oldest player?
Additional table information: table: school_player

Answer: SELECT Team FROM player ORDER BY Age DESC LIMIT 1


Question:
How many counties are there in total?
Additional table information: table: election

Answer: SELECT COUNT(*) FROM county


Question:
For grants that have descriptions of Regular and Initial Applications, what are their start dates?
Additional table information: table: tracking_grants_for_research

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


Question:
Which membership card has more than 5 members?
Additional table information: table: coffee_shop

Answer: SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5


Question:
How many patients are not using Procrastin-X as medication?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM patient WHERE NOT SSN IN (SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X')


Question:
Show the number of cities in counties that have a population more than 20000.
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)


Question:
Return the name of the heaviest entrepreneur.
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:
What are the distinct districts for elections?
Additional table information: table: election

Answer: SELECT DISTINCT District FROM election


Question:
Show the id and builder of the railway that are associated with the most trains.
Additional table information: table: railway

Answer: SELECT T2.Railway_ID, T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the minimum, maximum, and average seating for all tracks.
Additional table information: table: race_track

Answer: SELECT MIN(seating), MAX(seating), AVG(seating) FROM track


Question:
Find the founded year of the newest non public school.
Additional table information: table: university_basketball

Answer: SELECT founded FROM university WHERE affiliation <> 'Public' ORDER BY founded DESC LIMIT 1


Question:
How many departments offer courses?
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT dept_name) FROM course


Question:
Show the number of transactions for different investors.
Additional table information: table: tracking_share_transactions

Answer: SELECT investor_id, COUNT(*) FROM TRANSACTIONS GROUP BY investor_id


Question:
Return the name and job title of the staff with the latest date assigned.
Additional table information: table: department_store

Answer: SELECT T1.staff_name, T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1


Question:
Find the names of customers who either have an deputy policy or uniformed policy.
Additional table information: table: insurance_and_eClaims

Answer: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = 'Deputy' OR t1.policy_type_code = 'Uniform'


Question:
What are the names of all male British artists?
Additional table information: table: music_1

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


Question:
What is the type of allergy Cat?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type WHERE allergy = 'Cat'


Question:
For each college, return the college name and the count of authors with submissions from that college.
Additional table information: table: workshop_paper

Answer: SELECT College, COUNT(*) FROM submission GROUP BY College


Question:
what is the last name and gender of all students who played both Call of Destiny and Works of Widenius?
Additional table information: table: game_1

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


Question:
Show all headquarters with both a company in banking industry and a company in Oil and gas.
Additional table information: table: gas_company

Answer: SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'


Question:
How many companies are in either 'Banking' industry or 'Conglomerate' industry?
Additional table information: table: company_office

Answer: SELECT COUNT(*) FROM Companies WHERE Industry = 'Banking' OR Industry = 'Conglomerate'


Question:
What are the email addresses of teachers whose address has zip code '918'?
Additional table information: table: behavior_monitoring

Answer: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = '918'


Question:
For how many clubs is 'Tracy Kim' a member?
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 = 'Tracy' AND t3.lname = 'Kim'


Question:
List first name and last name of customers that have more than 2 payments.
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2


Question:
how many degrees were conferred between 1998 and 2002?
Additional table information: table: csu_1

Answer: SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T2.year >= 1998 AND T2.year <= 2002 GROUP BY T1.campus


Question:
How many games in total did team Boston Red Stockings attend from 2000 to 2010?
Additional table information: table: baseball_1

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


Question:
What are the names of the services that have never been used?
Additional table information: table: e_government

Answer: SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id


Question:
Which problem log was created most recently? Give me the log id.
Additional table information: table: tracking_software_problems

Answer: SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1


Question:
Count the number of customers that have an email containing 'gmail.com'.
Additional table information: table: chinook_1

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


Question:
Show white percentages of cities and the crime rates of counties they are in.
Additional table information: table: county_public_safety

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


Question:
What are the names of gymnasts?
Additional table information: table: gymnast

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


Question:
What are the descriptions of the categories that products with product descriptions that contain the letter t are in?
Additional table information: table: products_gen_characteristics

Answer: SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'


Question:
Show the employee ids and the number of documents destroyed by each employee.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
How many voting records do we have?
Additional table information: table: voter_2

Answer: SELECT COUNT(*) FROM VOTING_RECORD


Question:
What are the vocal types used in song 'Badlands'?
Additional table information: table: music_2

Answer: SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Badlands'


Question:
Select the name and price of the cheapest product.
Additional table information: table: manufactory_1

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


Question:
What is the least common media type in all tracks?
Additional table information: table: chinook_1

Answer: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT product, chromosome, porphyria FROM enzyme WHERE LOCATION = 'Cytosol'


Question:
Find the name of the airport in the city of Goroka.
Additional table information: table: flight_4

Answer: SELECT name FROM airports WHERE city = 'Goroka'


Question:
What is the name of the ship that is commanded by the youngest captain?
Additional table information: table: ship_1

Answer: SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age NULLS FIRST LIMIT 1


Question:
What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?
Additional table information: table: department_store

Answer: SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')


Question:
What is the id of the instructor who advises of all students from History department?
Additional table information: table: college_2

Answer: SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History'


Question:
Count the number of captains that have each rank.
Additional table information: table: ship_1

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


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

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


Question:
Find the number of manufactures that are based in Tokyo or Beijing.
Additional table information: table: manufactory_1

Answer: SELECT COUNT(*) FROM manufacturers WHERE headquarter = 'Tokyo' OR headquarter = 'Beijing'


Question:
What are the names of players who have the best dribbling?
Additional table information: table: soccer_1

Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(overall_rating) FROM Player_Attributes)


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

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


Question:
List in alphabetic order all different amenities.
Additional table information: table: dorm_1

Answer: SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name NULLS FIRST


Question:
What are the names and sum of checking and savings balances for accounts with savings balances higher than the average savings balance?
Additional table information: table: small_bank_1

Answer: SELECT T1.name, 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 T3.balance > (SELECT AVG(balance) FROM savings)


Question:
What is the first name and job id for all employees in the Finance department?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'


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

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


Question:
What are the ids of suppliers which have an average amount purchased of 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:
Show the names of customers who have both an order in completed status and an order in part status.
Additional table information: table: customers_and_products_contacts

Answer: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'


Question:
How many distinct transaction types are used in the transactions?
Additional table information: table: tracking_share_transactions

Answer: SELECT COUNT(DISTINCT transaction_type_code) FROM TRANSACTIONS


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

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


Question:
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies

Answer: SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC LIMIT 1


Question:
How many parks are there in the state of NY?
Additional table information: table: baseball_1

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


Question:
who is the manufacturer for the order year 1998?
Additional table information: table: "vehicles"."cars"
columns: order_year, manufacturer, model, fleet_series_quantity, powertrain, fuel_propulsion

Answer: SELECT manufacturer FROM "vehicles"."cars" WHERE order_year = '1998'


Question:
Find the first name of students in the descending order of age.
Additional table information: table: college_3

Answer: SELECT Fname FROM STUDENT ORDER BY Age DESC


Question:
Show different ways to get to attractions and the number of attractions that can be accessed in the corresponding way.
Additional table information: table: cre_Theme_park

Answer: SELECT How_to_Get_There, COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There


Question:
For each type, what is the average tonnage?
Additional table information: table: ship_mission

Answer: SELECT TYPE, AVG(Tonnage) FROM ship GROUP BY TYPE


Question:
What is the list of school locations sorted in descending order of school foundation year?
Additional table information: table: school_player

Answer: SELECT LOCATION FROM school ORDER BY Founded DESC


Question:
List the name and gender for all artists who released songs in March.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'


Question:
What is the average pages per minute color?
Additional table information: table: store_product

Answer: SELECT AVG(pages_per_minute_color) FROM product


Question:
What are the first names of all students who got a grade C in a class?
Additional table information: table: college_1

Answer: SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'


Question:
What are the names of all colleges with a larger enrollment than the largest college in Florida?
Additional table information: table: soccer_2

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


Question:
Find the number of games taken place in city Atlanta in 2000.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta'


Question:
Find all details for each swimmer.
Additional table information: table: swimming

Answer: SELECT * FROM swimmer


Question:
Who are Bob's friends?
Additional table information: table: network_2

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


Question:
Find the states which do not have any employee in their record.
Additional table information: table: customer_deliveries

Answer: SELECT state_province_county FROM addresses WHERE NOT address_id IN (SELECT employee_address_id FROM Employees)


Question:
List the physicians' employee ids together with their primary affiliation departments' ids.
Additional table information: table: hospital_1

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


Question:
Find the name and id of accounts whose checking balance is below the maximum checking balance.
Additional table information: table: small_bank_1

Answer: SELECT T1.custid, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT MAX(balance) FROM checking)


Question:
What are the names of directors who directed movies with 5 star rating? Also return the title of these movies.
Additional table information: table: movie_1

Answer: SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5


Question:
Show the unique first names, last names, and phone numbers for all customers with any account.
Additional table information: table: customers_and_invoices

Answer: SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id


Question:
Count the number of male students who had class senator votes in the fall election cycle.
Additional table information: table: voter_2

Answer: SELECT COUNT(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = 'M' AND T2.Election_Cycle = 'Fall'


Question:
Find the names of all instructors in the Art department who have taught some course and the course_id.
Additional table information: table: college_2

Answer: SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID WHERE T1.dept_name = 'Art'


Question:
Find the names of furnitures whose prices are lower than the highest price.
Additional table information: table: manufacturer

Answer: SELECT t1.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID WHERE t2.Price_in_Dollar < (SELECT MAX(Price_in_Dollar) FROM furniture_manufacte)


Question:
What are the ids for employees who do not work in departments with managers that have ids between 100 and 200?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT department_id IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)


Question:
What is the name of the activity that has the most faculty members involved in?
Additional table information: table: activity_1

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


Question:
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT AVG(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What are the first names and last names of all the guests?
Additional table information: table: apartment_rentals

Answer: SELECT guest_first_name, guest_last_name FROM Guests


Question:
return the smallest salary for every departments.
Additional table information: table: hr_1

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


Question:
Return the maximum number of points for climbers from the United Kingdom.
Additional table information: table: climbing

Answer: SELECT MAX(Points) FROM climber WHERE Country = 'United Kingdom'


Question:
What are the names and ids of the tourist attractions that are visited at most once?
Additional table information: table: cre_Theme_park

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


Question:
Find the name, city, and country of the airport that has the lowest altitude.
Additional table information: table: flight_4

Answer: SELECT name, city, country FROM airports ORDER BY elevation NULLS FIRST LIMIT 1


Question:
Find the number of reviews.
Additional table information: table: epinions_1

Answer: SELECT COUNT(*) FROM review


Question:
What are the names of students who have more than one advisor?
Additional table information: table: college_2

Answer: SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.id = T2.s_id GROUP BY T2.s_id HAVING COUNT(*) > 1


Question:
What are all the album titles, in alphabetical order?
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM ORDER BY Title NULLS FIRST


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

Answer: SELECT title, directed_by FROM film


Question:
For each aircraft that has won an award, what is its name and how many time has it won?
Additional table information: table: aircraft

Answer: SELECT T1.Aircraft, COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft


Question:
Find the physician who prescribed the highest dose. What is his or her name?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1


Question:
Show publishers with a book published in 1989 and a book in 1990.
Additional table information: table: culture_company

Answer: SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990


Question:
Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name LIKE '%Smith%'


Question:
Compute the average price of all the products.
Additional table information: table: manufactory_1

Answer: SELECT AVG(price) FROM products


Question:
Find the last names of all the authors that have written a paper with title containing the word 'Monadic'.
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 LIKE '%Monadic%'


Question:
Show the total number of rooms of all apartments with facility code 'Gym'.
Additional table information: table: apartment_rentals

Answer: SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = 'Gym'


Question:
Find the id of the song that lasts the longest.
Additional table information: table: music_1

Answer: SELECT f_id FROM files ORDER BY duration DESC LIMIT 1


Question:
What are the names, ages, and countries of artists, sorted by the year they joined?
Additional table information: table: theme_gallery

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


Question:
What is the total amount of money spent by Lucas Mancini?
Additional table information: table: store_1

Answer: SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'


Question:
Show the names of members and the decoration themes they have.
Additional table information: table: decoration_competition

Answer: SELECT T1.Name, T2.Decoration_Theme FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID


Question:
What are the name and description for location code x?
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Which services type had both successful and failure event details?
Additional table information: table: local_govt_in_alabama

Answer: SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Fail'


Question:
What are the names of instructors who have taught C Programming courses?
Additional table information: table: college_2

Answer: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'


Question:
What are the response received dates for the documents described as 'Regular' or granted with more than 100?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.response_received_date FROM Documents AS T1 JOIN Document_Types AS T2 ON T1.document_type_code = T2.document_type_code JOIN Grants AS T3 ON T1.grant_id = T3.grant_id WHERE T2.document_description = 'Regular' OR T3.grant_amount > 100


Question:
Which city has hosted the most events?
Additional table information: table: city_record

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


Question:
Find the total number of scientists.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists


Question:
Find the appelations that produce wines after the year of 2008 but not in Central Coast area.
Additional table information: table: wine_1

Answer: SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = 'Central Coast'


Question:
Find the name and address of the department that has the highest number of students.
Additional table information: table: college_1

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


Question:
What is the name of the hardware product with the greatest price?
Additional table information: table: department_store

Answer: SELECT product_name FROM products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC LIMIT 1


Question:
For each station, return its longitude and the average duration of trips that started from the station.
Additional table information: table: bike_1

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


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

Answer: SELECT COUNT(*) FROM VOTING_RECORD


Question:
Are the customers holding coupons with amount 500 bad or good?
Additional table information: table: products_for_hire

Answer: SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = 500


Question:
What is the sex of the candidate who had the highest unsure rate?
Additional table information: table: candidate_poll

Answer: SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY AVG(t2.unsure_rate) DESC LIMIT 1


Question:
Find all the female members of club 'Bootup Baltimore'. Show the first name and last name.
Additional table information: table: club_1

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


Question:
For each main industry, what is the total number of companies for the industry with the highest total market value?
Additional table information: table: gas_company

Answer: SELECT main_industry, COUNT(*) FROM company GROUP BY main_industry ORDER BY SUM(market_value) DESC LIMIT 1


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

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


Question:
Which countries have more than one mountain?
Additional table information: table: climbing

Answer: SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1


Question:
What are the names of the albums that have more than 10 tracks?
Additional table information: table: store_1

Answer: SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id HAVING COUNT(T1.id) > 10


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

Answer: SELECT COUNT(*) FROM school


Question:
Give the different reigns of wrestlers who are not located in Tokyo, Japan.
Additional table information: table: wrestler

Answer: SELECT DISTINCT Reign FROM wrestler WHERE LOCATION <> 'Tokyo , Japan'


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

Answer: SELECT COUNT fleet_series_quantity FROM "vehicles"."cars" WHERE fuel_propulsion = 'CNG'


Question:
Find the top 3 products which have the largest number of problems?
Additional table information: table: tracking_software_problems

Answer: SELECT T2.product_name FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY COUNT(*) DESC LIMIT 3


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

Answer: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid'


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

Answer: SELECT COUNT(DISTINCT customer_id) FROM Accounts


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

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


Question:
What is the total credit does each department offer?
Additional table information: table: college_1

Answer: SELECT SUM(crs_credit), dept_code FROM course GROUP BY dept_code


Question:
Find the total revenue for each manufacturer.
Additional table information: table: manufactory_1

Answer: SELECT SUM(revenue), name FROM manufacturers GROUP BY name


Question:
Find the name of customers who did not pay with Cash.
Additional table information: table: customers_and_addresses

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


Question:
How many performances are there?
Additional table information: table: performance_attendance

Answer: SELECT COUNT(*) FROM performance


Question:
How many problems are there for product voluptatem?
Additional table information: table: tracking_software_problems

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


Question:
What is the maximum price of wines from the appelation in the Central Coast area, which was produced before 2005?
Additional table information: table: wine_1

Answer: SELECT MAX(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2.year < 2005


Question:
What is the role with the smallest number of employees? Find the role codes.
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:
Count the number of different characteristic names the product 'cumin' has.
Additional table information: table: products_gen_characteristics

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


Question:
What are the id and the amount of refund of the booking that incurred the most times of payments?
Additional table information: table: products_for_hire

Answer: SELECT T1.booking_id, T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T1.booking_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show names of parties that does not have any members.
Additional table information: table: party_people

Answer: SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member)


Question:
What are the names of stations that have latitude lower than 37.5?
Additional table information: table: bike_1

Answer: SELECT name FROM station WHERE lat < 37.5


Question:
Return the full name of the staff who provided a customer with the first name April and the last name Burns with a film rental.
Additional table information: table: sakila_1

Answer: SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'


Question:
Show different types of ships and the average tonnage of ships of each type.
Additional table information: table: ship_mission

Answer: SELECT TYPE, AVG(Tonnage) FROM ship GROUP BY TYPE


Question:
What are first and last names of players participating in all star game in 1998?
Additional table information: table: baseball_1

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


Question:
How many different items were reviewed by some users?
Additional table information: table: epinions_1

Answer: SELECT COUNT(DISTINCT i_id) FROM review


Question:
When and in what zip code did max temperature reach 80?
Additional table information: table: bike_1

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


Question:
What is the name of the person whose age is below 30?
Additional table information: table: network_2

Answer: SELECT name FROM Person WHERE age < 30


Question:
Show the statement id and the statement detail for the statement with most number of 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 names of organizations, ordered by the date they were formed, ascending?
Additional table information: table: e_government

Answer: SELECT organization_name FROM organizations ORDER BY date_formed ASC NULLS FIRST


Question:
How many kids stay in the rooms reserved by ROY SWEAZY?
Additional table information: table: inn_1

Answer: SELECT kids FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
Which staff members who reported problems from the product 'rem' but not 'aut'? Give me their first and last names.
Additional table information: table: tracking_software_problems

Answer: SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1, product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = 'rem' EXCEPT SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1, product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = 'aut'


Question:
Find all the distinct visit dates.
Additional table information: table: cre_Theme_park

Answer: SELECT DISTINCT Visit_Date FROM VISITS


Question:
Where is store 1 located?
Additional table information: table: sakila_1

Answer: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1


Question:
Find the number of professors in accounting 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 DEPT_NAME = 'Accounting'


Question:
Find the dates of assessment notes for students with first name 'Fanny'.
Additional table information: table: behavior_monitoring

Answer: SELECT T1.date_of_notes FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = 'Fanny'


Question:
Find the average and total capacity of dorms for the students with gender X.
Additional table information: table: dorm_1

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


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

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


Question:
Select all the data from the products and each product's manufacturer.
Additional table information: table: manufactory_1

Answer: SELECT * FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code


Question:
How many people graduated from San Francisco State University in 2004?
Additional table information: table: csu_1

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


Question:
Which students study under the teacher named OTHA MOYER? Give me the first and last names of the students.
Additional table information: table: student_1

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


Question:
What are the names of cities in ascending alphabetical order?
Additional table information: table: county_public_safety

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


Question:
Return the song in the volume that has spent the most weeks on top?
Additional table information: table: music_4

Answer: SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1


Question:
Find the phone number of performer 'Ashley'.
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Hom many albums does the artist 'Metallica' have?
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:
What are the first names and last names of students with address in Wisconsin state?
Additional table information: table: behavior_monitoring

Answer: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Wisconsin'


Question:
What is the party that has the largest number of representatives?
Additional table information: table: election_representative

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


Question:
How many patients stay in room 112?
Additional table information: table: hospital_1

Answer: SELECT COUNT(patient) FROM stay WHERE room = 112


Question:
List the distinct region of clubs in ascending alphabetical order.
Additional table information: table: sports_competition

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


Question:
What are the names and ids of the different categories, and how many films are in each?
Additional table information: table: sakila_1

Answer: SELECT T2.name, T1.category_id, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id


Question:
What are the payment method codes that have been used by more than 3 parties?
Additional table information: table: e_government

Answer: SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING COUNT(*) > 3


Question:
Find the average and minimum price of the rooms in different decor.
Additional table information: table: inn_1

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


Question:
For each nationality, how many different constructors are there?
Additional table information: table: formula_1

Answer: SELECT COUNT(*), nationality FROM constructors GROUP BY nationality


Question:
Find the average number of factories for the manufacturers that have more than 20 shops.
Additional table information: table: manufacturer

Answer: SELECT AVG(Num_of_Factories) FROM manufacturer WHERE num_of_shops > 20


Question:
What is the number of airlines based in Russia?
Additional table information: table: flight_4

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


Question:
What are the full names and cities of employees who have the letter Z in their first names?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T3.city 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 WHERE T1.first_name LIKE '%z%'


Question:
What is the id and market share of the browser Safari?
Additional table information: table: browser_web

Answer: SELECT id, market_share FROM browser WHERE name = 'Safari'


Question:
Show the locations of schools that have more than 1 player.
Additional table information: table: school_player

Answer: SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1


Question:
How many documents have expenses?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents_with_expenses


Question:
Find the city and name of bank branches that provide business loans.
Additional table information: table: loan_1

Answer: SELECT T1.bname, T1.city FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T2.loan_type = 'Business'


Question:
display those departments where more than ten employees work who got a commission percentage.
Additional table information: table: hr_1

Answer: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10


Question:
Which customer had at least 2 policies but did not file any claims? List the customer details and id.
Additional table information: table: insurance_policies

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


Question:
Find the number of students taught by the teacher KAWA GORDON.
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 = 'KAWA' AND T2.lastname = 'GORDON'


Question:
What are the names of the county that the delegates on 'Appropriations' committee belong to?
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = 'Appropriations'


Question:
What are the different carriers for devices, listed in alphabetical order?
Additional table information: table: device

Answer: SELECT Carrier FROM device ORDER BY Carrier ASC NULLS FIRST


Question:
Count the number of tourists who did not visit any place.
Additional table information: table: cre_Theme_park

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


Question:
What are the names of the members and branches at which they are registered sorted by year of registration?
Additional table information: table: shop_membership

Answer: SELECT T3.name, T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year NULLS FIRST


Question:
Show origins of all flights with destination Honolulu.
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight WHERE destination = 'Honolulu'


Question:
What are the names of the storms that affected Denmark?
Additional table information: table: storm_record

Answer: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'


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

Answer: SELECT COUNT(*) FROM Employee


Question:
Find the name of department that offers the class whose description has the word 'Statistics'.
Additional table information: table: college_1

Answer: SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'


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

Answer: SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq


Question:
What are the names of climbers and the corresponding names of mountains that they climb?
Additional table information: table: climbing

Answer: SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID


Question:
What activities do we have?
Additional table information: table: activity_1

Answer: SELECT activity_name FROM Activity


Question:
What is the first name of the professor who is teaching CIS-220 and QM-261?
Additional table information: table: college_1

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


Question:
Find the dates of orders which belong to the customer named 'Jeramie'.
Additional table information: table: tracking_orders

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


Question:
List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name, customer_phone, customer_email FROM Customers ORDER BY date_became_customer NULLS FIRST


Question:
Find the booking start date and end date for the apartments that have more than two bedrooms.
Additional table information: table: apartment_rentals

Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2


Question:
Return the address of store 1.
Additional table information: table: sakila_1

Answer: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1


Question:
Find the customer who started a policy most recently.
Additional table information: table: insurance_and_eClaims

Answer: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies)


Question:
How many different industries are the companies in?
Additional table information: table: company_office

Answer: SELECT COUNT(DISTINCT Industry) FROM Companies


Question:
How many different captain ranks are there?
Additional table information: table: ship_1

Answer: SELECT COUNT(DISTINCT rank) FROM captain


Question:
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.
Additional table information: table: debate

Answer: SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200


Question:
Return the maximum and minimum population among all counties.
Additional table information: table: election

Answer: SELECT MAX(Population), MIN(Population) FROM county


Question:
How many distinct colleges are associated with players from the team with name 'Columbus Crew'.
Additional table information: table: match_season

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


Question:
What is the average age for each gender?
Additional table information: table: network_2

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


Question:
How many students are there for each major?
Additional table information: table: allergy_1

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


Question:
What are the ids of the two department store chains with the largest number of department stores?
Additional table information: table: department_store

Answer: SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY COUNT(*) DESC LIMIT 2


Question:
Count the number of characteristics of the product named 'laurel'.
Additional table information: table: products_gen_characteristics

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


Question:
What are the cell phone numbers of the candidates that received an assessment code of 'Fail'?
Additional table information: table: student_assessment

Answer: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail'


Question:
Return the code of the city that has the most students.
Additional table information: table: voter_2

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


Question:
What are the countries of markets and their corresponding years of market estimation?
Additional table information: table: film_rank

Answer: SELECT T2.Country, T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID


Question:
For each party, find its location and the name of its host. Sort the result in ascending order of the age of the host.
Additional table information: table: party_host

Answer: SELECT T3.Location, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age NULLS FIRST


Question:
Show all cities where at least one customer lives in but no performer lives in.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.City_Town FROM Addresses AS T1 JOIN Customers AS T2 ON T1.Address_ID = T2.Address_ID EXCEPT SELECT T1.City_Town FROM Addresses AS T1 JOIN Performers AS T2 ON T1.Address_ID = T2.Address_ID


Question:
List the names of all players who have a crossing score higher than 90 and prefer their right foot.
Additional table information: table: soccer_1

Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = 'right'


Question:
display the emails of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 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:
Find the number of distinct students enrolled in courses.
Additional table information: table: e_learning

Answer: SELECT COUNT(DISTINCT student_id) FROM Student_Course_Enrolment


Question:
What are the names of parties that have no members?
Additional table information: table: party_people

Answer: SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member)


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

Answer: SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name <> 'Alice'


Question:
Find the product type whose average price is higher than the average price of all products.
Additional table information: table: department_store

Answer: SELECT product_type_code FROM products GROUP BY product_type_code HAVING AVG(product_price) > (SELECT AVG(product_price) FROM products)


Question:
What is the total grant amount of the organisations described as research?
Additional table information: table: tracking_grants_for_research

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


Question:
Return the average and minimum age of captains in each class.
Additional table information: table: ship_1

Answer: SELECT AVG(age), MIN(age), CLASS FROM captain GROUP BY CLASS


Question:
List the number of customers that did not have any payment history.
Additional table information: table: driving_school

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


Question:
From what date and to what date do the staff work on a project that has the most staff and has staff in a leader role?
Additional table information: table: tracking_grants_for_research

Answer: SELECT date_from, date_to FROM Project_Staff WHERE project_id IN (SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY COUNT(*) DESC LIMIT 1) UNION SELECT date_from, date_to FROM Project_Staff WHERE role_code = 'leader'


Question:
Count the number of distinct player positions.
Additional table information: table: school_player

Answer: SELECT COUNT(DISTINCT POSITION) FROM player


Question:
Which position is most popular among players in the tryout?
Additional table information: table: soccer_2

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


Question:
Which countries do not have a stadium that was opened after 2006?
Additional table information: table: swimming

Answer: SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006


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

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


Question:
What are the locations that have gas stations owned by a company with a market value greater than 100?
Additional table information: table: gas_company

Answer: SELECT T3.location 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.market_value > 100


Question:
What distinct accelerator names are compatible with the browswers that have market share higher than 15?
Additional table information: table: browser_web

Answer: SELECT DISTINCT T1.name FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.market_share > 15


Question:
How many flights have a velocity larger than 200?
Additional table information: table: flight_company

Answer: SELECT COUNT(*) FROM flight WHERE velocity > 200


Question:
Which state has the greatest total number of bank 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 services have been used more than twice in first notification of loss? Return the service name.
Additional table information: table: insurance_fnol

Answer: SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING COUNT(*) > 2


Question:
What is the sum of revenue from companies with headquarters in Austin?
Additional table information: table: manufactory_1

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


Question:
List the maximum, minimum and average number of used kb in screen mode.
Additional table information: table: phone_1

Answer: SELECT MAX(used_kb), MIN(used_kb), AVG(used_kb) FROM screen_mode


Question:
Give the average number of working horses on farms with more than 5000 total horses.
Additional table information: table: farm

Answer: SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000


Question:
What are the different names of all reviewers whose ratings do not have a date field?
Additional table information: table: movie_1

Answer: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = 'null'


Question:
For every student who is registered for some course, how many courses are they registered for?
Additional table information: table: student_assessment

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


Question:
What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it?
Additional table information: table: scientist_1

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


Question:
Find the ids and names of members who are under age 30 or with black membership card.
Additional table information: table: coffee_shop

Answer: SELECT name, member_id FROM member WHERE Membership_card = 'Black' OR age < 30


Question:
Find the name, city, country, and altitude (or elevation) of the airports in the city of New York.
Additional table information: table: flight_4

Answer: SELECT name, city, country, elevation FROM airports WHERE city = 'New York'


Question:
What are the first names and last names of the employees who live in Calgary city.
Additional table information: table: chinook_1

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


Question:
Find the driver id and number of races of all drivers who have at most participated in 30 races?
Additional table information: table: formula_1

Answer: SELECT T1.driverid, COUNT(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING COUNT(*) <= 30


Question:
Find names of all students who took some course and got A or C.
Additional table information: table: college_1

Answer: SELECT T1.stu_fname, T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'


Question:
What are the names of customers with accounts, and what are the total savings balances for each?
Additional table information: table: small_bank_1

Answer: SELECT SUM(T2.balance), T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid GROUP BY T1.name


Question:
What is the name of the department in the Building Mergenthaler?
Additional table information: table: college_3

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


Question:
What is the publisher with most number of books?
Additional table information: table: culture_company

Answer: SELECT publisher FROM book_club GROUP BY publisher ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many faculty members participate in each activity? Return the activity names and the number of faculty members.
Additional table information: table: activity_1

Answer: SELECT T1.activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID


Question:
Show statement id, statement detail, account detail for accounts.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Return the maximum and minimum number of cows across all farms.
Additional table information: table: farm

Answer: SELECT MAX(Cows), MIN(Cows) FROM farm


Question:
How many customers have an active value of 1?
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM customer WHERE active = '1'


Question:
What campuses opened before 1800?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE YEAR < 1800


Question:
What are the unique names of all race held between 2014 and 2017?
Additional table information: table: formula_1

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


Question:
Find the cell mobile number of the candidates whose assessment code is 'Fail'?
Additional table information: table: student_assessment

Answer: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail'