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

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


Question:
List all employees in the circulation history of the document with id 1. List the employee's name.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1


Question:
What are the first names of the professors who do not teach a class.
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num


Question:
Find the id of the order made most recently.
Additional table information: table: tracking_orders

Answer: SELECT order_id FROM orders ORDER BY date_order_placed DESC LIMIT 1


Question:
Where does the staff member with the first name Elsa live?
Additional table information: table: sakila_1

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


Question:
What is the investor that has invested in the most number of entrepreneurs?
Additional table information: table: entrepreneur

Answer: SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC LIMIT 1


Question:
Who is the oldest person?
Additional table information: table: network_2

Answer: SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM person)


Question:
Find the name of all customers whose name contains 'Alex'.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers WHERE customer_name LIKE '%Alex%'


Question:
Show the transaction type code that occurs the most frequently.
Additional table information: table: tracking_share_transactions

Answer: SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of all directors who made one movie?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1


Question:
What are the names of the courses in alphabetical order?
Additional table information: table: student_assessment

Answer: SELECT course_name FROM courses ORDER BY course_name NULLS FIRST


Question:
Show all the faculty ranks and the number of students advised by each rank.
Additional table information: table: activity_1

Answer: SELECT T1.rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank


Question:
What are the all games score and location of the school called Clemson?
Additional table information: table: university_basketball

Answer: SELECT t2.All_Games, t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'


Question:
When did the first payment happen?
Additional table information: table: sakila_1

Answer: SELECT payment_date FROM payment ORDER BY payment_date ASC NULLS FIRST LIMIT 1


Question:
What are the ids of all songs that have higher resolution of the average resolution in the modern genre?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = 'modern')


Question:
What are the aircrafts with top 3 shortest lengthes? List their names.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft ORDER BY distance NULLS FIRST LIMIT 3


Question:
Find the female friends of Alice.
Additional table information: table: network_2

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


Question:
What are the names of courses with 1 credit?
Additional table information: table: college_3

Answer: SELECT CName FROM COURSE WHERE Credits = 1


Question:
What is the oldest age among the students?
Additional table information: table: voter_2

Answer: SELECT MAX(Age) FROM STUDENT


Question:
Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.
Additional table information: table: hospital_1

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


Question:
List the main industry with highest total market value and its number of companies.
Additional table information: table: gas_company

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


Question:
How many policies are listed for the customer named 'Dayana Robel'?
Additional table information: table: insurance_fnol

Answer: SELECT COUNT(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = 'Dayana Robel'


Question:
Find the name, checking balance and saving balance of all accounts in the bank.
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


Question:
Return the names of artists and the themes of their exhibitions that had a ticket price higher than average.
Additional table information: table: theme_gallery

Answer: SELECT T1.theme, T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT AVG(ticket_price) FROM exhibition)


Question:
What is the name of the nurse has the most appointments?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many employees who are IT staff are from each city?
Additional table information: table: store_1

Answer: SELECT COUNT(*), city FROM employees WHERE title = 'IT Staff' GROUP BY city


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

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


Question:
Count the number of storms in which at least 1 person died.
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM storm WHERE Number_Deaths > 0


Question:
List the name and residence for players whose occupation is not 'Researcher'.
Additional table information: table: riding_club

Answer: SELECT Player_name, residence FROM player WHERE Occupation <> 'Researcher'


Question:
Compute the total amount of settlement across all the settlements.
Additional table information: table: insurance_policies

Answer: SELECT SUM(Amount_Settled) FROM Settlements


Question:
What are the names and genders of staff who have held the title Sales Person, but never Clerical Staff?
Additional table information: table: department_store

Answer: SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = 'Sales Person' EXCEPT SELECT T1.staff_name, T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = 'Clerical Staff'


Question:
What are the different role codes for users, and how many users have each?
Additional table information: table: document_management

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


Question:
What are the details of the shops that can be accessed by walk?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Shop_Details FROM SHOPS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Shop_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = 'walk'


Question:
Find all the locations whose names contain the word 'film'.
Additional table information: table: cre_Theme_park

Answer: SELECT Location_Name FROM LOCATIONS WHERE Location_Name LIKE '%film%'


Question:
How many cities are in counties that have populations of over 20000?
Additional table information: table: county_public_safety

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


Question:
What is the first name and last name of the customer that has email 'luisg@embraer.com.br'?
Additional table information: table: chinook_1

Answer: SELECT FirstName, LastName FROM CUSTOMER WHERE Email = 'luisg@embraer.com.br'


Question:
Find the name and position of the head of the department with the least employees.
Additional table information: table: hospital_1

Answer: SELECT T2.name, T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
What are the first name and last name of the players who have weight above 220 or height below 75?
Additional table information: table: baseball_1

Answer: SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75


Question:
What is the total salary expenses of team Boston Red Stockings in 2010?
Additional table information: table: baseball_1

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


Question:
Show the details of all trucks in the order of their license number.
Additional table information: table: customer_deliveries

Answer: SELECT truck_details FROM trucks ORDER BY truck_licence_number NULLS FIRST


Question:
What is the average distance and price for all flights from LA?
Additional table information: table: flight_1

Answer: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = 'Los Angeles'


Question:
List the names of all left-footed players who have overall rating between 85 and 90.
Additional table information: table: soccer_1

Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = 'left' AND T2.overall_rating >= 85 AND T2.overall_rating <= 90


Question:
How many movie ratings have more than 3 stars?
Additional table information: table: movie_1

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


Question:
What is the total amount of money loaned by banks in New York state?
Additional table information: table: loan_1

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


Question:
What is the average price for flights from LA to Honolulu?
Additional table information: table: flight_1

Answer: SELECT AVG(price) FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
What is the name of the customer who has made the largest amount of claim in a single claim?
Additional table information: table: insurance_and_eClaims

Answer: SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT MAX(amount_claimed) FROM claim_headers)


Question:
What are the names of different music genres?
Additional table information: table: chinook_1

Answer: SELECT Name FROM GENRE


Question:
Show the name and the nationality of the oldest host.
Additional table information: table: party_host

Answer: SELECT Name, Nationality FROM HOST ORDER BY Age DESC LIMIT 1


Question:
What are the different first names for customers from Brazil who have also had an invoice?
Additional table information: table: chinook_1

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


Question:
For each state, find the total account balance of customers whose credit score is above 100.
Additional table information: table: loan_1

Answer: SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state


Question:
Find the names of products that were bought by at least two distinct customers.
Additional table information: table: department_store

Answer: SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT(DISTINCT T1.customer_id) >= 2


Question:
What is the description of the product named 'Chocolate'?
Additional table information: table: customer_complaints

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


Question:
What is the name of member in charge of greatest number of events?
Additional table information: table: party_people

Answer: SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
List all students' first names and last names who majored in 600.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Major = 600


Question:
Show the delegate from district 1 in election.
Additional table information: table: election

Answer: SELECT Delegate FROM election WHERE District = 1


Question:
What are the ids of documents which don't have expense budgets?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
Show names for all regions except for Denmark.
Additional table information: table: storm_record

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


Question:
How many distinct complaint type codes are there in the database?
Additional table information: table: customer_complaints

Answer: SELECT COUNT(DISTINCT complaint_type_code) FROM complaints


Question:
What are the names of documents that do not have any images?
Additional table information: table: document_management

Answer: SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id


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

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


Question:
IN which year did city 'Taizhou ( Zhejiang )' serve as a host city?
Additional table information: table: city_record

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


Question:
Find the name of songs that does not have a back vocal.
Additional table information: table: music_2

Answer: SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE TYPE = 'back'


Question:
Given the titles of all courses, in order of titles and credits.
Additional table information: table: college_2

Answer: SELECT title FROM course ORDER BY title NULLS FIRST, credits NULLS FIRST


Question:
Find the id of the order whose shipment tracking number is '3452'.
Additional table information: table: tracking_orders

Answer: SELECT order_id FROM shipments WHERE shipment_tracking_number = '3452'


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

Answer: SELECT COUNT(*) FROM Flight


Question:
Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.
Additional table information: table: store_1

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


Question:
What are the duration of the longest and shortest pop tracks in milliseconds?
Additional table information: table: chinook_1

Answer: SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'


Question:
Which authors have first name 'Amal'? List their last names.
Additional table information: table: icfp_1

Answer: SELECT lname FROM authors WHERE fname = 'Amal'


Question:
How many stadiums does each country have?
Additional table information: table: swimming

Answer: SELECT country, COUNT(*) FROM stadium GROUP BY country


Question:
Find the names of all stores in Khanewal District.
Additional table information: table: store_product

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


Question:
Return the code of the document type that is most common.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
What is the average attendance of stadiums with capacity percentage higher than 100%?
Additional table information: table: game_injury

Answer: SELECT average_attendance FROM stadium WHERE capacity_percentage > 100


Question:
What are the names of all people, ordered by their date of birth?
Additional table information: table: candidate_poll

Answer: SELECT name FROM people ORDER BY date_of_birth NULLS FIRST


Question:
What are the amenities in alphabetical order that Anonymous Donor Hall has?
Additional table information: table: dorm_1

Answer: SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name NULLS FIRST


Question:
List the name, origin and owner of each program.
Additional table information: table: program_share

Answer: SELECT name, origin, OWNER FROM program


Question:
How many faculty lines are there at San Francisco State University in 2004?
Additional table information: table: csu_1

Answer: SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2004 AND T2.campus = 'San Francisco State University'


Question:
How many heads of the departments are older than 56 ?
Additional table information: table: department_management

Answer: SELECT COUNT(*) FROM head WHERE age > 56


Question:
what are the top 3 highest support rates?
Additional table information: table: candidate_poll

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


Question:
What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina?
Additional table information: table: driving_school

Answer: SELECT customer_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = 'Marina' OR last_name = 'Kohler'


Question:
When is the last day any resident moved in?
Additional table information: table: local_govt_and_lot

Answer: SELECT MAX(date_moved_in) FROM Residents


Question:
Find the state of the college which player Charles is attending.
Additional table information: table: soccer_2

Answer: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles'


Question:
How many technicians are there?
Additional table information: table: machine_repair

Answer: SELECT COUNT(*) FROM technician


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

Answer: SELECT COUNT(*) FROM Accounts


Question:
Find the classrooms in which grade 4 is studying.
Additional table information: table: student_1

Answer: SELECT DISTINCT classroom FROM list WHERE grade = 4


Question:
What are the start station's name and id for the one that had the most start trips in August?
Additional table information: table: bike_1

Answer: SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE '8/%' GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which city has the lowest GDP? Please list the city name and its GDP.
Additional table information: table: city_record

Answer: SELECT city, GDP FROM city ORDER BY GDP NULLS FIRST LIMIT 1


Question:
What is the document type code for document type 'Paper'?
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Show all destinations and the number of flights to each destination.
Additional table information: table: flight_1

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


Question:
Find the names of all patients who have an undergoing treatment and are staying in room 111.
Additional table information: table: hospital_1

Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111


Question:
Show all home cities except for those having a driver older than 40.
Additional table information: table: school_bus

Answer: SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40


Question:
Show the name of ships whose nationality is either United States or United Kingdom.
Additional table information: table: ship_mission

Answer: SELECT Name FROM ship WHERE Nationality = 'United States' OR Nationality = 'United Kingdom'


Question:
What are the average score and average staff number of all shops?
Additional table information: table: coffee_shop

Answer: SELECT AVG(num_of_staff), AVG(score) FROM shop


Question:
What are names of the movies that are either made before 1980 or directed by James Cameron?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE director = 'James Cameron' OR YEAR < 1980


Question:
Show all director names who have a movie in the year 1999 or 2000.
Additional table information: table: culture_company

Answer: SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000


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

Answer: SELECT COUNT(*) FROM Student


Question:
Show all investor details.
Additional table information: table: tracking_share_transactions

Answer: SELECT Investor_details FROM INVESTORS


Question:
What are the names of the pilots that have not won any matches in Australia?
Additional table information: table: aircraft

Answer: SELECT name FROM pilot WHERE NOT pilot_id IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia')


Question:
Find the name of amenities Smith Hall dorm have. ordered the results by amenity names.
Additional table information: table: dorm_1

Answer: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name NULLS FIRST


Question:
Find the ids of orders whose status is 'Success'.
Additional table information: table: customer_deliveries

Answer: SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success'


Question:
What is the date, average temperature and mean humidity for the days with the 3 largest maximum gust speeds?
Additional table information: table: bike_1

Answer: SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3


Question:
Find the names of the courses that have just one student enrollment.
Additional table information: table: e_learning

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


Question:
What are the names of staff who have been assigned multiple jobs?
Additional table information: table: department_store

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


Question:
What are the names and job titles of every person ordered alphabetically by name?
Additional table information: table: network_2

Answer: SELECT name, job FROM Person ORDER BY name NULLS FIRST


Question:
How many enzymes do not have any interactions?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT COUNT(*) FROM enzyme WHERE NOT id IN (SELECT enzyme_id FROM medicine_enzyme_interaction)


Question:
List the name of tracks belongs to genre Rock or genre Jazz.
Additional table information: table: store_1

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


Question:
What are names of patients who made an appointment?
Additional table information: table: hospital_1

Answer: SELECT name FROM appointment AS T1 JOIN patient AS T2 ON T1.patient = T2.ssn


Question:
How many clubs are located at 'HHH'?
Additional table information: table: club_1

Answer: SELECT COUNT(*) FROM club WHERE clublocation = 'HHH'


Question:
For each director, what is the title and score of their most poorly rated movie?
Additional table information: table: movie_1

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


Question:
What are the names and types of the companies that have ever operated a flight?
Additional table information: table: flight_company

Answer: SELECT T1.name, T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id


Question:
List the locations that are shared by more than two wrestlers.
Additional table information: table: wrestler

Answer: SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2


Question:
What are the distinct first names of the students who have class president votes?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE


Question:
What are the categories of music festivals for which there have been more than 1 music festival?
Additional table information: table: music_4

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


Question:
display job title and average salary of employees.
Additional table information: table: hr_1

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


Question:
What is the name, city, and country of the airport with the lowest altitude?
Additional table information: table: flight_4

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


Question:
Count the number of products.
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM products


Question:
What is the description of document type 'Paper'?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = 'Paper'


Question:
What is the name of all tracks in the album named Balls to the Wall?
Additional table information: table: store_1

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


Question:
What is the stories of highest building?
Additional table information: table: company_office

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


Question:
What is the document status description of the document with id 1?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1


Question:
Count the number of clubs located at 'HHH'.
Additional table information: table: club_1

Answer: SELECT COUNT(*) FROM club WHERE clublocation = 'HHH'


Question:
For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id, COUNT(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id


Question:
List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000


Question:
What are the names of the races held after 2017 in Spain?
Additional table information: table: formula_1

Answer: SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = 'Spain' AND T1.year > 2017


Question:
Give the name and building of the departments with greater than average budget.
Additional table information: table: college_2

Answer: SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department)


Question:
Show the park of the roller coaster with the highest speed.
Additional table information: table: roller_coaster

Answer: SELECT Park FROM roller_coaster ORDER BY Speed DESC LIMIT 1


Question:
Count the number of songs.
Additional table information: table: music_2

Answer: SELECT COUNT(*) FROM Songs


Question:
Show the id, name of each festival and the number of artworks it has nominated.
Additional table information: table: entertainment_awards

Answer: SELECT T1.Festival_ID, T3.Festival_Name, COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID


Question:
Show the average, minimum, and maximum age for different majors.
Additional table information: table: game_1

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


Question:
How many exhibition are there in year 2005 or after?
Additional table information: table: theme_gallery

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


Question:
What is the name, account type, and account balance corresponding to the customer with the highest credit score?
Additional table information: table: loan_1

Answer: SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1


Question:
What are the job ids corresponding to jobs with average salary above 8000?
Additional table information: table: hr_1

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


Question:
What are the names of documents that contain the substring 'CV'?
Additional table information: table: document_management

Answer: SELECT document_name FROM documents WHERE document_name LIKE '%CV%'


Question:
Which faculty members advise two ore more students? Give me their faculty ids.
Additional table information: table: activity_1

Answer: SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING COUNT(*) >= 2


Question:
Count the number of colors.
Additional table information: table: products_gen_characteristics

Answer: SELECT COUNT(*) FROM ref_colors


Question:
What are the teams that have the 5 oldest players?
Additional table information: table: school_player

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


Question:
list the first and last names, and the addresses of all employees in the ascending order of their birth date.
Additional table information: table: company_1

Answer: SELECT fname, lname, address FROM employee ORDER BY Bdate NULLS FIRST


Question:
Count the number of cities in the state of Colorado.
Additional table information: table: e_government

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


Question:
What are names for top three branches with most number of membership?
Additional table information: table: shop_membership

Answer: SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3


Question:
Find the name of students who took some course offered by Statistics department.
Additional table information: table: college_2

Answer: SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics'


Question:
Show the names of people, and dates and venues of debates they are on the affirmative side.
Additional table information: table: debate

Answer: SELECT T3.Name, T2.Date, T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID


Question:
What is the name of the shop that has the greatest quantity of devices in stock?
Additional table information: table: device

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


Question:
Return the lot details of lots that belong to investors with details 'l'?
Additional table information: table: tracking_share_transactions

Answer: SELECT T2.lot_details FROM INVESTORS AS T1 JOIN LOTS AS T2 ON T1.investor_id = T2.investor_id WHERE T1.Investor_details = 'l'


Question:
Find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
Additional table information: table: loan_1

Answer: SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_id = T2.branch_id JOIN customer AS T3 ON T1.cust_id = T3.cust_id WHERE T3.credit_score < 100


Question:
List the cities which have more than 2 airports sorted by the number of airports.
Additional table information: table: flight_4

Answer: SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*) NULLS FIRST


Question:
Show the number of documents with document type code CV or BK.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM All_documents WHERE document_type_code = 'CV' OR document_type_code = 'BK'


Question:
How many workshops did each author submit to? Return the author name and the number of workshops.
Additional table information: table: workshop_paper

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


Question:
What is the team name and acc regular season score of the school that was founded for the longest time?
Additional table information: table: university_basketball

Answer: SELECT t2.team_name, t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded NULLS FIRST LIMIT 1


Question:
What are the numbers of all flights that can cover a distance of more than 2000?
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight WHERE distance > 2000


Question:
What are the maximum and minimum number of silver medals for all the clubs?
Additional table information: table: sports_competition

Answer: SELECT MAX(Silver), MIN(Silver) FROM club_rank


Question:
What is the number of faculty lines in campus 'Long Beach State University' in 2002?
Additional table information: table: csu_1

Answer: SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2002 AND T2.campus = 'Long Beach State University'


Question:
List all document ids and receipt dates of documents.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id, receipt_date FROM Documents


Question:
Retrieve all the last names of authors in alphabetical order.
Additional table information: table: icfp_1

Answer: SELECT lname FROM authors ORDER BY lname NULLS FIRST


Question:
How many students does one classroom have?
Additional table information: table: student_1

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


Question:
What is the first and last name of the oldest employee?
Additional table information: table: college_1

Answer: SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob NULLS FIRST LIMIT 1


Question:
Return the names of the regions affected by storms that had a death count of at least 10.
Additional table information: table: storm_record

Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10


Question:
Count the number of ships.
Additional table information: table: ship_1

Answer: SELECT COUNT(*) FROM ship


Question:
Count the number of rooms in Lamberton with capacity lower than 50.
Additional table information: table: college_2

Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50


Question:
List the id of students who never attends courses?
Additional table information: table: student_assessment

Answer: SELECT student_id FROM students WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)


Question:
What are the names of customers with a higher checking balance than 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 JOIN savings AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance


Question:
How many services are there?
Additional table information: table: e_government

Answer: SELECT COUNT(*) FROM services


Question:
How many games were played in city Atlanta in 2000?
Additional table information: table: baseball_1

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


Question:
Find the distinct names of all songs that have a higher resolution than some songs in English.
Additional table information: table: music_1

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


Question:
What are the names and decor of rooms with a king bed? Sort them by their price
Additional table information: table: inn_1

Answer: SELECT roomName, decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice NULLS FIRST


Question:
Return the name of the member who is in charge of the most events.
Additional table information: table: party_people

Answer: SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1


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

Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major ORDER BY COUNT(Major) ASC NULLS FIRST LIMIT 1


Question:
Who is the person that has no friend?
Additional table information: table: network_2

Answer: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend


Question:
Which cities have regional population above 8000000 or below 5000000?
Additional table information: table: city_record

Answer: SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000


Question:
Find the city with the most number of stores.
Additional table information: table: store_product

Answer: SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the names of companies in the banking or retailing industry?
Additional table information: table: company_employee

Answer: SELECT Name FROM company WHERE Industry = 'Banking' OR Industry = 'Retailing'


Question:
What is the name and age of the pilot younger than 30 who has won the most number of times?
Additional table information: table: aircraft

Answer: SELECT t1.name, t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each director, how many reviews have they received?
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 and type codes of products?
Additional table information: table: solvency_ii

Answer: SELECT Product_Name, Product_Type_Code FROM Products


Question:
Show names of ships involved in a mission launched after 1928.
Additional table information: table: ship_mission

Answer: SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928


Question:
Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in.
Additional table information: table: hospital_1

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


Question:
Find the total revenue created by the companies whose headquarter is located at Austin.
Additional table information: table: manufactory_1

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


Question:
Which program is broadcast most frequently? Give me the program name.
Additional table information: table: program_share

Answer: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the degrees conferred in 'San Francisco State University' in 2001.
Additional table information: table: csu_1

Answer: SELECT degrees FROM campuses AS T1 JOIN degrees AS T2 ON t1.id = t2.campus WHERE t1.campus = 'San Francisco State University' AND t2.year = 2001


Question:
What are the distinct types of the companies that have operated any flights with velocity less than 200?
Additional table information: table: flight_company

Answer: SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200


Question:
What are the maximum and minimum number of transit passengers of all aiports.
Additional table information: table: aircraft

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


Question:
What is all the information of all the products that have a price between 60 and 120?
Additional table information: table: manufactory_1

Answer: SELECT * FROM products WHERE price BETWEEN 60 AND 120


Question:
What are the descriptions for each color?
Additional table information: table: products_gen_characteristics

Answer: SELECT color_description FROM ref_colors


Question:
Show the status shared by cities with population bigger than 1500 and smaller than 500.
Additional table information: table: farm

Answer: SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500


Question:
What are the ranks of captains that are both in the Cutter and Armed schooner classes?
Additional table information: table: ship_1

Answer: SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'


Question:
Find all procedures which cost more than 1000 or which physician John Wen was trained in.
Additional table information: table: hospital_1

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


Question:
Show name, class, and date for all races.
Additional table information: table: race_track

Answer: SELECT name, CLASS, date FROM race


Question:
What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
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.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1


Question:
List phone number and email address of customer with more than 2000 outstanding balance.
Additional table information: table: driving_school

Answer: SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000


Question:
What are the enrollment and primary conference for the university which was founded the earliest?
Additional table information: table: university_basketball

Answer: SELECT enrollment, primary_conference FROM university ORDER BY founded NULLS FIRST LIMIT 1


Question:
Show the average amount of transactions for different lots.
Additional table information: table: tracking_share_transactions

Answer: SELECT T2.lot_id, AVG(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id


Question:
How many different scientists are assigned to any project?
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT scientist) FROM assignedto


Question:
What are the names of ships, ordered by year they were built and their class?
Additional table information: table: ship_1

Answer: SELECT name FROM ship ORDER BY built_year NULLS FIRST, CLASS NULLS FIRST


Question:
Tell me the location of the club 'Hopkins Student Enterprises'.
Additional table information: table: club_1

Answer: SELECT clublocation FROM club WHERE clubname = 'Hopkins Student Enterprises'


Question:
What are the names of scientists who are assigned to any project?
Additional table information: table: scientist_1

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


Question:
Find the total student enrollment for different affiliation type schools.
Additional table information: table: university_basketball

Answer: SELECT SUM(enrollment), affiliation FROM university GROUP BY affiliation


Question:
What is the name of the department that offers a course that has a description including the word 'Statistics'?
Additional table information: table: college_1

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


Question:
What are the names of the tracks that are Rock or Jazz songs?
Additional table information: table: store_1

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


Question:
Show the company of the tallest entrepreneur.
Additional table information: table: entrepreneur

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


Question:
What are the details of all sales and purchases?
Additional table information: table: tracking_share_transactions

Answer: SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases


Question:
List the file size and format for all songs that have resolution lower than 800.
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 800


Question:
Which department offers the most credits all together?
Additional table information: table: college_1

Answer: SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY SUM(T1.crs_credit) DESC LIMIT 1


Question:
display the full name (first and last name ) of employee with ID and name of the country presently where (s)he is working.
Additional table information: table: hr_1

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


Question:
Show all directors.
Additional table information: table: cinema

Answer: SELECT DISTINCT directed_by FROM film


Question:
What are the ids of the trips that lasted the longest and how long did they last?
Additional table information: table: bike_1

Answer: SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3


Question:
How many players played each position?
Additional table information: table: match_season

Answer: SELECT POSITION, COUNT(*) FROM match_season GROUP BY POSITION


Question:
What are the most common types of interactions between enzymes and medicine, and how many types are there?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT interaction_type, COUNT(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of parties.
Additional table information: table: party_host

Answer: SELECT COUNT(*) FROM party


Question:
List the names of all courses ordered by their titles and credits.
Additional table information: table: college_2

Answer: SELECT title FROM course ORDER BY title NULLS FIRST, credits NULLS FIRST


Question:
How many products are there?
Additional table information: table: solvency_ii

Answer: SELECT COUNT(*) FROM Products


Question:
What are the draft pick numbers and draft classes for players who play the Defender position?
Additional table information: table: match_season

Answer: SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE POSITION = 'Defender'


Question:
What is the average price of the products for each category?
Additional table information: table: customer_complaints

Answer: SELECT AVG(product_price), product_category_code FROM products GROUP BY product_category_code


Question:
Find the total budgets of the Marketing or Finance department.
Additional table information: table: college_2

Answer: SELECT SUM(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'


Question:
What are the names of representatives in descending order of votes?
Additional table information: table: election_representative

Answer: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC


Question:
Find the first names of the faculty members who are playing Canoeing or Kayaking.
Additional table information: table: activity_1

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


Question:
What is the most common result of the music festival?
Additional table information: table: music_4

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


Question:
What are the names and revenues of the companies with the highest revenues in each headquarter city?
Additional table information: table: manufactory_1

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


Question:
How many colleges has more than 15000 students?
Additional table information: table: soccer_2

Answer: SELECT COUNT(*) FROM College WHERE enr > 15000


Question:
What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction?
Additional table information: table: cre_Theme_park

Answer: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = '254 Ottilie Junction' OR T2.How_to_Get_There = 'bus'


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

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


Question:
What is the average price of clothes?
Additional table information: table: department_store

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


Question:
What is the name of teh studio that created the most films?
Additional table information: table: film_rank

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


Question:
What is the storm name and max speed which affected the greatest number of regions?
Additional table information: table: storm_record

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


Question:
Find the names of programs that are never broadcasted in the morning.
Additional table information: table: program_share

Answer: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning'


Question:
What city and state is the bank with the name morningside in?
Additional table information: table: loan_1

Answer: SELECT city, state FROM bank WHERE bname = 'morningside'


Question:
Find the names of customers who never placed an order.
Additional table information: table: customers_and_addresses

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


Question:
Find the number of different airports which are the destinations of the American Airlines.
Additional table information: table: flight_4

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


Question:
What address was the document with id 4 mailed to?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4


Question:
What are the ids and details of events that have more than one participants?
Additional table information: table: local_govt_in_alabama

Answer: SELECT T1.event_id, T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING COUNT(*) > 1


Question:
What are the titles of the books whose writer is not 'Elaine Lee'?
Additional table information: table: book_2

Answer: SELECT Title FROM book WHERE Writer <> 'Elaine Lee'


Question:
How many credits is the course that the student with the last name Smithson took, and what is its description?
Additional table information: table: college_1

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


Question:
What are the ids of courses offered in Fall of 2009 but not in Spring of 2010?
Additional table information: table: college_2

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


Question:
Find the grade studying in room 105.
Additional table information: table: student_1

Answer: SELECT DISTINCT grade FROM list WHERE classroom = 105


Question:
What is the name of the course with the most registered students?
Additional table information: table: student_assessment

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


Question:
What are the actual delivery dates of orders with quantity 1?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1


Question:
What are the grapes and appelations of each wine?
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation FROM WINE


Question:
Show names and seatings, ordered by seating for all tracks opened after 2000.
Additional table information: table: race_track

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


Question:
Find the name and flag of ships that are not steered by any captain with Midshipman rank.
Additional table information: table: ship_1

Answer: SELECT name, flag FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')


Question:
What are the names of all races held after 2000 in Spain?
Additional table information: table: formula_1

Answer: SELECT DISTINCT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = 'Spain' AND T1.year > 2000


Question:
What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT T2.product_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id WHERE T1.date_order_placed >= '1975-01-01' AND T1.date_order_placed <= '1976-01-01'


Question:
Show the names of editors and the theme of journals for which they serve on committees.
Additional table information: table: journal_committee

Answer: SELECT T2.Name, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID


Question:
What are the heights of body builders with total score smaller than 315?
Additional table information: table: body_builder

Answer: SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315


Question:
What are the wifi and screen mode type of the hardware model named 'LG-P760'?
Additional table information: table: phone_1

Answer: SELECT T1.WiFi, T3.Type FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T2.Hardware_Model_name = 'LG-P760'


Question:
Find the name, headquarter and revenue of all manufacturers sorted by their revenue in the descending order.
Additional table information: table: manufactory_1

Answer: SELECT name, headquarter, revenue FROM manufacturers ORDER BY revenue DESC


Question:
What is the course description and number of credits for QM-261?
Additional table information: table: college_1

Answer: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'QM-261'


Question:
What is the maximum OMIM value in the database?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT MAX(OMIM) FROM enzyme


Question:
How many documents are there of each type?
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Show the name of track with most number of races.
Additional table information: table: race_track

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


Question:
What is the name of the dorm with both a TV Lounge and Study Room listed as amenities?
Additional table information: table: dorm_1

Answer: SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room'


Question:
What are the countries for appelations with at most 3 wines?
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT(*) <= 3


Question:
Please show the most common occupation of players.
Additional table information: table: riding_club

Answer: SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the manager with the most gas stations that opened after 2000?
Additional table information: table: gas_company

Answer: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
display the employee ID for each employee and the date on which he ended his previous job.
Additional table information: table: hr_1

Answer: SELECT employee_id, MAX(end_date) FROM job_history GROUP BY employee_id


Question:
What is the number of branches that have more than the average number of memberships?
Additional table information: table: shop_membership

Answer: SELECT COUNT(*) FROM branch WHERE membership_amount > (SELECT AVG(membership_amount) FROM branch)


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

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


Question:
What is the total number of people who could stay in the modern rooms in this inn?
Additional table information: table: inn_1

Answer: SELECT SUM(maxOccupancy) FROM Rooms WHERE decor = 'modern'


Question:
Where does the customer with the first name Linda live? And what is her email?
Additional table information: table: sakila_1

Answer: SELECT T2.address, T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'


Question:
List the names of pilots that do not have any record.
Additional table information: table: pilot_record

Answer: SELECT Pilot_name FROM pilot WHERE NOT Pilot_ID IN (SELECT Pilot_ID FROM pilot_record)


Question:
What is the total number of hours per week and number of games played by 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:
Find the team of each player and sort them in ascending alphabetical order.
Additional table information: table: school_player

Answer: SELECT Team FROM player ORDER BY Team ASC NULLS FIRST


Question:
Find the number of apartments that have no facility.
Additional table information: table: apartment_rentals

Answer: SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)


Question:
Return the type code of the document named 'David CV'.
Additional table information: table: document_management

Answer: SELECT document_type_code FROM documents WHERE document_name = 'David CV'


Question:
What is the number of routes whose destinations are Italian airports?
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:
What is the venue of the competition '1994 FIFA World Cup qualification' hosted by 'Nanjing ( Jiangsu )'?
Additional table information: table: city_record

Answer: SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = 'Nanjing ( Jiangsu )' AND T3.competition = '1994 FIFA World Cup qualification'


Question:
What are the description and credit of the course which the student whose last name is Smithson took?
Additional table information: table: college_1

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


Question:
How many budgets are above 3000 in year 2001 or before?
Additional table information: table: school_finance

Answer: SELECT COUNT(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001


Question:
Find the common login name of course authors and students.
Additional table information: table: e_learning

Answer: SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students


Question:
Please show the results of music festivals and the number of music festivals that have had each, ordered by this count.
Additional table information: table: music_4

Answer: SELECT RESULT, COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC


Question:
List the name of ships whose nationality is not 'United States'.
Additional table information: table: ship_mission

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


Question:
How many students who are female are allergic to milk or eggs?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = 'F' AND T1.allergy = 'Milk' OR T1.allergy = 'Eggs'


Question:
What are the ids of all students who are not video game players?
Additional table information: table: game_1

Answer: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games


Question:
Count the number of tests with 'Fail' result.
Additional table information: table: e_learning

Answer: SELECT COUNT(*) FROM Student_Tests_Taken WHERE test_result = 'Fail'


Question:
Give me the names of members whose address is in Harford or Waterbury.
Additional table information: table: coffee_shop

Answer: SELECT name FROM member WHERE address = 'Harford' OR address = 'Waterbury'


Question:
List the description of the outcomes for all projects.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code


Question:
Show the police force shared by counties with location on the east and west.
Additional table information: table: county_public_safety

Answer: SELECT Police_force FROM county_public_safety WHERE LOCATION = 'East' INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = 'West'


Question:
How many proteins are associated with an institution founded after 1880 or an institution with type 'Private'?
Additional table information: table: protein_institute

Answer: SELECT COUNT(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id WHERE T1.founded > 1880 OR T1.type = 'Private'


Question:
Show customer ids who don't have an account.
Additional table information: table: customers_and_invoices

Answer: SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts


Question:
How many locations are listed in the database?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM Ref_locations


Question:
List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15.
Additional table information: table: phone_1

Answer: SELECT DISTINCT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15


Question:
How many products are there in the records?
Additional table information: table: product_catalog

Answer: SELECT COUNT(*) FROM catalog_contents


Question:
Show the role description and the id of the project staff involved in most number of project outcomes?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.role_description, T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids, full names, and phones of each customer?
Additional table information: table: customers_card_transactions

Answer: SELECT customer_id, customer_first_name, customer_last_name, customer_phone FROM Customers


Question:
Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.
Additional table information: table: scientist_1

Answer: 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.name = 'Matter of Time' INTERSECT 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.name = 'A Puzzling Parallax'


Question:
What are the names and damage in millions for storms, ordered by their max speeds descending?
Additional table information: table: storm_record

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


Question:
How many different products are produced in each headquarter city?
Additional table information: table: manufactory_1

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


Question:
Return the name of the document that has the most sections.
Additional table information: table: document_management

Answer: SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Count the number of artists who are older than 46 and joined after 1990.
Additional table information: table: theme_gallery

Answer: SELECT COUNT(*) FROM artist WHERE age > 46 AND year_join > 1990


Question:
How many employees live in Georgia?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Addresses WHERE state_province_county = 'Georgia'


Question:
How many songs use drums as an instrument?
Additional table information: table: music_2

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


Question:
Which organizations are not a parent organization of others? List the organization id.
Additional table information: table: local_govt_and_lot

Answer: SELECT organization_id FROM organizations EXCEPT SELECT parent_organization_id FROM organizations


Question:
What are the different ids and stop durations of all the drivers whose stop lasted longer than the driver in the race with the id 841?
Additional table information: table: formula_1

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


Question:
Find the distinct locations that has a cinema.
Additional table information: table: cinema

Answer: SELECT DISTINCT LOCATION FROM cinema


Question:
Count the total number of apartment bookings.
Additional table information: table: apartment_rentals

Answer: SELECT COUNT(*) FROM Apartment_Bookings


Question:
What are the ids of instructors who didnt' teach?
Additional table information: table: college_2

Answer: SELECT id FROM instructor EXCEPT SELECT id FROM teaches


Question:
Count the number of Professors who have office in building NEB.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Rank = 'Professor' AND building = 'NEB'


Question:
How many members are in each party?
Additional table information: table: party_people

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


Question:
What is the maximum, minimum and average years spent working on a school bus?
Additional table information: table: school_bus

Answer: SELECT MAX(years_working), MIN(years_working), AVG(years_working) FROM school_bus


Question:
What are all the document type codes and document type names?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT document_type_code, document_type_name FROM Ref_document_types


Question:
How many products have their color described as 'white' or have a characteristic with the name 'hot'?
Additional table information: table: products_gen_characteristics

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


Question:
Please show the titles of films and the types of market estimations.
Additional table information: table: film_rank

Answer: SELECT T1.Title, T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID


Question:
Which wineries produce at least four wines?
Additional table information: table: wine_1

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


Question:
What are the details and opening hours of the museums?
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Museum_Details, T2.Opening_Hours FROM MUSEUMS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Museum_ID = T2.Tourist_Attraction_ID


Question:
display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name.
Additional table information: table: hr_1

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


Question:
What are the locations that have both tracks with more than 90000 seats, and tracks with fewer than 70000 seats?
Additional table information: table: race_track

Answer: SELECT LOCATION FROM track WHERE seating > 90000 INTERSECT SELECT LOCATION FROM track WHERE seating < 70000


Question:
What are the names of everybody who has exactly one friend?
Additional table information: table: network_2

Answer: SELECT name FROM PersonFriend GROUP BY name HAVING COUNT(*) = 1


Question:
What are the names of managers in ascending order of level?
Additional table information: table: railway

Answer: SELECT Name FROM manager ORDER BY LEVEL ASC NULLS FIRST


Question:
What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?
Additional table information: table: medicine_enzyme_interaction

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


Question:
How many instruments does the song 'Badlands' use?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Badlands'


Question:
Return the name and id of the furniture with the highest market rate.
Additional table information: table: manufacturer

Answer: SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1


Question:
How many distinct allergies are there?
Additional table information: table: allergy_1

Answer: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type


Question:
Find the name all districts with city area greater than 10 or population larger than 100000
Additional table information: table: store_product

Answer: SELECT district_name FROM district WHERE city_area > 10 OR City_Population > 100000


Question:
Which tourist attractions are visited at least twice? Give me their names and ids.
Additional table information: table: cre_Theme_park

Answer: SELECT T1.Name, T2.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(*) >= 2


Question:
Find the ids of the students who participate in Canoeing and Kayaking.
Additional table information: table: activity_1

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


Question:
How many sections does each course has?
Additional table information: table: college_1

Answer: SELECT COUNT(*), crs_code FROM CLASS GROUP BY crs_code


Question:
What are the code and description of the least frequent detention type ?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.detention_type_code, T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show first name for all students with major 600.
Additional table information: table: game_1

Answer: SELECT Fname FROM Student WHERE Major = 600


Question:
Show names for all aircraft with at least two flights.
Additional table information: table: flight_1

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


Question:
What is the type of the organization with the most research staff?
Additional table information: table: tracking_grants_for_research

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


Question:
What are the room name and base price of the room with the lowest base price?
Additional table information: table: inn_1

Answer: SELECT roomName, basePrice FROM Rooms ORDER BY basePrice ASC NULLS FIRST LIMIT 1


Question:
Show distinct first and last names for all customers with an account.
Additional table information: table: customers_card_transactions

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


Question:
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
Additional table information: table: mountain_photos

Answer: SELECT brand, name FROM camera_lens ORDER BY max_aperture DESC


Question:
What are the names of all wines produced in 2008?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR = '2008'


Question:
How many rooms does each block floor have?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*), T1.blockfloor FROM BLOCK AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor


Question:
What are the names of all songs that have a lower rating than some song of blues genre?
Additional table information: table: music_1

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


Question:
Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500?
Additional table information: table: farm

Answer: SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500


Question:
What are the different card type codes, and how many different customers hold each type?
Additional table information: table: customers_card_transactions

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


Question:
What is the name of the country with the most number of home airlines?
Additional table information: table: flight_4

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


Question:
Show the most common apartment type code.
Additional table information: table: apartment_rentals

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


Question:
Show the starting years shared by technicians from team 'CLE' and 'CWS'.
Additional table information: table: machine_repair

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


Question:
Show last names for all student who are on scholarship.
Additional table information: table: game_1

Answer: SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'


Question:
Show the parties that have both representatives in New York state and representatives in Pennsylvania state.
Additional table information: table: election_representative

Answer: SELECT Party FROM representative WHERE State = 'New York' INTERSECT SELECT Party FROM representative WHERE State = 'Pennsylvania'


Question:
How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.
Additional table information: table: apartment_rentals

Answer: SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code


Question:
Find the average age of students who are living in the dorm with the largest capacity.
Additional table information: table: dorm_1

Answer: SELECT AVG(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT MAX(student_capacity) FROM dorm)


Question:
What is Astrid Gruber's email and phone number?
Additional table information: table: store_1

Answer: SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'


Question:
How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010?
Additional table information: table: inn_1

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


Question:
Find the name and salary of the instructors who are advisors of any student from History department?
Additional table information: table: college_2

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


Question:
What are the names of all tryout participants who are from the largest college?
Additional table information: table: soccer_2

Answer: SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)


Question:
What are all the distinct details of the customers?
Additional table information: table: insurance_policies

Answer: SELECT DISTINCT customer_details FROM Customers


Question:
Find the number of kids staying in the rooms reserved by a person called ROY SWEAZ.
Additional table information: table: inn_1

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


Question:
How many music festivals have had each kind of result, ordered descending by count?
Additional table information: table: music_4

Answer: SELECT RESULT, COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC


Question:
Wat is the tax source system code and master customer id of the taxes related to each parking fine id?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.source_system_code, T1.master_customer_id, T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Parking_Fines AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id


Question:
How many parties are there?
Additional table information: table: party_host

Answer: SELECT COUNT(*) FROM party


Question:
Which faculty do not participate in any activity? Find their faculty ids.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in


Question:
What are the states or counties of the address of the stores with marketing region code 'CA'?
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:
List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper' EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'


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

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


Question:
What is the average age of the female students with secretary votes in the spring election cycle?
Additional table information: table: voter_2

Answer: SELECT AVG(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = 'F' AND T2.Election_Cycle = 'Spring'


Question:
What are total salaries and department id for each department that has more than 2 employees?
Additional table information: table: hr_1

Answer: SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) >= 2


Question:
Find the names of females who are friends with Zach
Additional table information: table: network_2

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


Question:
Return the name of the wrestler who had the lowest number of days held.
Additional table information: table: wrestler

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


Question:
Find the name of the tryout players who are from the college with largest size.
Additional table information: table: soccer_2

Answer: SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)


Question:
List all the types of forms.
Additional table information: table: e_government

Answer: SELECT DISTINCT form_type_code FROM forms


Question:
What are the countries of all airlines whose names start with Orbit?
Additional table information: table: flight_4

Answer: SELECT country FROM airlines WHERE name LIKE 'Orbit%'


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

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


Question:
Find the number of students for the cities where have more than one student.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 1


Question:
What is the maximum and minimum grade point of students who live in NYC?
Additional table information: table: college_3

Answer: SELECT MAX(T2.gradepoint), MIN(T2.gradepoint) FROM ENROLLED_IN AS T1, GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = 'NYC'


Question:
Return the total number of distinct customers.
Additional table information: table: customers_and_addresses

Answer: SELECT COUNT(*) FROM customers


Question:
What are the names of artists who did not have an exhibition in 2004?
Additional table information: table: theme_gallery

Answer: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004


Question:
What are the last names that are used by customers and staff?
Additional table information: table: driving_school

Answer: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff


Question:
Return the phone number of the customer who filed the complaint that was raised most recently.
Additional table information: table: customer_complaints

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


Question:
Show the hometowns shared by people older than 23 and younger than 20.
Additional table information: table: gymnast

Answer: SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20


Question:
What is the average age and how many male students are there in each city?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), AVG(age), city_code FROM student WHERE sex = 'M' GROUP BY city_code


Question:
Select the name of the products with a price less than or equal to $200.
Additional table information: table: manufactory_1

Answer: SELECT name FROM products WHERE price <= 200


Question:
Give the phones for departments in room 268.
Additional table information: table: college_3

Answer: SELECT DPhone FROM DEPARTMENT WHERE Room = 268


Question:
What is the average, maximum, and minimum budget for all movies before 2000.
Additional table information: table: culture_company

Answer: SELECT AVG(budget_million), MAX(budget_million), MIN(budget_million) FROM movie WHERE YEAR < 2000


Question:
Count the total number of roles listed.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT COUNT(*) FROM ROLES


Question:
How many members does the club 'Tennis Club' has?
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:
Show the first names and last names of customers without any account.
Additional table information: table: customers_card_transactions

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


Question:
What is the average rating for right-footed players and left-footed players?
Additional table information: table: soccer_1

Answer: SELECT preferred_foot, AVG(overall_rating) FROM Player_Attributes GROUP BY preferred_foot


Question:
how many people are there whose weight is higher than 85 for each gender?
Additional table information: table: candidate_poll

Answer: SELECT COUNT(*), sex FROM people WHERE weight > 85 GROUP BY sex


Question:
Show all region code and region name sorted by the codes.
Additional table information: table: storm_record

Answer: SELECT region_code, region_name FROM region ORDER BY region_code NULLS FIRST


Question:
Find the average age and number of male students (with sex M) from each city.
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), AVG(age), city_code FROM student WHERE sex = 'M' GROUP BY city_code


Question:
Give me the title and highest price for each film.
Additional table information: table: cinema

Answer: SELECT T2.title, MAX(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id


Question:
List the name of actors whose age is not 20.
Additional table information: table: musical

Answer: SELECT Name FROM actor WHERE Age <> 20


Question:
Show all the locations with at least two cinemas with capacity above 300.
Additional table information: table: cinema

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


Question:
List the publication dates of publications with 3 lowest prices.
Additional table information: table: book_2

Answer: SELECT Publication_Date FROM publication ORDER BY Price ASC NULLS FIRST LIMIT 3


Question:
Return the first names of the 5 staff members who have handled the most complaints.
Additional table information: table: customer_complaints

Answer: SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY COUNT(*) NULLS FIRST LIMIT 5


Question:
Show all artist names and the number of exhibitions for each artist.
Additional table information: table: theme_gallery

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


Question:
What is all the information on the airport with the largest number of international passengers?
Additional table information: table: aircraft

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


Question:
How many services are there?
Additional table information: table: insurance_fnol

Answer: SELECT COUNT(*) FROM services


Question:
Show the times used by climbers to climb mountains in Country Uganda.
Additional table information: table: climbing

Answer: SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = 'Uganda'


Question:
What are the coupon amount of the coupons owned by both good and bad customers?
Additional table information: table: products_for_hire

Answer: SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'


Question:
What is the total number of degrees granted after 2000 for each Orange county campus?
Additional table information: table: csu_1

Answer: SELECT T1.campus, SUM(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = 'Orange' AND T2.year >= 2000 GROUP BY T1.campus


Question:
What are the phones of departments in Room 268?
Additional table information: table: college_3

Answer: SELECT DPhone FROM DEPARTMENT WHERE Room = 268


Question:
What are the years of opening for tracks with seating between 4000 and 5000?
Additional table information: table: race_track

Answer: SELECT year_opened FROM track WHERE seating BETWEEN 4000 AND 5000


Question:
How many distinct kinds of injuries happened after season 2010?
Additional table information: table: game_injury

Answer: SELECT COUNT(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010


Question:
Return the cell phone number and email address for all students.
Additional table information: table: behavior_monitoring

Answer: SELECT cell_mobile_number, email_address FROM STUDENTS


Question:
List the height and weight of people in descending order of height.
Additional table information: table: body_builder

Answer: SELECT Height, Weight FROM people ORDER BY Height DESC


Question:
Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.
Additional table information: table: music_4

Answer: SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2


Question:
List the id, color scheme, and name for all the photos.
Additional table information: table: mountain_photos

Answer: SELECT id, color, name FROM photos


Question:
Find the name of the products that are not using the most frequently-used max page size.
Additional table information: table: store_product

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


Question:
What is the name of the artist, for each language, that has the most songs with a higher resolution than 500?
Additional table information: table: music_1

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


Question:
How many regions do we have?
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM region


Question:
How many students are enrolled in colleges that have student accepted during tryouts, and in which states are those colleges?
Additional table information: table: soccer_2

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


Question:
List all club names in descending alphabetical order.
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY name DESC


Question:
How many characteristics does the product named 'laurel' 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 JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = 'laurel'


Question:
How many papers are written by authors from the institution 'University of Pennsylvania'?
Additional table information: table: icfp_1

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


Question:
Count the number of invoices.
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Invoices


Question:
What is the average number of bank customers?
Additional table information: table: loan_1

Answer: SELECT AVG(no_of_customers) FROM bank


Question:
List the names of roller coasters by ascending order of length.
Additional table information: table: roller_coaster

Answer: SELECT Name FROM roller_coaster ORDER BY LENGTH ASC NULLS FIRST


Question:
Find the number of web accelerators used for each Operating system.
Additional table information: table: browser_web

Answer: SELECT Operating_system, COUNT(*) FROM web_client_accelerator GROUP BY Operating_system


Question:
Find the locations that have more than one movie theater with capacity above 300.
Additional table information: table: cinema

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


Question:
display those employees who joined after 7th September, 1987.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date > '1987-09-07'


Question:
Find the names of all physicians and their primary affiliated departments' names.
Additional table information: table: hospital_1

Answer: SELECT T1.name, T3.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1


Question:
List all the document names which contains 'CV'.
Additional table information: table: document_management

Answer: SELECT document_name FROM documents WHERE document_name LIKE '%CV%'


Question:
How many Bangladeshi artists are listed?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM artist WHERE country = 'Bangladesh'