Question:
what is the address of history department?
Additional table information: table: college_1

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


Question:
Count the total number of settlements made.
Additional table information: table: insurance_policies

Answer: SELECT COUNT(*) FROM Settlements


Question:
Find all the name of documents without any sections.
Additional table information: table: document_management

Answer: SELECT document_name FROM documents WHERE NOT document_code IN (SELECT document_code FROM document_sections)


Question:
Return the full names and salaries for employees with first names that end with the letter m.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE first_name LIKE '%m'


Question:
What are the staff roles of the staff who
Additional table information: table: tracking_grants_for_research

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


Question:
What are the distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = 'PIT'


Question:
What are the titles of all albums that start with A in alphabetical order?
Additional table information: table: store_1

Answer: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title NULLS FIRST


Question:
What are the different membership levels?
Additional table information: table: shop_membership

Answer: SELECT COUNT(DISTINCT LEVEL) FROM member


Question:
What campus has the most faculties in 2003?
Additional table information: table: csu_1

Answer: SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1


Question:
How many different colleges do attend the tryout test?
Additional table information: table: soccer_2

Answer: SELECT COUNT(DISTINCT cName) FROM tryout


Question:
What are the names of products that have never been ordered?
Additional table information: table: customers_and_invoices

Answer: SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id


Question:
What are all of the products whose name includes the substring 'Scanner'?
Additional table information: table: store_product

Answer: SELECT product FROM product WHERE product LIKE '%Scanner%'


Question:
List the votes of elections in descending order.
Additional table information: table: election_representative

Answer: SELECT Votes FROM election ORDER BY Votes DESC


Question:
Find the name of the swimmer who has the most records.
Additional table information: table: swimming

Answer: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY COUNT(*) DESC LIMIT 1


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

Answer: SELECT Name, LOCATION FROM wrestler


Question:
Find the name and ID of the product whose total order quantity is the largest.
Additional table information: table: customers_and_addresses

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


Question:
List all the name of organizations in order of the date formed.
Additional table information: table: e_government

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


Question:
How many manufacturers have headquarters in either Tokyo or Beijing?
Additional table information: table: manufactory_1

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


Question:
What are the ids of all employees that don't have certificates?
Additional table information: table: flight_1

Answer: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate


Question:
what is the name and age of the youngest winning pilot?
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 ORDER BY t1.age NULLS FIRST LIMIT 1


Question:
Find all the male members of club 'Hopkins Student Enterprises'. Show the first name and last name.
Additional table information: table: club_1

Answer: SELECT t3.fname, t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Hopkins Student Enterprises' AND t3.sex = 'M'


Question:
How many products are there for each manufacturer?
Additional table information: table: manufactory_1

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


Question:
Find the number of professors with a Ph.D. degree in each department.
Additional table information: table: college_1

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


Question:
Show the names of pilots and the number of records they have.
Additional table information: table: pilot_record

Answer: SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name


Question:
Which rank is the most common among captains?
Additional table information: table: ship_1

Answer: SELECT rank FROM captain GROUP BY rank ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of gymnasts, ordered by their heights ascending?
Additional table information: table: gymnast

Answer: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC NULLS FIRST


Question:
Show the order ids and the number of invoices for each order.
Additional table information: table: customers_and_invoices

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


Question:
On average, how old are the members in the club 'Hopkins Student Enterprises'?
Additional table information: table: club_1

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


Question:
What is the average fastest lap speed for races held after 2004, for each race, ordered by year?
Additional table information: table: formula_1

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


Question:
What is the most popular file format?
Additional table information: table: music_1

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


Question:
What is the reviewer id of Daniel Lewis?
Additional table information: table: movie_1

Answer: SELECT rID FROM Reviewer WHERE name = 'Daniel Lewis'


Question:
What are the names and arrival times of trains?
Additional table information: table: railway

Answer: SELECT Name, Arrival FROM train


Question:
Give me the name of each club.
Additional table information: table: club_1

Answer: SELECT clubname FROM club


Question:
Find the names of the clubs that have at least a member from the city with city code 'HOU'.
Additional table information: table: club_1

Answer: SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = 'HOU'


Question:
Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'.
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'


Question:
For each advisor, report the total number of students advised by him or her.
Additional table information: table: voter_2

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


Question:
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
Additional table information: table: architecture

Answer: SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'


Question:
Show the accelerator names and supporting operating systems that are not compatible with the browser named 'Opera'.
Additional table information: table: browser_web

Answer: SELECT name, operating_system FROM web_client_accelerator EXCEPT SELECT T1.name, T1.operating_system FROM web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.name = 'Opera'


Question:
What are the minimum, average, and maximum quantities ordered? Check all the invoices.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT MIN(Order_Quantity), AVG(Order_Quantity), MAX(Order_Quantity) FROM INVOICES


Question:
Find the number of records of each policy type and its type code.
Additional table information: table: insurance_and_eClaims

Answer: SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code


Question:
List all manufacturer names and ids ordered by their opening year.
Additional table information: table: manufacturer

Answer: SELECT name, manufacturer_id FROM manufacturer ORDER BY open_year NULLS FIRST


Question:
What is average enrollment of colleges in the state FL?
Additional table information: table: soccer_2

Answer: SELECT AVG(enr) FROM College WHERE state = 'FL'


Question:
What is the total number of airlines?
Additional table information: table: flight_4

Answer: SELECT COUNT(*) FROM airlines


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

Answer: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code


Question:
Show all product names and the total quantity ordered for each product name.
Additional table information: table: customers_and_invoices

Answer: SELECT T2.product_name, SUM(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name


Question:
For each project id, how many staff does it have? List them in increasing order.
Additional table information: table: tracking_grants_for_research

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


Question:
What are the details and star ratings of the three hotels with the lowest price ranges?
Additional table information: table: cre_Theme_park

Answer: SELECT other_hotel_details, star_rating_code FROM HOTELS ORDER BY price_range ASC NULLS FIRST LIMIT 3


Question:
What are the campuses that opened in 1958?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE YEAR = 1958


Question:
What are the ids of all moviest hat have not been reviewed by Britanny Harris?
Additional table information: table: movie_1

Answer: SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris'


Question:
What are the account details with the largest value or with value having char '5' in it?
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Which state can address '6862 Kaitlyn Knolls' possibly be in?
Additional table information: table: e_government

Answer: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE '%6862 Kaitlyn Knolls%'


Question:
How many employees have certificate.
Additional table information: table: flight_1

Answer: SELECT COUNT(DISTINCT eid) FROM Certificate


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

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


Question:
How many students are in each department?
Additional table information: table: college_1

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


Question:
Find the names of all modern rooms with a base price below $160 and two beds.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern'


Question:
What is the average total number of passengers for all airports that the aircraft 'Robinson R-22' visits?
Additional table information: table: aircraft

Answer: SELECT AVG(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = 'Robinson R-22'


Question:
What are all the distinct asset models?
Additional table information: table: assets_maintenance

Answer: SELECT DISTINCT asset_model FROM Assets


Question:
What are the employee ids for those who had two or more jobs.
Additional table information: table: hr_1

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


Question:
What is the total number of games played?
Additional table information: table: game_1

Answer: SELECT SUM(gamesplayed) FROM Sportsinfo


Question:
What are the names of the cameras that have taken picture of the most mountains?
Additional table information: table: mountain_photos

Answer: SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of reviewers who had given higher than 3 star ratings.
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3


Question:
What are the names of modern rooms that have a base price lower than $160 and two beds.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern'


Question:
What are the names of the songs by the artist whose last name is 'Heilo'?
Additional table information: table: music_2

Answer: SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = 'Heilo'


Question:
Which kind of policy type was chosen by the most customers?
Additional table information: table: insurance_policies

Answer: SELECT Policy_Type_Code FROM Customer_Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which colleges have both authors with submission score above 90 and authors with submission score below 80?
Additional table information: table: workshop_paper

Answer: SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80


Question:
What are the names of customers who have purchased both products Latte and Americano?
Additional table information: table: customers_and_addresses

Answer: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'


Question:
What are the names of artist whose exhibitions draw over 200 attendees on average?
Additional table information: table: theme_gallery

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


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

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


Question:
Find all the songs whose name contains the word 'the'.
Additional table information: table: music_2

Answer: SELECT title FROM songs WHERE title LIKE '% the %'


Question:
Show the race class and number of races in each class.
Additional table information: table: race_track

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


Question:
Find the states where have some college students in tryout and their decisions are yes.
Additional table information: table: soccer_2

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


Question:
What is the customer id, first and last name with least number of accounts.
Additional table information: table: customers_card_transactions

Answer: SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the name for regions and the number of storms for each region.
Additional table information: table: storm_record

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


Question:
For each start station id, what is its name, longitude and average duration of trips started there?
Additional table information: table: bike_1

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


Question:
Find the number of patients who are not using the medication of Procrastin-X.
Additional table information: table: hospital_1

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


Question:
What are the names of the artists that are from the UK and sang songs in English?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT artist_name FROM song WHERE languages = 'english'


Question:
What are the names of schools with the top 3 largest size?
Additional table information: table: soccer_2

Answer: SELECT cName FROM college ORDER BY enr DESC LIMIT 3


Question:
Show the flight number of flights with three lowest distances.
Additional table information: table: flight_1

Answer: SELECT flno FROM Flight ORDER BY distance ASC NULLS FIRST LIMIT 3


Question:
What are the details and id of the project with the most outcomes?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.project_details, T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the venues of all the matches? Sort them in the descending order of match date.
Additional table information: table: city_record

Answer: SELECT venue FROM MATCH ORDER BY date DESC


Question:
Which event names were used more than twice for party events?
Additional table information: table: party_people

Answer: SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2


Question:
What is the name of the project that has a scientist assigned to it whose name contains 'Smith'?
Additional table information: table: scientist_1

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


Question:
Find the id and rank of the team that has the highest average attendance rate in 2014.
Additional table information: table: baseball_1

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


Question:
Name the background colour for the Australian Capital Territory.
Additional table information: table: regional_marketing
columns: state_territory, text_bg_color, format, current_slogan, current_series, Notes

Answer: SELECT text_bg_color FROM "regional_marketing" WHERE State/territory = 'Australian Capital Territory'


Question:
Which program was launched most recently? Return the program name.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch DESC LIMIT 1


Question:
What are the first names and offices of history professors who don't have Ph.D.s?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree <> 'Ph.D.'


Question:
Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.
Additional table information: table: product_catalog

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


Question:
Find the country of the airlines whose name starts with 'Orbit'.
Additional table information: table: flight_4

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


Question:
Find the prices of products which has never received a single complaint.
Additional table information: table: customer_complaints

Answer: SELECT product_price FROM products WHERE NOT product_id IN (SELECT product_id FROM complaints)


Question:
find the total market rate of the furnitures that have the top 2 market shares.
Additional table information: table: manufacturer

Answer: SELECT SUM(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2


Question:
What is the average number of attendance at home games for each year?
Additional table information: table: baseball_1

Answer: SELECT YEAR, AVG(attendance) FROM home_game GROUP BY YEAR


Question:
What is the total account balance for customers with a credit score of above 100 for the different states?
Additional table information: table: loan_1

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


Question:
What are the names of artist who have the letter 'a' in their names?
Additional table information: table: chinook_1

Answer: SELECT Name FROM ARTIST WHERE Name LIKE '%a%'


Question:
What are the song names for every song whose rating is less than the minimum rating for English songs?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MIN(rating) FROM song WHERE languages = 'english')


Question:
Show the names of editors that are on the committee of journals with sales bigger than 3000.
Additional table information: table: journal_committee

Answer: SELECT T2.Name 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 WHERE T3.Sales > 3000


Question:
How many customers use each payment method?
Additional table information: table: department_store

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


Question:
Find the address of the location named 'UK Gallery'.
Additional table information: table: cre_Theme_park

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


Question:
Find the average credit score of the customers who do not have any loan.
Additional table information: table: loan_1

Answer: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)


Question:
Give the budget type code that is most common among documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
What are id and name of the products whose price is lower than 600 or higher than 900?
Additional table information: table: department_store

Answer: SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900


Question:
What are the first name, last name and id of the player with the most all star game experiences? Also list the count.
Additional table information: table: baseball_1

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


Question:
Which activity has the most faculty members participating in? Find the activity name.
Additional table information: table: activity_1

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


Question:
What are the famous titles of the artist 'Triumfall'?
Additional table information: table: music_4

Answer: SELECT Famous_Title FROM artist WHERE Artist = 'Triumfall'


Question:
What are the names of studios that have made two or more films?
Additional table information: table: film_rank

Answer: SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2


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

Answer: SELECT COUNT(*) FROM Accounts


Question:
What are the maximum and minimum budget of the departments?
Additional table information: table: department_management

Answer: SELECT MAX(budget_in_billions), MIN(budget_in_billions) FROM department


Question:
Return the average age across all gymnasts.
Additional table information: table: gymnast

Answer: SELECT AVG(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID


Question:
What are the states of the colleges where students who tried out for the striker position attend?
Additional table information: table: soccer_2

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


Question:
For each race name, What is the maximum fastest lap speed for races after 2004 ordered by year?
Additional table information: table: formula_1

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


Question:
Show distinct types of artworks that are nominated in festivals in 2007.
Additional table information: table: entertainment_awards

Answer: SELECT DISTINCT T2.Type 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 WHERE T3.Year = 2007


Question:
Compute the average number of hosts for parties.
Additional table information: table: party_host

Answer: SELECT AVG(Number_of_hosts) FROM party


Question:
How many aircrafts are there?
Additional table information: table: aircraft

Answer: SELECT COUNT(*) FROM aircraft


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

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


Question:
Count the number of students the teacher LORIA ONDERSMA teaches.
Additional table information: table: student_1

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


Question:
Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles.
Additional table information: table: sakila_1

Answer: SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200


Question:
List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.
Additional table information: table: medicine_enzyme_interaction

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


Question:
What are the maximum and minimum resolution of songs whose duration is 3 minutes?
Additional table information: table: music_1

Answer: SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '3:%'


Question:
How many book clubs are there?
Additional table information: table: culture_company

Answer: SELECT COUNT(*) FROM book_club


Question:
What is the average money requested by all entrepreneurs?
Additional table information: table: entrepreneur

Answer: SELECT AVG(Money_Requested) FROM entrepreneur


Question:
Find the busiest destination airport that runs most number of routes in China.
Additional table information: table: flight_4

Answer: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many distinct courses are enrolled in by students?
Additional table information: table: e_learning

Answer: SELECT COUNT(course_id) FROM Student_Course_Enrolment


Question:
Find the capacity and gender type of the dorm whose name has substring ‘Donor’.
Additional table information: table: dorm_1

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


Question:
Show the names of artworks in ascending order of the year they are nominated in.
Additional table information: table: entertainment_awards

Answer: SELECT T2.Name 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 ORDER BY T3.Year NULLS FIRST


Question:
How many people have membership in the club 'Pen and Paper Gaming'?
Additional table information: table: club_1

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


Question:
What is the last name of the professor whose office is located in DRE 102, and when were they hired?
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'


Question:
List all company names with a book published by Alyson.
Additional table information: table: culture_company

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


Question:
What are the names of all tracks that are on the Movies playlist but not in the music playlist?
Additional table information: table: store_1

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


Question:
How many artists are above age 46 and joined after 1990?
Additional table information: table: theme_gallery

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


Question:
what are the average and maximum attendances of all events?
Additional table information: table: news_report

Answer: SELECT AVG(Event_Attendance), MAX(Event_Attendance) FROM event


Question:
Find the name and population of district with population between 200000 and 2000000
Additional table information: table: store_product

Answer: SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000


Question:
Who are the different players and how many years has each played?
Additional table information: table: match_season

Answer: SELECT Player, Years_Played FROM player


Question:
Which staff handled least number of payments? List the full name and the id.
Additional table information: table: sakila_1

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


Question:
What is the total number of routes for each country and airline in that country?
Additional table information: table: flight_4

Answer: SELECT T1.country, T1.name, COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name


Question:
Find the name of the user who gives the most reviews.
Additional table information: table: epinions_1

Answer: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the product type codes which have at least two products.
Additional table information: table: customers_and_products_contacts

Answer: SELECT product_type_code FROM products GROUP BY product_type_code HAVING COUNT(*) >= 2


Question:
What are the different names, locations, and products of the enzymes that are capable inhibitor interactions?
Additional table information: table: medicine_enzyme_interaction

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


Question:
What are the names and distances for all airplanes?
Additional table information: table: flight_1

Answer: SELECT name, distance FROM Aircraft


Question:
find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.
Additional table information: table: gas_company

Answer: SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3


Question:
Find the ids of the departments where any manager is managing 4 or more employees.
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
What is the city with the smallest GDP? Return the city and its GDP.
Additional table information: table: city_record

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


Question:
Return the name, rate, check in and check out date for the room with the highest rate.
Additional table information: table: inn_1

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


Question:
Give me the minimum and maximum bathroom count among all the apartments.
Additional table information: table: apartment_rentals

Answer: SELECT MIN(bathroom_count), MAX(bathroom_count) FROM Apartments


Question:
What are the ids of all female students who play football?
Additional table information: table: game_1

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


Question:
How many hours do the players train on average?
Additional table information: table: soccer_2

Answer: SELECT AVG(HS) FROM Player


Question:
What are the names of customers who have not taken a Mortage loan?
Additional table information: table: loan_1

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


Question:
Find the names of the top 10 airlines that operate the most number of routes.
Additional table information: table: flight_4

Answer: SELECT T1.name, T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T2.alid ORDER BY COUNT(*) DESC LIMIT 10


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

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


Question:
Show the names of members that have a rank in round higher than 3.
Additional table information: table: decoration_competition

Answer: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Rank_in_Round > 3


Question:
What are the ids of documents with letter 's' in the name with any expense budgets.
Additional table information: table: cre_Docs_and_Epenses

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


Question:
Count the number of people of each sex who have a weight higher than 85.
Additional table information: table: candidate_poll

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


Question:
Find the purchase time, age and address of each member, and show the results in the order of purchase time.
Additional table information: table: coffee_shop

Answer: SELECT Time_of_purchase, age, address FROM member ORDER BY Time_of_purchase NULLS FIRST


Question:
What are the names of all games played by Linda Smith?
Additional table information: table: game_1

Answer: SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = 'Smith' AND T3.Fname = 'Linda'


Question:
What are the first names of all the different drivers in alphabetical order?
Additional table information: table: formula_1

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


Question:
Find the number of different departments in each school whose number of different departments is less than 5.
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code HAVING COUNT(DISTINCT dept_name) < 5


Question:
What is the song with the most vocals?
Additional table information: table: music_2

Answer: SELECT title FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid GROUP BY T1.songid ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the id of the candidate who most recently accessed the course?
Additional table information: table: student_assessment

Answer: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1


Question:
What is the maximum point for climbers whose country is United Kingdom?
Additional table information: table: climbing

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


Question:
What are the names of the directors who made exactly one movie excluding director NULL?
Additional table information: table: movie_1

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


Question:
Which organisation hired the most number of research staff? List the organisation id, type and detail.
Additional table information: table: tracking_grants_for_research

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


Question:
List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200.
Additional table information: table: body_builder

Answer: SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T1.snatch > 140 OR T2.height > 200


Question:
Return the type of transaction with the highest total amount.
Additional table information: table: customers_card_transactions

Answer: SELECT transaction_type FROM Financial_transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) DESC LIMIT 1


Question:
Count the total number of games the team Boston Red Stockings attended from 1990 to 2000.
Additional table information: table: baseball_1

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


Question:
Which catalog contents has price above 700 dollars? Show their catalog entry names and capacities.
Additional table information: table: product_catalog

Answer: SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700


Question:
Return the minimum, average and maximum distances traveled across all aircrafts.
Additional table information: table: flight_1

Answer: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft


Question:
What are the names of all students taking a course who received an A or C?
Additional table information: table: college_1

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


Question:
Show the ids of the employees who don't authorize destruction for any document.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
Show all party names and the number of members 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:
From the trip record, find the number of unique bikes.
Additional table information: table: bike_1

Answer: SELECT COUNT(DISTINCT bike_id) FROM trip


Question:
Which employees have either destroyed a document or made an authorization to do so? Return their employee ids.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
Find the order detail for the products with price above 2000.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Other_Item_Details FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_price > 2000


Question:
What is the average rating for each movie that has never been reviewed by Brittany Harris?
Additional table information: table: movie_1

Answer: SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris') GROUP BY mID


Question:
What are the total scores of the body builders whose birthday contains the string 'January' ?
Additional table information: table: body_builder

Answer: SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE '%January%'


Question:
Find the distinct ages of students who have secretary votes in the fall election cycle.
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = 'Fall'


Question:
Return the average money requested across all entrepreneurs.
Additional table information: table: entrepreneur

Answer: SELECT AVG(Money_Requested) FROM entrepreneur


Question:
How many artworks are there?
Additional table information: table: entertainment_awards

Answer: SELECT COUNT(*) FROM artwork


Question:
Which university is in Los Angeles county and opened after 1950?
Additional table information: table: csu_1

Answer: SELECT campus FROM campuses WHERE county = 'Los Angeles' AND YEAR > 1950


Question:
In which city do the most employees live and how many of them live there?
Additional table information: table: driving_school

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


Question:
Please show each industry and the corresponding number of companies in that industry.
Additional table information: table: company_office

Answer: SELECT Industry, COUNT(*) FROM Companies GROUP BY Industry


Question:
What is the name of the language that the film 'AIRPORT POLLOCK' is in?
Additional table information: table: sakila_1

Answer: SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'


Question:
Find the name of physicians whose position title contains the word 'senior'.
Additional table information: table: hospital_1

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


Question:
What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.
Additional table information: table: customers_campaigns_ecommerce

Answer: SELECT T2.customer_name, T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'Order' INTERSECT SELECT T2.customer_name, T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'No Response'


Question:
Find the numbers of different majors and cities.
Additional table information: table: dorm_1

Answer: SELECT COUNT(DISTINCT major), COUNT(DISTINCT city_code) FROM student


Question:
On what dates were employees without the letter M in their first names hired?
Additional table information: table: hr_1

Answer: SELECT hire_date FROM employees WHERE NOT first_name LIKE '%M%'


Question:
Show institution types, along with the number of institutions and total enrollment for each type.
Additional table information: table: protein_institute

Answer: SELECT TYPE, COUNT(*), SUM(enrollment) FROM institution GROUP BY TYPE


Question:
Return the city with the customer type code 'Good Credit Rating' that had the fewest customers.
Additional table information: table: customer_complaints

Answer: SELECT town_city FROM customers WHERE customer_type_code = 'Good Credit Rating' GROUP BY town_city ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Please show the most common reigns of wrestlers.
Additional table information: table: wrestler

Answer: SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the total number of students enrolled in the colleges that were founded after the year of 1850 for each affiliation type.
Additional table information: table: university_basketball

Answer: SELECT SUM(Enrollment), affiliation FROM university WHERE founded > 1850 GROUP BY affiliation


Question:
How many lessons taught by staff whose first name has letter 'a' in it?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%'


Question:
Return the login names of the students whose family name is 'Ward'.
Additional table information: table: e_learning

Answer: SELECT login_name FROM Students WHERE family_name = 'Ward'


Question:
What is the name and sex of the candidate with the highest support rate?
Additional table information: table: candidate_poll

Answer: SELECT t1.name, t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1


Question:
What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'?
Additional table information: table: local_govt_and_lot

Answer: SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id = T2.organization_id WHERE T2.organization_details = 'Denesik and Sons Party'


Question:
Which policy type appears most frequently in the available policies?
Additional table information: table: insurance_fnol

Answer: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the names of members who did not participate in any round.
Additional table information: table: decoration_competition

Answer: SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM round)


Question:
Show the maximum amount of transaction.
Additional table information: table: tracking_share_transactions

Answer: SELECT MAX(amount_of_transaction) FROM TRANSACTIONS


Question:
What are the first and last names of all customers with more than 2 payments?
Additional table information: table: driving_school

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


Question:
Show storm name with at least two regions and 10 cities affected.
Additional table information: table: storm_record

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


Question:
Find number of tracks in each genre?
Additional table information: table: store_1

Answer: SELECT COUNT(*), T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name


Question:
What are the full names of customers who do not have any accounts?
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 place has the most flights coming from there?
Additional table information: table: flight_1

Answer: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of students who didn't take any course from Biology department.
Additional table information: table: college_2

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


Question:
What is the id of the department with the least number of staff?
Additional table information: table: department_store

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


Question:
For each grant id, how many documents does it have, and which one has the most?
Additional table information: table: tracking_grants_for_research

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


Question:
display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.
Additional table information: table: hr_1

Answer: SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000


Question:
What are the maximum and minimum population of the counties?
Additional table information: table: election

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


Question:
What are the times of elimination for wrestlers with over 50 days held?
Additional table information: table: wrestler

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


Question:
What are the names for all aircrafts with at least 2 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 name of the tourist attraction that is associated with the photo 'game1'?
Additional table information: table: cre_Theme_park

Answer: SELECT T2.Name FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T1.Name = 'game1'


Question:
Find the rooms of faculties with rank professor who live in building NEB.
Additional table information: table: college_3

Answer: SELECT Room FROM FACULTY WHERE Rank = 'Professor' AND Building = 'NEB'


Question:
Find the number of different states which banks are located at.
Additional table information: table: loan_1

Answer: SELECT COUNT(DISTINCT state) FROM bank


Question:
Which claim processing stage has the most claims? Show the claim status name.
Additional table information: table: insurance_and_eClaims

Answer: SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the number of players who have points less than 30 for each position?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*), POSITION FROM player WHERE points < 30 GROUP BY POSITION


Question:
Find all the papers published by the institution 'Google'.
Additional table information: table: icfp_1

Answer: SELECT 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 = 'Google'


Question:
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
Additional table information: table: college_1

Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'


Question:
Find the first names of faculties of rank Professor in alphabetic order.
Additional table information: table: college_3

Answer: SELECT Fname FROM FACULTY WHERE Rank = 'Professor' ORDER BY Fname NULLS FIRST


Question:
what are the names of the channels that broadcast in both morning and night?
Additional table information: table: program_share

Answer: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'


Question:
Tell me the employee id of the head of the department with the least employees.
Additional table information: table: hospital_1

Answer: SELECT head FROM department GROUP BY departmentID ORDER BY COUNT(departmentID) NULLS FIRST LIMIT 1


Question:
Return the structure description of the document that has been accessed the fewest number of times.
Additional table information: table: document_management

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


Question:
List the document type code for the document with the id 2.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_type_code FROM Documents WHERE document_id = 2


Question:
Find the list of cities that no customer is living in.
Additional table information: table: customers_and_addresses

Answer: SELECT city FROM addresses WHERE NOT city IN (SELECT DISTINCT t3.city FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id)


Question:
Who are the ministers, when did they take office, and when did they leave office, ordered by when they left office?
Additional table information: table: party_people

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


Question:
Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' 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:
What is all the information regarding employees who are managers?
Additional table information: table: hr_1

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


Question:
What are the descriptions for the aircrafts?
Additional table information: table: aircraft

Answer: SELECT Description FROM aircraft


Question:
List all the salary values players received in 2010 and 2001.
Additional table information: table: baseball_1

Answer: SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001


Question:
What is the zip code the county named 'Howard' is located in?
Additional table information: table: election

Answer: SELECT Zip_code FROM county WHERE County_name = 'Howard'


Question:
Find each target user's name and average trust score.
Additional table information: table: epinions_1

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


Question:
How many members are not living in Hartford?
Additional table information: table: coffee_shop

Answer: SELECT COUNT(*) FROM member WHERE address <> 'Hartford'


Question:
How many departments does the college has?
Additional table information: table: college_1

Answer: SELECT COUNT(DISTINCT dept_name) FROM department


Question:
What are the distinct president votes on 08/30/2015?
Additional table information: table: voter_2

Answer: SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = '08/30/2015'


Question:
find the name of the program that was launched most recently.
Additional table information: table: program_share

Answer: SELECT name FROM program ORDER BY launch DESC LIMIT 1


Question:
Which advisor has most number of students?
Additional table information: table: allergy_1

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


Question:
Find the average height and weight for all males (sex is M).
Additional table information: table: candidate_poll

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


Question:
List the names of players that do not have coaches.
Additional table information: table: riding_club

Answer: SELECT Player_name FROM player WHERE NOT Player_ID IN (SELECT Player_ID FROM player_coach)


Question:
Show order ids and the total quantity in each order.
Additional table information: table: customers_and_invoices

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


Question:
Which teachers teach the student named EVELINA BROMLEY? Give me the first and last name  of the teachers.
Additional table information: table: student_1

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


Question:
How many campuses exist are in the county of LA?
Additional table information: table: csu_1

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


Question:
What are the descriptions of the courses with name 'database'?
Additional table information: table: e_learning

Answer: SELECT course_description FROM COURSES WHERE course_name = 'database'


Question:
What are the login names of the students with family name 'Ward'?
Additional table information: table: e_learning

Answer: SELECT login_name FROM Students WHERE family_name = 'Ward'


Question:
Which project made the most number of outcomes? List the project details and the project id.
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.project_details, T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points?
Additional table information: table: formula_1

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


Question:
Find the name of accounts whose checking balance is higher than corresponding saving 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:
What are the languages that are used most often in songs?
Additional table information: table: music_1

Answer: SELECT languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the first name of students enrolled in class ACCT-211 and got grade C?
Additional table information: table: college_1

Answer: SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' AND T2.enroll_grade = 'C'


Question:
Return the themes, dates, and attendance for exhibitions that happened in 2004.
Additional table information: table: theme_gallery

Answer: SELECT T2.theme, T1.date, T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004


Question:
Find the patient who has the most recent undergoing treatment?
Additional table information: table: hospital_1

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


Question:
Show all card type codes and the number of cards in each type.
Additional table information: table: customers_card_transactions

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


Question:
What is title of album which track Balls to the Wall belongs to?
Additional table information: table: store_1

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


Question:
What are the names of all the customers?
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers


Question:
What are the names of all Rock tracks that are stored on MPEG audio files?
Additional table information: table: store_1

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


Question:
Give the state that has the most customers.
Additional table information: table: customer_complaints

Answer: SELECT state FROM customers GROUP BY state ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
How many assets does each maintenance contract contain? List the number and the contract id.
Additional table information: table: assets_maintenance

Answer: SELECT COUNT(*), T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id


Question:
What is the gender of the student Linda Smith?
Additional table information: table: restaurant_1

Answer: SELECT Sex FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith'


Question:
Which cities have at least one customer but no performer?
Additional table information: table: cre_Drama_Workshop_Groups

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


Question:
How many patients' prescriptions are made by physician John Dorian?
Additional table information: table: hospital_1

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


Question:
What is the name, latitude, and city of the station that is located the furthest South?
Additional table information: table: bike_1

Answer: SELECT name, lat, city FROM station ORDER BY lat NULLS FIRST LIMIT 1


Question:
How many counties are there?
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM county_public_safety


Question:
Find the number of rooms for different block code?
Additional table information: table: hospital_1

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


Question:
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.
Additional table information: table: assets_maintenance

Answer: SELECT T1.company_id, T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(*) >= 2 UNION SELECT T3.company_id, T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING COUNT(*) >= 2


Question:
Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.
Additional table information: table: theme_gallery

Answer: SELECT AVG(ticket_price), MIN(ticket_price), MAX(ticket_price) FROM exhibition WHERE YEAR < 2009


Question:
What are the names of Art instructors who have taught a course, and the corresponding course id?
Additional table information: table: college_2

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


Question:
What are the phone numbers for each employee?
Additional table information: table: chinook_1

Answer: SELECT Phone FROM EMPLOYEE


Question:
Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.
Additional table information: table: phone_market

Answer: SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING SUM(T1.Num_of_stock) >= 2000 ORDER BY SUM(T1.Num_of_stock) DESC


Question:
What is the name of school that has the smallest enrollment in each state?
Additional table information: table: soccer_2

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


Question:
Count the number of distinct governors.
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT Governor) FROM party


Question:
What are the names and account balances of customers with the letter a in their names?
Additional table information: table: loan_1

Answer: SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%'


Question:
List the names of all distinct products in alphabetical order.
Additional table information: table: tracking_orders

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


Question:
What are the official names of cities, ordered descending by population?
Additional table information: table: farm

Answer: SELECT Official_Name FROM city ORDER BY Population DESC


Question:
What is the total revenue of each manufacturer?
Additional table information: table: manufactory_1

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


Question:
Find the product category description of the product category with code 'Spices'.
Additional table information: table: products_gen_characteristics

Answer: SELECT product_category_description FROM ref_product_categories WHERE product_category_code = 'Spices'


Question:
What is the location with the most cinemas opened in year 2010 or later?
Additional table information: table: cinema

Answer: SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


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

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


Question:
Find the semester and year which has the least number of student taking any class.
Additional table information: table: college_2

Answer: SELECT semester, YEAR FROM takes GROUP BY semester, YEAR ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Which customers have both 'On Road' and 'Shipped' as order status? List the customer ids.
Additional table information: table: tracking_orders

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


Question:
How many players born in USA are right-handed batters? That is, have the batter value 'R'.
Additional table information: table: baseball_1

Answer: SELECT COUNT(*) FROM player WHERE birth_country = 'USA' AND bats = 'R'


Question:
For each product with some problems, list the count of problems and the product id.
Additional table information: table: tracking_software_problems

Answer: SELECT COUNT(*), T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id


Question:
What is the format for South Australia?
Additional table information: table: regional_marketing
columns: state_territory, text_bg_color, format, current_slogan, current_series, Notes

Answer: SELECT format FROM "regional_marketing" WHERE state_territory = 'South Australia'


Question:
Show the name of track and the number of races in each track.
Additional table information: table: race_track

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


Question:
What are the different names and credit scores of customers who have taken a loan?
Additional table information: table: loan_1

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


Question:
How many faculty members participate in an activity?
Additional table information: table: activity_1

Answer: SELECT COUNT(DISTINCT FacID) FROM Faculty_participates_in


Question:
Which semeseter and year had the fewest students?
Additional table information: table: college_2

Answer: SELECT semester, YEAR FROM takes GROUP BY semester, YEAR ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the lengths and heights of roller coasters?
Additional table information: table: roller_coaster

Answer: SELECT LENGTH, Height FROM roller_coaster


Question:
What are the ids and names of the companies that operated more than one flight?
Additional table information: table: flight_company

Answer: SELECT T1.id, T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING COUNT(*) > 1


Question:
Show the dates of performances with attending members whose roles are 'Violin'.
Additional table information: table: performance_attendance

Answer: SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = 'Violin'


Question:
What is the first and last name of all employees who live in the city Damianfort?
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = 'Damianfort'


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

Answer: SELECT COUNT(*) FROM Statements


Question:
display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M.
Additional table information: table: hr_1

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


Question:
What are the names of the schools with some players in the mid position but no goalies?
Additional table information: table: soccer_2

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


Question:
What is the name of the deparment with the highest enrollment?
Additional table information: table: college_2

Answer: SELECT dept_name FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the artist who produced the shortest song?
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
Find the first and last names of people who payed more than the rooms' base prices.
Additional table information: table: inn_1

Answer: SELECT T1.firstname, T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0


Question:
Which documents have more than 1 draft copies? List document id and number of draft copies.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT document_id, COUNT(*) FROM Draft_Copies GROUP BY document_id HAVING COUNT(*) > 1


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

Answer: SELECT COUNT(*) FROM CHARACTERISTICS


Question:
What is the total number of customers across banks?
Additional table information: table: loan_1

Answer: SELECT SUM(no_of_customers) FROM bank


Question:
How many students does each advisor have?
Additional table information: table: allergy_1

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


Question:
Find the name of the document that has been accessed the greatest number of times, as well as the count of how many times it has been accessed?
Additional table information: table: document_management

Answer: SELECT document_name, access_count FROM documents ORDER BY access_count DESC LIMIT 1


Question:
Show the name of the shop that have the largest 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:
What are the different names of friends who are younger than the average age for a friend?
Additional table information: table: network_2

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


Question:
Show the studios that have not produced films with director 'Walter Hill'.
Additional table information: table: film_rank

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


Question:
Show the status of the city that has hosted the greatest number of competitions.
Additional table information: table: farm

Answer: SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the countries with the most airlines whose active status is Y?
Additional table information: table: flight_4

Answer: SELECT country FROM airlines WHERE active = 'Y' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which locations 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 average enrollment size of the universities that are founded before 1850?
Additional table information: table: university_basketball

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


Question:
How many members of 'Bootup Baltimore' are older than 18?
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 = 'Bootup Baltimore' AND t3.age > 18


Question:
What are the three colleges from which the most players are from?
Additional table information: table: match_season

Answer: SELECT College FROM match_season GROUP BY College ORDER BY COUNT(*) DESC LIMIT 3


Question:
Find the addresses and author IDs of the course authors that teach at least two courses.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id HAVING COUNT(*) >= 2


Question:
Return the apartment number and the number of rooms for each apartment.
Additional table information: table: apartment_rentals

Answer: SELECT apt_number, room_count FROM Apartments


Question:
What is the level name of the cheapest catalog (in USD)?
Additional table information: table: product_catalog

Answer: SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number = t2.catalog_level_number ORDER BY t1.price_in_dollars NULLS FIRST LIMIT 1


Question:
How many elections are there?
Additional table information: table: election_representative

Answer: SELECT COUNT(*) FROM election


Question:
Which county has the largest population? Give me the name of the county.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1


Question:
Show different teams of technicians and the number of technicians in each team.
Additional table information: table: machine_repair

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


Question:
Give me all the distinct location codes for documents.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT DISTINCT location_code FROM Document_locations


Question:
Show the names of the buildings that have more than one company offices.
Additional table information: table: company_office

Answer: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id HAVING COUNT(*) > 1


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

Answer: SELECT COUNT(*) FROM Customers


Question:
What are the  ids of every student who has never attended a course?
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 average and minimum age of captains in different class?
Additional table information: table: ship_1

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


Question:
Show the distinct leader names of colleges associated with members from country 'Canada'.
Additional table information: table: decoration_competition

Answer: SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = 'Canada'


Question:
Return the booking start date and end date for the apartments that have type code 'Duplex'.
Additional table information: table: apartment_rentals

Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = 'Duplex'


Question:
Which colleges does each player with a name that starts with the letter D  who tried out go to?
Additional table information: table: soccer_2

Answer: SELECT T1.cName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T2.pName LIKE 'D%'


Question:
List member names and their party names.
Additional table information: table: party_people

Answer: SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id


Question:
Find name of the services that has never been used.
Additional table information: table: e_government

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


Question:
List all the cities in a decreasing order of each city's stations' highest latitude.
Additional table information: table: bike_1

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


Question:
For each  airport name, how many routes start at that airport, ordered from most to least?
Additional table information: table: flight_4

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


Question:
Find the list of distinct ranks for faculty.
Additional table information: table: activity_1

Answer: SELECT DISTINCT rank FROM Faculty


Question:
List the title of films that do not have any market estimation.
Additional table information: table: film_rank

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


Question:
Show the name of the customer who has the most orders.
Additional table information: table: customers_and_products_contacts

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


Question:
What are the different names of all songs without back vocals?
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:
Find the city and state of the bank branch named morningside.
Additional table information: table: loan_1

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


Question:
Find the name of the department that has the fewest members.
Additional table information: table: college_3

Answer: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Give the classes that have more than two captains.
Additional table information: table: ship_1

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


Question:
Find all the rooms that have a price higher than 160 and can accommodate more than 2 people. Report room names and ids.
Additional table information: table: inn_1

Answer: SELECT roomName, RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2


Question:
Find the number of students that have at least one grade 'B'.
Additional table information: table: college_3

Answer: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = 'B'


Question:
Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.
Additional table information: table: flight_1

Answer: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY COUNT(*) >= 5 NULLS FIRST


Question:
What is the name of the artist who joined latest?
Additional table information: table: theme_gallery

Answer: SELECT name FROM artist ORDER BY year_join DESC LIMIT 1


Question:
Find the average credit score of the customers who have some loan.
Additional table information: table: loan_1

Answer: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)


Question:
Who is performing in the back stage position for the song 'Der Kapitan'? Show the first name and last name.
Additional table information: table: music_2

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


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

Answer: SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC


Question:
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.
Additional table information: table: insurance_policies

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


Question:
Count the number of students who have advisors.
Additional table information: table: college_2

Answer: SELECT COUNT(DISTINCT s_id) FROM advisor


Question:
List all information about the assessment notes sorted by date in ascending order.
Additional table information: table: behavior_monitoring

Answer: SELECT * FROM Assessment_Notes ORDER BY date_of_notes ASC NULLS FIRST


Question:
Who is the composer of track Fast As a Shark?
Additional table information: table: store_1

Answer: SELECT composer FROM tracks WHERE name = 'Fast As a Shark'


Question:
What is the name of every college in alphabetical order that has more than 18000 students enrolled?
Additional table information: table: soccer_2

Answer: SELECT cName FROM College WHERE enr > 18000 ORDER BY cName NULLS FIRST


Question:
Return the last name for the members of the club named 'Hopkins Student Enterprises'.
Additional table information: table: club_1

Answer: SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Hopkins Student Enterprises'


Question:
List the name and the number of stations for all the cities that have at least 15 stations.
Additional table information: table: bike_1

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


Question:
Find all the songs performed by artist with last name 'Heilo'
Additional table information: table: music_2

Answer: SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = 'Heilo'


Question:
Show all majors.
Additional table information: table: allergy_1

Answer: SELECT DISTINCT Major FROM Student


Question:
What are the category of music festivals with result 'Awarded'?
Additional table information: table: music_4

Answer: SELECT Category FROM music_festival WHERE RESULT = 'Awarded'


Question:
Which city does student Linda Smith live in?
Additional table information: table: restaurant_1

Answer: SELECT city_code FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith'


Question:
Show the name and location of track with 1 race.
Additional table information: table: race_track

Answer: SELECT T2.name, T2.location FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id HAVING COUNT(*) = 1


Question:
Find the average age of members of the club 'Hopkins Student Enterprises'.
Additional table information: table: club_1

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


Question:
Return the poll source corresponding to the candidate who has the oppose rate.
Additional table information: table: candidate_poll

Answer: SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1


Question:
What are the ids for all sporty students who are on scholarship?
Additional table information: table: game_1

Answer: SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'


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

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


Question:
Count the number of artists who have had volumes.
Additional table information: table: music_4

Answer: SELECT COUNT(DISTINCT Artist_ID) FROM volume


Question:
Which country is the airport that has the highest altitude located in?
Additional table information: table: flight_4

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


Question:
Find all the songs produced by artists with first name 'Marianne'.
Additional table information: table: music_2

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


Question:
Find the name of services that have been used for more than 2 times in first notification of loss.
Additional table information: table: insurance_fnol

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


Question:
What is the denomination of the school the most players belong to?
Additional table information: table: school_player

Answer: SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show invoice dates and order id and details for all invoices.
Additional table information: table: customers_and_invoices

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


Question:
display those employees who contain a letter z to their first name and also display their last name, city.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T1.first_name LIKE '%z%'


Question:
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.
Additional table information: table: insurance_policies

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


Question:
What are the titles of courses without prerequisites?
Additional table information: table: college_2

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


Question:
List the names and scores of all wines.
Additional table information: table: wine_1

Answer: SELECT Name, Score FROM WINE


Question:
What is all the information about the Marketing department?
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
How many degrees were conferred in 'San Jose State University' in 2000?
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 Jose State University' AND t2.year = 2000


Question:
Show names for all employees who do not have certificate of Boeing 737-800.
Additional table information: table: flight_1

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


Question:
What are the attribute data types with more than 3 attribute definitions?
Additional table information: table: product_catalog

Answer: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING COUNT(*) > 3


Question:
What are the top 5 countries by number of invoices and how many do they have?
Additional table information: table: store_1

Answer: SELECT billing_country, COUNT(*) FROM invoices GROUP BY billing_country ORDER BY COUNT(*) DESC LIMIT 5


Question:
Show all donor names.
Additional table information: table: school_finance

Answer: SELECT DISTINCT donator_name FROM endowment


Question:
How many rooms have not had any reservation yet?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM rooms WHERE NOT roomid IN (SELECT DISTINCT room FROM reservations)


Question:
List the count and id of each product in all the orders.
Additional table information: table: tracking_orders

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


Question:
Return the color description that is most common across all products.
Additional table information: table: products_gen_characteristics

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


Question:
What are the name and publication date of the catalogs with catalog level number above 5?
Additional table information: table: product_catalog

Answer: SELECT t1.catalog_name, t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5


Question:
What are the distinct ages of students who have secretary votes in the fall election cycle?
Additional table information: table: voter_2

Answer: SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = 'Fall'


Question:
How many students are enrolled in college?
Additional table information: table: soccer_2

Answer: SELECT SUM(enr) FROM College


Question:
How many games are played for all students?
Additional table information: table: game_1

Answer: SELECT SUM(gamesplayed) FROM Sportsinfo


Question:
Find the average unit price of jazz tracks.
Additional table information: table: chinook_1

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


Question:
display the average salary of employees for each department who gets a commission percentage.
Additional table information: table: hr_1

Answer: SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> 'null' GROUP BY department_id


Question:
What is the name of the department htat has no students minoring in it?
Additional table information: table: college_3

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


Question:
What is all the job history info done by employees earning a salary greater than or equal to 12000?
Additional table information: table: hr_1

Answer: SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000


Question:
What are the different affiliations, and how many schools with each have an enrollment size of above 20000?
Additional table information: table: university_basketball

Answer: SELECT COUNT(*), affiliation FROM university WHERE enrollment > 20000 GROUP BY affiliation


Question:
Which papers were written by authors from the institution 'Google'?
Additional table information: table: icfp_1

Answer: SELECT 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 = 'Google'


Question:
Find the distinct last names of all the students who have president votes and whose advisor is not 2192.
Additional table information: table: voter_2

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


Question:
What is the id of the routes whose source and destination airports are in the United States?
Additional table information: table: flight_4

Answer: SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'United States') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')


Question:
Find the number of distinct room types available.
Additional table information: table: hospital_1

Answer: SELECT COUNT(DISTINCT roomtype) FROM room


Question:
List the name of the aircraft that has been named winning aircraft the most number of times.
Additional table information: table: aircraft

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


Question:
Show all customer ids and the number of cards owned by each customer.
Additional table information: table: customers_card_transactions

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


Question:
What are the names of the clubs that have 'Davis Steven' as a member?
Additional table information: table: club_1

Answer: SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = 'Davis' AND t3.lname = 'Steven'


Question:
Return the names of shops, ordered by year of opening ascending.
Additional table information: table: device

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


Question:
Find the number of distinct products Rodrick Heaney has bought so far.
Additional table information: table: customers_and_addresses

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


Question:
List all tracks bought by customer Daan Peeters.
Additional table information: table: store_1

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


Question:
List the name of enzymes in descending lexicographical order.
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name FROM enzyme ORDER BY name DESC


Question:
Show the residences that have both a player of gender 'M' and a player of gender 'F'.
Additional table information: table: riding_club

Answer: SELECT Residence FROM player WHERE gender = 'M' INTERSECT SELECT Residence FROM player WHERE gender = 'F'