Question:
What are the crime rates of counties that contain cities that have white percentages of over 90?
Additional table information: table: county_public_safety

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


Question:
Return the characteristic names of the 'sesame' product.
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'


Question:
Find the name of customers whose credit score is below the average credit scores of all customers.
Additional table information: table: loan_1

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


Question:
Give the different hometowns of gymnasts that have a total point score of above 57.5.
Additional table information: table: gymnast

Answer: SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5


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

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


Question:
What are the names of the customers who have made two or less orders?
Additional table information: table: tracking_orders

Answer: SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING COUNT(*) <= 2


Question:
How many students are attending English courses?
Additional table information: table: student_assessment

Answer: SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'English'


Question:
List the software platform shared by the greatest number of devices.
Additional table information: table: device

Answer: SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of the drama workshop groups with address in Feliciaberg city?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.City_Town = 'Feliciaberg'


Question:
List the most common type of Status across cities.
Additional table information: table: farm

Answer: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many courses are offered by the Computer Info. Systems department?
Additional table information: table: college_1

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


Question:
display the employee id and salary of all employees who report to Payam (first name).
Additional table information: table: hr_1

Answer: SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')


Question:
For each team, how many technicians are there?
Additional table information: table: machine_repair

Answer: SELECT Team, COUNT(*) FROM technician GROUP BY Team


Question:
Find the team names of the universities whose enrollments are smaller than the average enrollment size.
Additional table information: table: university_basketball

Answer: SELECT t2.team_name FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE enrollment < (SELECT AVG(enrollment) FROM university)


Question:
For each position, what is the minimum time students spent practicing?
Additional table information: table: soccer_2

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


Question:
What is the name of every city that has at least 15 stations and how many stations does it have?
Additional table information: table: bike_1

Answer: SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15


Question:
What is the flight number and its distance for the one with the maximum price?
Additional table information: table: flight_1

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


Question:
Return the phone numbers for all customers and suppliers.
Additional table information: table: department_store

Answer: SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers


Question:
Give the different locations of tracks.
Additional table information: table: race_track

Answer: SELECT DISTINCT LOCATION FROM track


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

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


Question:
What are the titles and authors or editors that correspond to books made after 1989?
Additional table information: table: culture_company

Answer: SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989


Question:
Show the ministers and the time they took and left office, listed by the time they left office.
Additional table information: table: party_people

Answer: SELECT minister, took_office, left_office FROM party ORDER BY left_office NULLS FIRST


Question:
How many candidates are there?
Additional table information: table: candidate_poll

Answer: SELECT COUNT(*) FROM candidate


Question:
Which teacher teaches the most students? Give me the first name and last name of the teacher.
Additional table information: table: student_1

Answer: SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROUP BY T2.firstname, T2.lastname ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the average enrollment of universities founded before 1850.
Additional table information: table: university_basketball

Answer: SELECT AVG(enrollment) FROM university WHERE founded < 1850


Question:
Show all video games and their types in the order of their names.
Additional table information: table: game_1

Answer: SELECT gname, gtype FROM Video_games ORDER BY gname NULLS FIRST


Question:
Find the white grape used to produce wines with scores above 90.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White' AND T2.score > 90


Question:
Show the lieutenant governor and comptroller from the democratic party.
Additional table information: table: election

Answer: SELECT Lieutenant_Governor, Comptroller FROM party WHERE Party = 'Democratic'


Question:
Find the id and forenames of drivers who participated both the races with name Australian Grand Prix and the races with name Chinese Grand Prix?
Additional table information: table: formula_1

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


Question:
Show id and location of railways that are associated with more than one train.
Additional table information: table: railway

Answer: SELECT T2.Railway_ID, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1


Question:
Show the customer ids and firstname without a credit card.
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name FROM Customers EXCEPT SELECT T1.customer_id, T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = 'Credit'


Question:
How many claim processing stages are there in total?
Additional table information: table: insurance_and_eClaims

Answer: SELECT COUNT(*) FROM claims_processing_stages


Question:
What are the delegate and name of the county they belong to, for each county?
Additional table information: table: election

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


Question:
What is the most common major among female (sex is F) students?
Additional table information: table: voter_2

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


Question:
Find the names of all the product characteristics.
Additional table information: table: products_gen_characteristics

Answer: SELECT DISTINCT characteristic_name FROM CHARACTERISTICS


Question:
In which year are there festivals both inside the 'United States' and outside the 'United States'?
Additional table information: table: entertainment_awards

Answer: SELECT YEAR FROM festival_detail WHERE LOCATION = 'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION <> 'United States'


Question:
How many distinct order ids correspond to each product?
Additional table information: table: customers_and_invoices

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


Question:
Show the name, open date, and organizer for all churches.
Additional table information: table: wedding

Answer: SELECT name, open_date, organized_by FROM Church


Question:
List the names of buildings with at least 200 feet of height and with at least 20 floors.
Additional table information: table: protein_institute

Answer: SELECT name FROM building WHERE height_feet >= 200 AND floors >= 20


Question:
Find the names of all instructors in Comp. Sci. department with salary > 80000.
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000


Question:
What are the names and number of hours spent training for each player who trains for less than 1500 hours?
Additional table information: table: soccer_2

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


Question:
Find the payment method that is used most frequently.
Additional table information: table: customer_deliveries

Answer: SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1


Question:
Who is the advisor of Linda Smith? Give me the first name and last name.
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = 'Linda' AND T2.lname = 'Smith'


Question:
When did the web accelerator 'CACHEbox' and browser 'Internet Explorer' become compatible?
Additional table information: table: browser_web

Answer: SELECT T1.compatible_since_year FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id WHERE T3.name = 'CACHEbox' AND T2.name = 'Internet Explorer'


Question:
What are the names of all clubs that do not have any players?
Additional table information: table: sports_competition

Answer: SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player)


Question:
What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?
Additional table information: table: flight_1

Answer: SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800' INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Airbus A340-300'


Question:
Find the names of instructors who didn't each any courses in any Spring semester.
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches WHERE semester = 'Spring')


Question:
What is the age of the tallest person?
Additional table information: table: gymnast

Answer: SELECT Age FROM people ORDER BY Height DESC LIMIT 1


Question:
What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it?
Additional table information: table: dorm_1

Answer: SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%'


Question:
List the name of rooms with king or queen bed.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE bedType = 'King' OR bedType = 'Queen'


Question:
What are the names and countries of origin for the artists who produced the top three highly rated songs.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.rating DESC LIMIT 3


Question:
Find the number of matches in different competitions.
Additional table information: table: city_record

Answer: SELECT COUNT(*), Competition FROM MATCH GROUP BY Competition


Question:
Find the name of customers who have more than one loan.
Additional table information: table: loan_1

Answer: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING COUNT(*) > 1


Question:
What are the names of the five cities with the greatest proportion of white people?
Additional table information: table: county_public_safety

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


Question:
List all payment methods and number of payments using each payment methods.
Additional table information: table: driving_school

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


Question:
Who is the 'CTO' of club 'Hopkins Student Enterprises'? 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 = 'Hopkins Student Enterprises' AND t2.position = 'CTO'


Question:
What are the names of the clients who do not have any booking?
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
Find the unit of measurement and product category code of product named 'chervil'.
Additional table information: table: products_gen_characteristics

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


Question:
What are the names of the ships that are not involved in any missions?
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM mission)


Question:
For each bed type, find the average base price of different bed type.
Additional table information: table: inn_1

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


Question:
What is the area for the appelation which produced the most wines prior to 2010?
Additional table information: table: wine_1

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


Question:
How many characteristics does the product named 'sesame' have?
Additional table information: table: products_gen_characteristics

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


Question:
What are the full name, hire date, salary, and department id for employees without the letter M in their first name?
Additional table information: table: hr_1

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


Question:
What are the characters of actors in descending order of age?
Additional table information: table: musical

Answer: SELECT Character FROM actor ORDER BY age DESC


Question:
Find the name and credit score of the customers who have some loans.
Additional table information: table: loan_1

Answer: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id


Question:
Show all the locations where some cinemas were opened in both year 2010 and year 2011.
Additional table information: table: cinema

Answer: SELECT LOCATION FROM cinema WHERE openning_year = 2010 INTERSECT SELECT LOCATION FROM cinema WHERE openning_year = 2011


Question:
display the department name, city, and state province for each department.
Additional table information: table: hr_1

Answer: SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id


Question:
Find the city with post code 255.
Additional table information: table: customers_and_addresses

Answer: SELECT city FROM addresses WHERE zip_postcode = 255


Question:
What are the visit date and details of the visitor whose detail is 'Vincent'?
Additional table information: table: cre_Theme_park

Answer: SELECT T2.Visit_Date, T2.Visit_Details FROM VISITORS AS T1 JOIN VISITS AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = 'Vincent'


Question:
List the companies of entrepreneurs in descending order of money requested.
Additional table information: table: entrepreneur

Answer: SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC


Question:
What is the name of the school with smallest enrollment size per state?
Additional table information: table: soccer_2

Answer: SELECT cName, state, MIN(enr) FROM college GROUP BY state


Question:
Find the salaries of all distinct instructors that are less than the largest salary.
Additional table information: table: college_2

Answer: SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT MAX(salary) FROM instructor)


Question:
List the course name of courses sorted by credits.
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE ORDER BY Credits NULLS FIRST


Question:
Show theme and year for all exhibitions in an descending order of ticket price.
Additional table information: table: theme_gallery

Answer: SELECT theme, YEAR FROM exhibition ORDER BY ticket_price DESC


Question:
What is the season of the game which causes the player 'Walter Samuel' to get injured?
Additional table information: table: game_injury

Answer: SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'


Question:
What are the different card types, and how many transactions have been made with each?
Additional table information: table: customers_card_transactions

Answer: SELECT T2.card_type_code, COUNT(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code


Question:
Find the name of the item with the lowest average rating.
Additional table information: table: epinions_1

Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY AVG(T2.rating) NULLS FIRST LIMIT 1


Question:
What are the cities that do not have any branches with more than 100 members?
Additional table information: table: shop_membership

Answer: SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100


Question:
Find the number of routes with destination airports in Italy.
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = 'Italy'


Question:
Show the names of members in ascending order of their rank in rounds.
Additional table information: table: decoration_competition

Answer: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round ASC NULLS FIRST


Question:
Find the total capacity of all dorms.
Additional table information: table: dorm_1

Answer: SELECT SUM(student_capacity) FROM dorm


Question:
What are the names of all genres in alphabetical order, combined with its ratings?
Additional table information: table: music_1

Answer: SELECT g_name, rating FROM genre ORDER BY g_name NULLS FIRST


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

Answer: SELECT fname, lname FROM authors ORDER BY lname NULLS FIRST


Question:
What are the phone numbers of all customers and suppliers.
Additional table information: table: department_store

Answer: SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers


Question:
Which 3 players won the most player awards? List their full name and id.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 3


Question:
List from which date and to which date these staff work: project staff of the project which hires the most staffs
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:
On what dates did the student whose personal name is 'Karson' enroll in and complete the courses?
Additional table information: table: e_learning

Answer: SELECT T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = 'Karson'


Question:
List the state names and the number of customers living in each state.
Additional table information: table: customer_deliveries

Answer: SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county


Question:
Find the number of customers in the banks at New York City.
Additional table information: table: loan_1

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


Question:
How many students are not involved in any behavior incident?
Additional table information: table: behavior_monitoring

Answer: SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident)


Question:
Find the highest rank of all reviews.
Additional table information: table: epinions_1

Answer: SELECT MIN(rank) FROM review


Question:
What are the star rating descriptions of the hotels with price above 10000?
Additional table information: table: cre_Theme_park

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


Question:
What are the dates of birth of entrepreneurs with investor 'Simon Woodroffe' or 'Peter Jones'?
Additional table information: table: entrepreneur

Answer: SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = 'Simon Woodroffe' OR T1.Investor = 'Peter Jones'


Question:
Find the start and end dates of behavior incidents of students with last name 'Fahey'.
Additional table information: table: behavior_monitoring

Answer: SELECT T1.date_incident_start, date_incident_end FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.last_name = 'Fahey'


Question:
List the id, genre and artist name of English songs ordered by rating.
Additional table information: table: music_1

Answer: SELECT f_id, genre_is, artist_name FROM song WHERE languages = 'english' ORDER BY rating NULLS FIRST


Question:
What are the first name, last name, and gender of all the good customers? Order by their last name.
Additional table information: table: products_for_hire

Answer: SELECT first_name, last_name, gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name NULLS FIRST


Question:
Please show the different statuses of cities and the average population of cities with each status.
Additional table information: table: farm

Answer: SELECT Status, AVG(Population) FROM city GROUP BY Status


Question:
Give the average price and case of wines made from Zinfandel grapes in the year 2009.
Additional table information: table: wine_1

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


Question:
Show the institution type with the largest number of institutions.
Additional table information: table: protein_institute

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


Question:
How many debates are there?
Additional table information: table: debate

Answer: SELECT COUNT(*) FROM debate


Question:
Show each state and the number of addresses in each state.
Additional table information: table: customers_and_products_contacts

Answer: SELECT state_province_county, COUNT(*) FROM addresses GROUP BY state_province_county


Question:
Find the names of catalog entries with level number 8.
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = '8'


Question:
Which manager won the most manager award? Give me the manager's first name, last name and id.
Additional table information: table: baseball_1

Answer: SELECT T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which customers have orders with status 'Packing'? Give me the customer names.
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Packing'


Question:
Find the visit date and details of the tourist whose detail is 'Vincent'
Additional table information: table: cre_Theme_park

Answer: SELECT T2.Visit_Date, T2.Visit_Details FROM VISITORS AS T1 JOIN VISITS AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = 'Vincent'


Question:
Find the average hours for the students whose tryout decision is no.
Additional table information: table: soccer_2

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


Question:
How many dorms are there?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*) FROM dorm


Question:
What is the average training hours of all players?
Additional table information: table: soccer_2

Answer: SELECT AVG(HS) FROM Player


Question:
What are the names of wrestlers and the elimination moves?
Additional table information: table: wrestler

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


Question:
Show the name of employees with three lowest salaries.
Additional table information: table: flight_1

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


Question:
What are the planned delivery date and actual delivery date for each booking?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Planned_Delivery_Date, Actual_Delivery_Date FROM BOOKINGS


Question:
What are the names and opening hours of the tourist attractions that can be accessed by bus or walk?
Additional table information: table: cre_Theme_park

Answer: SELECT Name, Opening_Hours FROM TOURIST_ATTRACTIONS WHERE How_to_Get_There = 'bus' OR How_to_Get_There = 'walk'


Question:
Find the total claimed amount of all the claims.
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Claimed) FROM Claims


Question:
What are the ids of the problems reported before the date of any problem reported by Lysanne Turcotte?
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < (SELECT MIN(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Lysanne' AND T4.staff_last_name = 'Turcotte')


Question:
List the name of tracks belongs to genre Rock or media type is MPEG audio file.
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' OR T3.name = 'MPEG audio file'


Question:
What is the first and last name of the students who are not in the largest major?
Additional table information: table: dorm_1

Answer: SELECT fname, lname FROM student WHERE major <> (SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1)


Question:
How many faculty is there in total in the year of 2002?
Additional table information: table: csu_1

Answer: SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002


Question:
Show the apartment numbers of apartments with bookings that have status code both 'Provisional' and 'Confirmed'
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Confirmed' INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Provisional'


Question:
Give the codes of document types that have more than 2 corresponding documents.
Additional table information: table: document_management

Answer: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING COUNT(*) > 2


Question:
Show all allergies and their types.
Additional table information: table: allergy_1

Answer: SELECT allergy, allergytype FROM Allergy_type


Question:
Find the number of activities available.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Activity


Question:
What are the naems of all the projects, and how many scientists were assigned to each of them?
Additional table information: table: scientist_1

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


Question:
Find the name of the person who has no student friends.
Additional table information: table: network_2

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


Question:
What is the most common type of ships?
Additional table information: table: ship_mission

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


Question:
List all countries and their number of airlines in the descending order of number of airlines.
Additional table information: table: flight_4

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


Question:
How many accounts does each customer have? List the number and customer id.
Additional table information: table: customers_and_invoices

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


Question:
Return the title and inventory id of the film that is rented most often.
Additional table information: table: sakila_1

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


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

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


Question:
Find the name and college of students whose decisions are yes in the tryout.
Additional table information: table: soccer_2

Answer: SELECT T1.pName, T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'


Question:
What are the different parties of representative? Show the party name and the number of representatives in each party.
Additional table information: table: election_representative

Answer: SELECT Party, COUNT(*) FROM representative GROUP BY Party


Question:
What are the names of the technicians  and how many machines are they assigned to repair?
Additional table information: table: machine_repair

Answer: SELECT T2.Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name


Question:
Give 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:
How many universities have a campus fee higher than average?
Additional table information: table: csu_1

Answer: SELECT COUNT(*) FROM csu_fees WHERE campusfee > (SELECT AVG(campusfee) FROM csu_fees)


Question:
Show the authors of submissions and the acceptance results of their submissions.
Additional table information: table: workshop_paper

Answer: SELECT T2.Author, T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID


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

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


Question:
What are the ids of the candidates that have an outcome code of Pass?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = 'Pass'


Question:
Sort the apartment numbers in ascending order of room count.
Additional table information: table: apartment_rentals

Answer: SELECT apt_number FROM Apartments ORDER BY room_count ASC NULLS FIRST


Question:
What are the team and starting year of technicians?
Additional table information: table: machine_repair

Answer: SELECT Team, Starting_Year FROM technician


Question:
What are the name and ID of the product bought the most.
Additional table information: table: customers_and_addresses

Answer: SELECT t2.product_details, t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY SUM(t1.order_quantity) NULLS FIRST LIMIT 1


Question:
List all information in the item table.
Additional table information: table: epinions_1

Answer: SELECT * FROM item


Question:
Which customers have the substring 'Diana' in their names? Return the customer details.
Additional table information: table: insurance_and_eClaims

Answer: SELECT customer_details FROM customers WHERE customer_details LIKE '%Diana%'


Question:
Return the most common full name among all actors.
Additional table information: table: sakila_1

Answer: SELECT first_name, last_name FROM actor GROUP BY first_name, last_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of products in the category 'Seeds'.
Additional table information: table: products_gen_characteristics

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


Question:
What student id corresponds to the oldest student?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)


Question:
Show the names of pilots from team 'Bradley' or 'Fordham'.
Additional table information: table: pilot_record

Answer: SELECT Pilot_name FROM pilot WHERE Team = 'Bradley' OR Team = 'Fordham'


Question:
What is the last name of the musician that has been at the back position the most?
Additional table information: table: music_2

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


Question:
Count the members of the club 'Tennis Club'.
Additional table information: table: club_1

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


Question:
What are the titles of all movies that have rating star is between 3 and 5?
Additional table information: table: movie_1

Answer: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5


Question:
Which document type is described with the prefix 'Initial'?
Additional table information: table: tracking_grants_for_research

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


Question:
Find the total number of courses offered.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM COURSES


Question:
Find the states where have the colleges whose enrollments are less than the largest size.
Additional table information: table: soccer_2

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


Question:
display the ID for those employees who did two or more jobs in the past.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2


Question:
Where is the history department?
Additional table information: table: college_1

Answer: SELECT dept_address FROM department WHERE dept_name = 'History'


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

Answer: SELECT COUNT(*) FROM Accounts


Question:
What are the unique types of player positions in the tryout?
Additional table information: table: soccer_2

Answer: SELECT COUNT(DISTINCT pPos) FROM tryout


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

Answer: SELECT COUNT(*) FROM Tasks


Question:
List the names of all scientists sorted in alphabetical order.
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists ORDER BY name NULLS FIRST


Question:
What is the maximum stars and year for the most recent movie?
Additional table information: table: movie_1

Answer: SELECT MAX(T1.stars), T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MAX(YEAR) FROM Movie)


Question:
What are the sale details and dates of transactions with amount smaller than 3000?
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.sales_details, T2.date_of_transaction FROM SALES AS T1 JOIN TRANSACTIONS AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000


Question:
Find the name of the instructors who taught C Programming course before.
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:
Show total hours per week and number of games played for students under 20.
Additional table information: table: game_1

Answer: SELECT SUM(hoursperweek), SUM(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20


Question:
Which winery is the wine that has the highest score from?
Additional table information: table: wine_1

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


Question:
How many different kinds of lens brands are there?
Additional table information: table: mountain_photos

Answer: SELECT COUNT(DISTINCT brand) FROM camera_lens


Question:
Find the number of employees we have.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM Employees


Question:
What is the name and category code of the product with the highest price?
Additional table information: table: customer_complaints

Answer: SELECT product_name, product_category_code FROM products ORDER BY product_price DESC LIMIT 1


Question:
Show the short names of the buildings managed by 'Emma'.
Additional table information: table: apartment_rentals

Answer: SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = 'Emma'


Question:
What are the phone numbers of customers using the policy with the code 'Life Insurance'?
Additional table information: table: insurance_fnol

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


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

Answer: SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)


Question:
Show each gender code and the corresponding count of guests sorted by the count in descending order.
Additional table information: table: apartment_rentals

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


Question:
How many students have personal names that contain the word 'son'?
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Students WHERE personal_name LIKE '%son%'


Question:
What is the name of the wrestler with the fewest days held?
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler ORDER BY Days_held ASC NULLS FIRST LIMIT 1


Question:
Show the region name with at least two storms.
Additional table information: table: storm_record

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


Question:
Tell me the distinct block codes where some rooms are available.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT blockcode FROM room WHERE unavailable = 0


Question:
Find the average and minimum weight for each gender.
Additional table information: table: candidate_poll

Answer: SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex


Question:
What is the average points of players from club with name 'AIB'.
Additional table information: table: sports_competition

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


Question:
How many movie reviews does each director get?
Additional table information: table: movie_1

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


Question:
What are the names of all singers that are from the UK and released a song in English?
Additional table information: table: music_1

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


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

Answer: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO


Question:
What is the description of the most popular role among users that have logged in?
Additional table information: table: document_management

Answer: SELECT role_description FROM ROLES WHERE role_code = (SELECT role_code FROM users WHERE user_login = 1 GROUP BY role_code ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What is the placement date of the order whose invoice number is 10?
Additional table information: table: tracking_orders

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


Question:
What are the mascots for schools with enrollments above the average?
Additional table information: table: school_finance

Answer: SELECT mascot FROM school WHERE enrollment > (SELECT AVG(enrollment) FROM school)


Question:
List every individual's first name, middle name and last name in alphabetical order by last name.
Additional table information: table: e_government

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


Question:
What are the titles, years, and directors of all movies, ordered by budget in millions?
Additional table information: table: culture_company

Answer: SELECT title, YEAR, director FROM movie ORDER BY budget_million NULLS FIRST


Question:
Which engineer has visited the most times? Show the engineer id, first name and last name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1, Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give me a list of all the service names sorted alphabetically.
Additional table information: table: insurance_fnol

Answer: SELECT service_name FROM services ORDER BY service_name NULLS FIRST


Question:
Find the names of nurses who are on call.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse


Question:
Count the number of stores.
Additional table information: table: sakila_1

Answer: SELECT COUNT(*) FROM store


Question:
Eduardo Martins is a customer at which company?
Additional table information: table: store_1

Answer: SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'


Question:
What is the maximum and mininum number of transit passengers for all airports?
Additional table information: table: aircraft

Answer: SELECT MAX(Transit_Passengers), MIN(Transit_Passengers) FROM airport


Question:
What is the organisation type and id of the organisation which has the most number of research staff?
Additional table information: table: tracking_grants_for_research

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


Question:
Find the names of all reviewers who have ratings with a NULL value for the date.
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:
How many sections does course ACCT-211 has?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT class_section) FROM CLASS WHERE crs_code = 'ACCT-211'


Question:
what is the name of the country that participated in the most tournament competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all the distinct districts for elections.
Additional table information: table: election

Answer: SELECT DISTINCT District FROM election


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

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


Question:
How many distinct payment methods are used by parties?
Additional table information: table: e_government

Answer: SELECT COUNT(DISTINCT payment_method_code) FROM parties


Question:
Count the number of different complaint type codes.
Additional table information: table: customer_complaints

Answer: SELECT COUNT(DISTINCT complaint_type_code) FROM complaints


Question:
What is the total rating of channel for each channel owner?
Additional table information: table: program_share

Answer: SELECT SUM(Rating_in_percent), OWNER FROM channel GROUP BY OWNER


Question:
What are the first and last names of all drivers who participated in the Australian Grand Prix but not the Chinese Grand Prix?
Additional table information: table: formula_1

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


Question:
List the name of all different customers who have some loan sorted by their total loan amount.
Additional table information: table: loan_1

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


Question:
For each grade, return the grade number, the number of classrooms used for the grade, and the total number of students enrolled in the grade.
Additional table information: table: student_1

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


Question:
What is the total number of faculty members?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty


Question:
How many distinct claim outcome codes are there?
Additional table information: table: insurance_and_eClaims

Answer: SELECT COUNT(DISTINCT claim_outcome_code) FROM claims_processing


Question:
What are the last names of female students, ordered by age descending?
Additional table information: table: college_3

Answer: SELECT LName FROM STUDENT WHERE Sex = 'F' ORDER BY Age DESC


Question:
Find the male friend of Alice whose job is a doctor?
Additional table information: table: network_2

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


Question:
List the carriers of devices that have no devices in stock.
Additional table information: table: device

Answer: SELECT Carrier FROM device WHERE NOT Device_ID IN (SELECT Device_ID FROM stock)


Question:
Return the lot details and investor ids.
Additional table information: table: tracking_share_transactions

Answer: SELECT lot_details, investor_id FROM LOTS


Question:
Count the number of different countries that climbers are from.
Additional table information: table: climbing

Answer: SELECT COUNT(DISTINCT Country) FROM climber


Question:
how many different positions are there?
Additional table information: table: sports_competition

Answer: SELECT COUNT(DISTINCT POSITION) FROM player


Question:
What are the distinct visit dates?
Additional table information: table: cre_Theme_park

Answer: SELECT DISTINCT Visit_Date FROM VISITS


Question:
What are the census rankings of cities that do not have the status 'Village'?
Additional table information: table: farm

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


Question:
List the dates of games by the home team name in descending order.
Additional table information: table: game_injury

Answer: SELECT Date FROM game ORDER BY home_team DESC


Question:
How many distinct programs are broadcast at 'Night' time?
Additional table information: table: program_share

Answer: SELECT COUNT(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'


Question:
List each test result and its count in descending order of count.
Additional table information: table: e_learning

Answer: SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC


Question:
Find the countries that have never participated in any competition with Friendly type.
Additional table information: table: sports_competition

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


Question:
What are the ids of the problems reported after the date of any problems reported by Rylan Homenick?
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > (SELECT MAX(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Rylan' AND T4.staff_last_name = 'Homenick')


Question:
Find the organisation ids and details of the organisations which are involved in
Additional table information: table: tracking_grants_for_research

Answer: SELECT T2.organisation_id, T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id HAVING SUM(T1.grant_amount) > 6000


Question:
What is the code of the product type with an average price 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:
How many students does each advisor have?
Additional table information: table: voter_2

Answer: SELECT Advisor, COUNT(*) FROM STUDENT GROUP BY Advisor


Question:
Find the total revenue of companies of each founder.
Additional table information: table: manufactory_1

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


Question:
What are the distinct names of customers with an order status of Pending, sorted by customer id?
Additional table information: table: department_store

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


Question:
Find the names of users who do not have a first notification of loss record.
Additional table information: table: insurance_fnol

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


Question:
Return the the details of all products.
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT product_details FROM products


Question:
Find the name of students who have taken the prerequisite course of the course with title International Finance.
Additional table information: table: college_2

Answer: SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance')


Question:
What are the names and trade names of the medcines that are FDA approved?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name, trade_name FROM medicine WHERE FDA_approved = 'Yes'


Question:
What are the ids and locations of all circuits in France or Belgium?
Additional table information: table: formula_1

Answer: SELECT circuitid, LOCATION FROM circuits WHERE country = 'France' OR country = 'Belgium'


Question:
How many customers don't have an account?
Additional table information: table: customers_and_invoices

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


Question:
Return the name of the organization which has the most contact individuals.
Additional table information: table: e_government

Answer: SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show different occupations along with the number of players in each occupation.
Additional table information: table: riding_club

Answer: SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation


Question:
Find the name and capacity of the dorm with least number of amenities.
Additional table information: table: dorm_1

Answer: SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What is the age of the doctor named Zach?
Additional table information: table: network_2

Answer: SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach'


Question:
Show the minister who took office after 1961 or before 1959.
Additional table information: table: party_people

Answer: SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959


Question:
What are the name of courses that have at least five enrollments?
Additional table information: table: college_3

Answer: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5


Question:
What is the temperature of 'Shanghai' city in January?
Additional table information: table: city_record

Answer: SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = 'Shanghai'


Question:
Find the stories of the building with the largest height.
Additional table information: table: company_office

Answer: SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1


Question:
How many students are age 18?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Student WHERE age = 18


Question:
How many reviewers listed?
Additional table information: table: movie_1

Answer: SELECT COUNT(*) FROM Reviewer


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

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


Question:
What are the ids, types, and details of the organization with the most research staff?
Additional table information: table: tracking_grants_for_research

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


Question:
What is the most common competition type?
Additional table information: table: sports_competition

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


Question:
What is the average duration in milliseconds of tracks that belong to Latin or Pop genre?
Additional table information: table: chinook_1

Answer: SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Latin' OR T1.Name = 'Pop'


Question:
What is the title of the prerequisite class of International Finance course?
Additional table information: table: college_2

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


Question:
What is the year and semester with the most courses?
Additional table information: table: college_2

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


Question:
Find the cities which have exactly two airports.
Additional table information: table: flight_4

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


Question:
What are the distinct registration dates and the election cycles?
Additional table information: table: voter_2

Answer: SELECT DISTINCT Registration_Date, Election_Cycle FROM VOTING_RECORD


Question:
What are the titles of all the Aerosmith albums?
Additional table information: table: store_1

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


Question:
List the name of browsers in descending order by market share.
Additional table information: table: browser_web

Answer: SELECT name FROM browser ORDER BY market_share DESC


Question:
What are the name and active date of the customers whose contact channel code is email?
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name, t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'


Question:
What is the famous release date of the artist with the oldest age?
Additional table information: table: music_4

Answer: SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1


Question:
Show the school name and driver name for all school buses.
Additional table information: table: school_bus

Answer: SELECT T2.school, T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN driver AS T3 ON T1.driver_id = T3.driver_id


Question:
List the distinct director of all films.
Additional table information: table: film_rank

Answer: SELECT DISTINCT Director FROM film


Question:
What are the names of students who haven't taken any Biology courses?
Additional table information: table: college_2

Answer: SELECT name FROM student WHERE NOT id IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')


Question:
Which problems are reported by the staff with first name 'Christop'? Show the descriptions of the problems.
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_description FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Christop'


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

Answer: SELECT name FROM instructor WHERE NOT id IN (SELECT id FROM teaches WHERE semester = 'Spring')


Question:
What are the name and location of the cinema with the largest capacity?
Additional table information: table: cinema

Answer: SELECT name, LOCATION FROM cinema ORDER BY capacity DESC LIMIT 1


Question:
Who is the founder of Sony?
Additional table information: table: manufactory_1

Answer: SELECT founder FROM manufacturers WHERE name = 'Sony'


Question:
Find the number of amenities for each of the dorms that can accommodate more than 100 students.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid


Question:
Give the advisor with the most students.
Additional table information: table: allergy_1

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


Question:
Show the different nationalities and the number of journalists of each nationality.
Additional table information: table: news_report

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


Question:
What is the name and checking balance of the account which has the lowest savings balance?
Additional table information: table: small_bank_1

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


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

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


Question:
Show the positions of the players from the team with name 'Ryley Goldner'.
Additional table information: table: match_season

Answer: SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Ryley Goldner'


Question:
What are the names and trade names of the medicines which has 'Yes' value in the FDA record?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name, trade_name FROM medicine WHERE FDA_approved = 'Yes'


Question:
What are the movie titles with the highest average rating and what are those ratings?
Additional table information: table: movie_1

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


Question:
What is the average age of the members of the club 'Bootup Baltimore'?
Additional table information: table: club_1

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


Question:
Show the most common nationality of pilots.
Additional table information: table: pilot_record

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


Question:
Show the names of phones that are on market with number of shops greater than 50.
Additional table information: table: phone_market

Answer: SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50


Question:
What is the average access count of documents?
Additional table information: table: document_management

Answer: SELECT AVG(access_count) FROM documents


Question:
Show the names and ids of 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:
Which institution does 'Katsuhiro Ueno' belong to?
Additional table information: table: icfp_1

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


Question:
Find the name of companies whose revenue is greater than the average revenue of all companies.
Additional table information: table: manufactory_1

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


Question:
Find the names of scientists who are not working on the project with the highest hours.
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists EXCEPT SELECT 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 MAX(hours) FROM projects)


Question:
Find the products which have problems reported by both Lacey Bosco and Kenton Champlin?
Additional table information: table: tracking_software_problems

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


Question:
What are the names of wines, sorted in alphabetical order?
Additional table information: table: wine_1

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


Question:
What is the name of the most common genre in all tracks?
Additional table information: table: chinook_1

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


Question:
Find the first and last name of students who are not in the largest major.
Additional table information: table: dorm_1

Answer: SELECT fname, lname FROM student WHERE major <> (SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1)


Question:
Which of the airport names contains the word 'international'?
Additional table information: table: flight_company

Answer: SELECT name FROM airport WHERE name LIKE '%international%'


Question:
What is the average weeks on top of volumes associated with the artist aged 25 or younger?
Additional table information: table: music_4

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


Question:
What is the order date of each booking?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Order_Date FROM BOOKINGS


Question:
Give me a list of all the distinct building descriptions.
Additional table information: table: apartment_rentals

Answer: SELECT DISTINCT building_description FROM Apartment_Buildings


Question:
Which paper has the most authors? Give me the paper title.
Additional table information: table: icfp_1

Answer: SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT MAX(authorder) FROM authorship)


Question:
What are the names of the physicians who have 'senior' in their titles.
Additional table information: table: hospital_1

Answer: SELECT name FROM physician WHERE POSITION LIKE '%senior%'


Question:
Find the ids of the nurses who are on call in block floor 1 and block code 1.
Additional table information: table: hospital_1

Answer: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1


Question:
List the names of all songs that have 4 minute duration or are in English.
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '4:%' UNION SELECT song_name FROM song WHERE languages = 'english'


Question:
Which papers did the author 'Olin Shivers' write? Give me the paper titles.
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 = 'Olin' AND t1.lname = 'Shivers'


Question:
How many different bike ids are there?
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT bike_id) FROM trip


Question:
Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.
Additional table information: table: bike_1

Answer: SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING COUNT(*) >= 100


Question:
Which apartments have bookings with status code 'Confirmed'? Return their apartment numbers.
Additional table information: table: apartment_rentals

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


Question:
How many courses are there in total?
Additional table information: table: college_3

Answer: SELECT COUNT(*) FROM COURSE


Question:
What are the full names of faculties with sex M and who live in building NEB?
Additional table information: table: college_3

Answer: SELECT Fname, Lname FROM FACULTY WHERE sex = 'M' AND Building = 'NEB'


Question:
What are the names of the countries and average invoice size of the top countries by size?
Additional table information: table: store_1

Answer: SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10


Question:
What are the ids of all students and number of hours played?
Additional table information: table: game_1

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


Question:
What are the average height and weight across males (sex is M)?
Additional table information: table: candidate_poll

Answer: SELECT AVG(height), AVG(weight) FROM people WHERE sex = 'M'


Question:
Show the names and locations of institutions that are founded after 1990 and have the type 'Private'.
Additional table information: table: protein_institute

Answer: SELECT institution, LOCATION FROM institution WHERE founded > 1990 AND TYPE = 'Private'


Question:
Find the names of all English songs.
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE languages = 'english'


Question:
Find the name of the 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:
Find papers whose second author has last name 'Turon' and is affiliated with an institution in the country 'USA'.
Additional table information: table: icfp_1

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


Question:
What are the ids and names of the architects who built at least 3 bridges ?
Additional table information: table: architecture

Answer: SELECT T1.id, T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) >= 3


Question:
Find the name of the room with the maximum occupancy.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1


Question:
What is the average unit price of tracks that belong to Jazz genre?
Additional table information: table: chinook_1

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


Question:
Find the ids and first names of the 3 teachers that have the most number of assessment notes?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.teacher_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 3


Question:
What is the team and starting year for each technician?
Additional table information: table: machine_repair

Answer: SELECT Team, Starting_Year FROM technician


Question:
Show all official native languages that contain the word 'English'.
Additional table information: table: match_season

Answer: SELECT Official_native_language FROM country WHERE Official_native_language LIKE '%English%'


Question:
Find the titles of items whose rating is higher than the average review rating of all items.
Additional table information: table: epinions_1

Answer: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > (SELECT AVG(rating) FROM review)


Question:
Give the ids of documents that have expenses and contain the letter s in their names.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'


Question:
Give the id and product type of the product with the lowest price.
Additional table information: table: department_store

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


Question:
For each position, what is the maximum number of  hours for students who spent more than 1000 hours training?
Additional table information: table: soccer_2

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


Question:
What are the student ids for students over 20 years old?
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age > 20


Question:
What is the name, city, country, and elevation for every airport 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:
How many documents correspond with each project id?
Additional table information: table: cre_Docs_and_Epenses

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


Question:
How many classes does the professor whose last name is Graztevski teach?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'


Question:
Find the ids of the problems that are reported by the staff whose last name is Bosco.
Additional table information: table: tracking_software_problems

Answer: SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_last_name = 'Bosco'


Question:
What are the names of all students who took a class and the corresponding course descriptions?
Additional table information: table: college_1

Answer: SELECT T1.stu_fname, T1.stu_lname, T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code


Question:
Show times of elimination of wrestlers with days held more than 50.
Additional table information: table: wrestler

Answer: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID WHERE T2.Days_held > 50


Question:
Find the file format that is used by the most files.
Additional table information: table: music_1

Answer: SELECT formats FROM files GROUP BY formats ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the average amount of transactions with type code 'SALE'.
Additional table information: table: tracking_share_transactions

Answer: SELECT AVG(amount_of_transaction) FROM TRANSACTIONS WHERE transaction_type_code = 'SALE'


Question:
How many people are under 40 for each gender?
Additional table information: table: network_2

Answer: SELECT COUNT(*), gender FROM Person WHERE age < 40 GROUP BY gender


Question:
Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.
Additional table information: table: insurance_policies

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


Question:
What are the grade number and classroom number of each class in the list?
Additional table information: table: student_1

Answer: SELECT DISTINCT classroom, grade FROM list


Question:
For each user, return the name and the average rating of reviews given by them.
Additional table information: table: epinions_1

Answer: SELECT T1.name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id


Question:
How many video games have type Massively multiplayer online game?
Additional table information: table: game_1

Answer: SELECT COUNT(*) FROM Video_games WHERE gtype = 'Massively multiplayer online game'


Question:
What are the price ranges of hotels?
Additional table information: table: cre_Theme_park

Answer: SELECT price_range FROM HOTELS


Question:
What are the last names of faculty who are part of the computer science department?
Additional table information: table: college_3

Answer: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = 'Computer Science'


Question:
Count the number of candidates.
Additional table information: table: candidate_poll

Answer: SELECT COUNT(*) FROM candidate


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

Answer: SELECT COUNT(*) FROM school


Question:
List the council tax ids and their related cmi cross references of all the parking fines.
Additional table information: table: local_govt_mdm

Answer: SELECT council_tax_id, cmi_cross_ref_id FROM parking_fines


Question:
In 2014, what are the id and rank of the team that has the largest average number of attendance?
Additional table information: table: baseball_1

Answer: SELECT T2.team_id, T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY AVG(T1.attendance) DESC LIMIT 1


Question:
What are the titles of all movies that have not been rated?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating)


Question:
Give the names and scores of wines made from white grapes.
Additional table information: table: wine_1

Answer: SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White'


Question:
Count the number of trips that did not end in San Francisco city.
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:
Return the last name, id and phone number of the customer who has made the greatest number of orders.
Additional table information: table: customers_and_invoices

Answer: SELECT T2.customer_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many races are there?
Additional table information: table: race_track

Answer: SELECT COUNT(*) FROM race


Question:
Show all track names that have had no races.
Additional table information: table: race_track

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


Question:
List all schools and their nicknames in the order of founded year.
Additional table information: table: university_basketball

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


Question:
How many bookings do we have?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT COUNT(*) FROM BOOKINGS


Question:
Find the average height of the players who belong to the college called 'Yale University'.
Additional table information: table: baseball_1

Answer: SELECT AVG(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'


Question:
List the distinct police forces of counties whose location is not on east side.
Additional table information: table: county_public_safety

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


Question:
For which product was there a problem reported by Christop Berge, with closure authorised by Ashley Medhurst? Return the product ids.
Additional table information: table: tracking_software_problems

Answer: SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Christop' AND T2.staff_last_name = 'Berge' INTERSECT SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Ashley' AND T2.staff_last_name = 'Medhurst'


Question:
Find all the instruments ever used by the musician with last name 'Heilo'?
Additional table information: table: music_2

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


Question:
How many different allergy types exist?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type


Question:
Show the number of accounts.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Accounts


Question:
Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.staff_name, T3.first_name, T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id


Question:
What is the total number of clubs?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club


Question:
display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct <> 'null' OR department_id <> 40


Question:
Count the number of distinct company industries.
Additional table information: table: company_office

Answer: SELECT COUNT(DISTINCT Industry) FROM Companies


Question:
For each denomination, return the denomination and the count of schools with that denomination.
Additional table information: table: school_player

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


Question:
How many regions are affected?
Additional table information: table: storm_record

Answer: SELECT COUNT(DISTINCT region_id) FROM affected_region


Question:
Show all transaction types.
Additional table information: table: customers_card_transactions

Answer: SELECT DISTINCT transaction_type FROM Financial_Transactions


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

Answer: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy


Question:
What are the email addresses and date of births for all customers who have a first name of Carole?
Additional table information: table: driving_school

Answer: SELECT email_address, date_of_birth FROM Customers WHERE first_name = 'Carole'


Question:
How many songs are there?
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM Songs


Question:
Count the number of financial transactions that correspond to each account id.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*), account_id FROM Financial_transactions


Question:
Find the states or counties where the stores with marketing region code 'CA' are located.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.State_County FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Marketing_Region_Code = 'CA'


Question:
What are the ids of all trips that had a duration as long as the average trip duration in the zip code 94103?
Additional table information: table: bike_1

Answer: SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)


Question:
Find the number of phones for each accreditation type.
Additional table information: table: phone_1

Answer: SELECT Accreditation_type, COUNT(*) FROM phone GROUP BY Accreditation_type


Question:
What are the names of actors who have been in the musical titled The Phantom of the Opera?
Additional table information: table: musical

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


Question:
What is the id of the trip that has the shortest duration?
Additional table information: table: bike_1

Answer: SELECT id FROM trip ORDER BY duration NULLS FIRST LIMIT 1


Question:
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.
Additional table information: table: store_1

Answer: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' AND T3.name = 'MPEG audio file'


Question:
How many schools have students playing in goalie and mid-field positions?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM (SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid')


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

Answer: SELECT AVG(hours) FROM projects


Question:
What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
Additional table information: table: store_1

Answer: SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10


Question:
What are the countries that have both mountains that are higher than 5600 and lower than 5200?
Additional table information: table: climbing

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


Question:
What are the enrollment dates of all the tests that have result 'Pass'?
Additional table information: table: e_learning

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


Question:
Find the names of all person sorted in the descending order using age.
Additional table information: table: network_2

Answer: SELECT name FROM Person ORDER BY age DESC


Question:
How many proteins are associated with an institution in a building with at least 20 floors?
Additional table information: table: protein_institute

Answer: SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id JOIN building AS T3 ON T3.building_id = T1.building_id WHERE T3.floors >= 20


Question:
How many albums does Billy Cobham has?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM albums AS T1 JOIN artists AS T2 ON T1.artist_id = T2.id WHERE T2.name = 'Billy Cobham'


Question:
Count the number of chip model that do not have wifi.
Additional table information: table: phone_1

Answer: SELECT COUNT(*) FROM chip_model WHERE wifi = 'No'


Question:
Find the name of the most expensive hardware product.
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:
In how many different states are banks located?
Additional table information: table: loan_1

Answer: SELECT COUNT(DISTINCT state) FROM bank


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

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


Question:
What are the average prices of products, grouped by manufacturer name?
Additional table information: table: manufactory_1

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


Question:
Find the total amount of products ordered before 2018-03-17 07:13:53.
Additional table information: table: customers_and_addresses

Answer: SELECT SUM(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < '2018-03-17 07:13:53'


Question:
How many undergraduates are there at San Jose State
Additional table information: table: csu_1

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


Question:
What are all the labels?
Additional table information: table: music_2

Answer: SELECT DISTINCT label FROM Albums


Question:
Show the student id of the oldest student.
Additional table information: table: allergy_1

Answer: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student)


Question:
Show the ages of gymnasts in descending order of total points.
Additional table information: table: gymnast

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


Question:
what are the first name and last name of all candidates?
Additional table information: table: student_assessment

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


Question:
What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.id, T1.Name, T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC


Question:
Show the names of countries that have more than one roller coaster.
Additional table information: table: roller_coaster

Answer: SELECT T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name HAVING COUNT(*) > 1


Question:
What is the description of the marketing region China?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Marketing_Region_Descriptrion FROM Marketing_Regions WHERE Marketing_Region_Name = 'China'


Question:
What are all the locations with a cinema?
Additional table information: table: cinema

Answer: SELECT DISTINCT LOCATION FROM cinema


Question:
Show names of actors and names of musicals they are in.
Additional table information: table: musical

Answer: SELECT T1.Name, T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID


Question:
What are the maximum and minimum week on top of all volumes?
Additional table information: table: music_4

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


Question:
Show the names of employees with role name Editor.
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
What are the names of actors, ordered alphabetically?
Additional table information: table: musical

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


Question:
Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail.
Additional table information: table: assets_maintenance

Answer: SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) = 2 INTERSECT SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) < 2


Question:
What are the distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'?
Additional table information: table: local_govt_mdm

Answer: SELECT DISTINCT T2.source_system_code FROM customer_master_index AS T1 JOIN cmi_cross_references AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T1.cmi_details = 'Gottlieb ,  Becker and Wyman'


Question:
How many drivers are from Hartford city or younger than 40?
Additional table information: table: school_bus

Answer: SELECT COUNT(*) FROM driver WHERE home_city = 'Hartford' OR age < 40


Question:
Show theme and year for all exhibitions with ticket prices lower than 15.
Additional table information: table: theme_gallery

Answer: SELECT theme, YEAR FROM exhibition WHERE ticket_price < 15


Question:
What is the type and id of the organization that has the most research staff?
Additional table information: table: tracking_grants_for_research

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


Question:
How many employees are living in Canada?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM employees WHERE country = 'Canada'


Question:
What are the days that had the smallest temperature range, and what was that range?
Additional table information: table: bike_1

Answer: SELECT date, max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f NULLS FIRST LIMIT 1


Question:
Find the names of users who did not leave any review.
Additional table information: table: epinions_1

Answer: SELECT name FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)


Question:
What is the average prices of wines for each each?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), YEAR FROM WINE GROUP BY YEAR


Question:
Find the name and attribute ID of the attribute definitions with attribute value 0.
Additional table information: table: product_catalog

Answer: SELECT t1.attribute_name, t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0


Question:
What are the first and last name for those employees who works either in department 70 or 90?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90


Question:
Return the id of the department with the fewest staff assignments.
Additional table information: table: department_store

Answer: SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Find the code of the location with the largest number of documents.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names, checking balances, and savings balances of customers, ordered by the total of checking and savings balances descending?
Additional table information: table: small_bank_1

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


Question:
What is the description of the color used by least products?
Additional table information: table: products_gen_characteristics

Answer: SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Return the positions of players on the team Ryley Goldner.
Additional table information: table: match_season

Answer: SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Ryley Goldner'


Question:
Count the number of distinct instructors who have taught a course.
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT id) FROM teaches


Question:
Show the most common college of authors of submissions.
Additional table information: table: workshop_paper

Answer: SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the phones and emails of workshop groups in which services are performed?
Additional table information: table: cre_Drama_Workshop_Groups

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