Question:
How many furniture components are there in total?
Additional table information: table: manufacturer

Answer: SELECT SUM(num_of_component) FROM furniture


Question:
What are the types of the ships that have both shiips with tonnage more than 6000 and those with tonnage less than 4000?
Additional table information: table: ship_mission

Answer: SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000


Question:
How many distinct artists have volumes?
Additional table information: table: music_4

Answer: SELECT COUNT(DISTINCT Artist_ID) FROM volume


Question:
What is the name corresponding to the accoung with the lowest sum of checking and savings balances?
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 ORDER BY T2.balance + T3.balance NULLS FIRST LIMIT 1


Question:
Find the GDP of the city with the largest regional population.
Additional table information: table: city_record

Answer: SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1


Question:
Count the number of members in club 'Bootup Baltimore' whose age is below 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:
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme.
Additional table information: table: journal_committee

Answer: SELECT T2.Name, T2.age, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ASC NULLS FIRST


Question:
Show all church names except for those that had a wedding in year 2015.
Additional table information: table: wedding

Answer: SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id WHERE T2.year = 2015


Question:
What are the invoice dates for customers with the first name Astrid and the last name Gruber?
Additional table information: table: chinook_1

Answer: SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = 'Astrid' AND LastName = 'Gruber'


Question:
How many documents do not have any expense?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)


Question:
How many customers live in the city of Prague?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE city = 'Prague'


Question:
List the names of all distinct wines in alphabetical order.
Additional table information: table: wine_1

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


Question:
What are the different region names, ordered by labels?
Additional table information: table: party_people

Answer: SELECT DISTINCT region_name FROM region ORDER BY Label NULLS FIRST


Question:
Show the transaction types and the total amount of transactions.
Additional table information: table: customers_and_invoices

Answer: SELECT transaction_type, SUM(transaction_amount) FROM Financial_transactions GROUP BY transaction_type


Question:
What is the number of graduates in 'San Francisco State University' in year 2004?
Additional table information: table: csu_1

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


Question:
List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.
Additional table information: table: wine_1

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


Question:
Find the order dates of the orders with price above 1000.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000


Question:
What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?
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:
Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.
Additional table information: table: flight_1

Answer: SELECT flno, origin, destination FROM Flight ORDER BY origin NULLS FIRST


Question:
What is the zip code of the hosue of the employee named Janessa Sawayn?
Additional table information: table: driving_school

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


Question:
For each grade 0 classroom, return the classroom number and the count of students.
Additional table information: table: student_1

Answer: SELECT classroom, COUNT(*) FROM list WHERE grade = '0' GROUP BY classroom


Question:
find the program owners that have some programs in both morning and night time.
Additional table information: table: program_share

Answer: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Morning' INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = 'Night'


Question:
How many users are there?
Additional table information: table: epinions_1

Answer: SELECT COUNT(*) FROM useracct


Question:
What is the average rating stars and title for the oldest movie?
Additional table information: table: movie_1

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


Question:
What are the apartment number, start date, and end date of each apartment booking?
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_number, T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id


Question:
What are the ids of all the employees who authorize document destruction?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed


Question:
Which restaurants have highest rating? List the restaurant name and its rating.
Additional table information: table: restaurant_1

Answer: SELECT ResName, Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1


Question:
List all the possible ways to get to attractions, together with the number of attractions accessible by these methods.
Additional table information: table: cre_Theme_park

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


Question:
Find the number of activities Mark Giuliano is involved in.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = 'Mark' AND T1.lname = 'Giuliano'


Question:
Count the number of courses without prerequisites.
Additional table information: table: college_2

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


Question:
What are the instruments are used in the song 'Le Pop'?
Additional table information: table: music_2

Answer: SELECT instrument FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = 'Le Pop'


Question:
What are the average price and score of wines grouped by appelation?
Additional table information: table: wine_1

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


Question:
What is the average number of employees of the departments whose rank is between 10 and 15?
Additional table information: table: department_management

Answer: SELECT AVG(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15


Question:
Count the number of customers who are active.
Additional table information: table: sakila_1

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


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

Answer: SELECT COUNT(*) FROM club


Question:
List the event venues and names that have the top 2 most number of people attended.
Additional table information: table: news_report

Answer: SELECT venue, name FROM event ORDER BY Event_Attendance DESC LIMIT 2


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

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


Question:
What is the position that is most common among players in match seasons?
Additional table information: table: match_season

Answer: SELECT POSITION FROM match_season GROUP BY POSITION ORDER BY COUNT(*) DESC LIMIT 1


Question:
Who are the different players, what season do they play in, and what is the name of the team they are on?
Additional table information: table: match_season

Answer: SELECT T1.Season, T1.Player, T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id


Question:
List the nations that have more than two ships.
Additional table information: table: ship_mission

Answer: SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2


Question:
What is the location code with the most documents?
Additional table information: table: cre_Doc_Tracking_DB

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


Question:
Which player has the most all star game experiences? Give me the first name, last name and id of the player, as well as the number of times the player participated in all star game.
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:
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC NULLS FIRST


Question:
What is the most common participant type?
Additional table information: table: local_govt_in_alabama

Answer: SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name, location and seating for the most recently opened track?
Additional table information: table: race_track

Answer: SELECT name, LOCATION, seating FROM track ORDER BY year_opened DESC LIMIT 1


Question:
Return the founder of Sony.
Additional table information: table: manufactory_1

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


Question:
For each submission, show the author and their affiliated college.
Additional table information: table: workshop_paper

Answer: SELECT Author, College FROM submission


Question:
Give the songs included in volumes that have more than 1 week on top.
Additional table information: table: music_4

Answer: SELECT Song FROM volume WHERE Weeks_on_Top > 1


Question:
What is the name and job title of the staff who was assigned the latest?
Additional table information: table: department_store

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


Question:
What are the distinct names of products purchased by at least two different customers?
Additional table information: table: department_store

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


Question:
List all information about customer master index, and sort them by details in descending order.
Additional table information: table: local_govt_mdm

Answer: SELECT * FROM customer_master_index ORDER BY cmi_details DESC


Question:
Find the name of the source user with the highest average trust score.
Additional table information: table: epinions_1

Answer: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id GROUP BY T2.source_u_id ORDER BY AVG(trust) DESC LIMIT 1


Question:
What are the numbers of the shortest flights?
Additional table information: table: flight_1

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


Question:
display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is PU_MAN.
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')


Question:
Find the description of the most popular role among the users that have logged in.
Additional table information: table: document_management

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


Question:
How many CSU campuses are there?
Additional table information: table: csu_1

Answer: SELECT COUNT(*) FROM campuses


Question:
What are the first names of all students taking accoutning and Computer Information Systems classes?
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 all 200 meter and 300 meter results of swimmers with nationality 'Australia'.
Additional table information: table: swimming

Answer: SELECT meter_200, meter_300 FROM swimmer WHERE nationality = 'Australia'


Question:
Which channels are broadcast in the morning? Give me the channel names.
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'


Question:
Show all cities without a branch having more than 100 memberships.
Additional table information: table: shop_membership

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


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

Answer: SELECT AVG(age) FROM Person


Question:
Return the famous titles for artists that have volumes that lasted more than 2 weeks on top.
Additional table information: table: music_4

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


Question:
What are the employee ids for each employee and final dates of employment at their last job?
Additional table information: table: hr_1

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


Question:
Find the number of clubs where 'Tracy Kim' is a member.
Additional table information: table: club_1

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


Question:
What are the names of all players that got more than the average number of points?
Additional table information: table: sports_competition

Answer: SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player)


Question:
What are the themes of parties ordered by the number of hosts in ascending manner?
Additional table information: table: party_host

Answer: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC NULLS FIRST


Question:
What are the names and average salaries for departments with average salary higher than 42000?
Additional table information: table: college_2

Answer: SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name HAVING AVG(salary) > 42000


Question:
How many users are logged in?
Additional table information: table: document_management

Answer: SELECT COUNT(*) FROM users WHERE user_login = 1


Question:
For each end station id, what is its name, latitude, and minimum duration for trips ended there?
Additional table information: table: bike_1

Answer: SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id


Question:
Which department has the highest average student GPA, and what is the average gpa?
Additional table information: table: college_1

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


Question:
Select the average price of each manufacturer's products, showing the manufacturer's name.
Additional table information: table: manufactory_1

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


Question:
What is the most popular full name of the actors?
Additional table information: table: sakila_1

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


Question:
What is total number of show times per dat for each cinema?
Additional table information: table: cinema

Answer: SELECT T2.name, SUM(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id


Question:
Find the first name of students not enrolled in any course.
Additional table information: table: college_3

Answer: SELECT Fname FROM STUDENT WHERE NOT StuID IN (SELECT StuID FROM ENROLLED_IN)


Question:
What are the unique names of races that held after 2000 and the circuits were in Spain?
Additional table information: table: formula_1

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


Question:
What are the title and issues of the books?
Additional table information: table: book_2

Answer: SELECT Title, Issues FROM book


Question:
What is the average number of people injured by all perpetrators?
Additional table information: table: perpetrator

Answer: SELECT AVG(Injured) FROM perpetrator


Question:
Find the last name of the individuals that have been contact individuals of an organization.
Additional table information: table: e_government

Answer: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id


Question:
Find the papers which have 'Olin Shivers' as an author.
Additional table information: table: icfp_1

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


Question:
What is the label with the most albums?
Additional table information: table: music_2

Answer: SELECT label FROM albums GROUP BY label ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the age of the friend of Zach with longest year relationship?
Additional table information: table: network_2

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


Question:
Find the id and last name of the student that has the most behavior incidents?
Additional table information: table: behavior_monitoring

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


Question:
Which programs' origins are not 'Beijing'? Give me the program names.
Additional table information: table: program_share

Answer: SELECT name FROM program WHERE origin <> 'Beijing'


Question:
How many papers have 'Atsushi Ohori' published?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = 'Atsushi' AND t1.lname = 'Ohori'


Question:
What is the total money requested by entrepreneurs with height more than 1.85?
Additional table information: table: entrepreneur

Answer: SELECT SUM(T1.Money_Requested) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85


Question:
Give the distinct headquarters of manufacturers.
Additional table information: table: manufactory_1

Answer: SELECT DISTINCT headquarter FROM manufacturers


Question:
List the year in which there are more than one festivals.
Additional table information: table: entertainment_awards

Answer: SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*) > 1


Question:
List the time of elimination of the wrestlers with largest days held.
Additional table information: table: wrestler

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


Question:
Return the name and number of reservations made for each of the rooms.
Additional table information: table: inn_1

Answer: SELECT T2.roomName, COUNT(*), T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room


Question:
What is the description of the role named 'Proof Reader'?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_description FROM ROLES WHERE role_name = 'Proof Reader'


Question:
What is all the information about employees hired before June 21, 2002?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date < '2002-06-21'


Question:
Count the number of customer cards of the type Debit.
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards WHERE card_type_code = 'Debit'


Question:
Show minimum and maximum amount of memberships for all branches opened in 2011 or located at city London.
Additional table information: table: shop_membership

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


Question:
Show the crime rates of counties in ascending order of number of police officers.
Additional table information: table: county_public_safety

Answer: SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC NULLS FIRST


Question:
Show the apartment type codes and apartment numbers in the buildings managed by 'Kyle'.
Additional table information: table: apartment_rentals

Answer: SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = 'Kyle'


Question:
Find the last names of students studying in room 111.
Additional table information: table: student_1

Answer: SELECT lastname FROM list WHERE classroom = 111


Question:
How many bookings did each customer make? List the customer id, first name, and the count.
Additional table information: table: products_for_hire

Answer: SELECT T1.customer_id, T1.first_name, COUNT(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id


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

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


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

Answer: SELECT T1.Market_Details FROM Street_Markets AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = 'walk' OR T2.How_to_Get_There = 'bus'


Question:
Compute the average score of submissions.
Additional table information: table: workshop_paper

Answer: SELECT AVG(Scores) FROM submission


Question:
Show the residences that have at least two players.
Additional table information: table: riding_club

Answer: SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2


Question:
Give me the theme and location of each party.
Additional table information: table: party_host

Answer: SELECT Party_Theme, LOCATION FROM party


Question:
What is the number of students playing as a goalie?
Additional table information: table: soccer_2

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


Question:
Show the names of players coached by the rank 1 coach.
Additional table information: table: riding_club

Answer: SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T2.Rank = 1


Question:
Find the number of rooms located on each block floor.
Additional table information: table: hospital_1

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


Question:
What are the carriers of devices that are not in stock anywhere?
Additional table information: table: device

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


Question:
What are the denomination more than one school have?
Additional table information: table: school_player

Answer: SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1


Question:
Find the names of all the clubs that have at least a member from the city with city code 'BAL'.
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 = 'BAL'


Question:
Which paper is published in an institution in 'USA' and have 'Turon' as its second author?
Additional table information: table: icfp_1

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


Question:
How many ships are there?
Additional table information: table: ship_mission

Answer: SELECT COUNT(*) FROM ship


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

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


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

Answer: SELECT T3.Name, T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID


Question:
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
Additional table information: table: mountain_photos

Answer: SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'


Question:
What are the emails and phone numbers of custoemrs who have never filed a complaint?
Additional table information: table: customer_complaints

Answer: SELECT email_address, phone_number FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM complaints)


Question:
Show the distinct position of players from college UCLA or Duke.
Additional table information: table: match_season

Answer: SELECT DISTINCT POSITION FROM match_season WHERE College = 'UCLA' OR College = 'Duke'


Question:
What are the different product names? What is the average product price for each of them?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_Name, AVG(Product_Price) FROM PRODUCTS GROUP BY Product_Name


Question:
Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.
Additional table information: table: bike_1

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


Question:
What are the names and budgets of departments with budgets greater than the average?
Additional table information: table: college_2

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


Question:
Give the ids of documents with expenses that have the budget code 'SF'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'


Question:
What are the names and cities of bank branches that offer loans for business?
Additional table information: table: loan_1

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


Question:
How many customers in state of CA?
Additional table information: table: store_1

Answer: SELECT COUNT(*) FROM customers WHERE state = 'CA'


Question:
On which days more than one revisions were made on catalogs.
Additional table information: table: product_catalog

Answer: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1


Question:
How many different software platforms are there for devices?
Additional table information: table: device

Answer: SELECT COUNT(DISTINCT Software_Platform) FROM device


Question:
What are the elimination moves of wrestlers whose team is 'Team Orton'?
Additional table information: table: wrestler

Answer: SELECT Elimination_Move FROM Elimination WHERE Team = 'Team Orton'


Question:
Which allergy type is most common?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1


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

Answer: SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType


Question:
How many different product types are there?
Additional table information: table: products_for_hire

Answer: SELECT COUNT(DISTINCT product_type_code) FROM products_for_hire


Question:
Return the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates?
Additional table information: table: candidate_poll

Answer: SELECT MAX(support_rate), MIN(consider_rate), MIN(oppose_rate) FROM candidate


Question:
What is the response received date for the document described as Regular that was granted more than 100 dollars?
Additional table information: table: tracking_grants_for_research

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


Question:
List the locations of schools that do not have any player.
Additional table information: table: school_player

Answer: SELECT LOCATION FROM school WHERE NOT School_ID IN (SELECT School_ID FROM Player)


Question:
How many king beds are there?
Additional table information: table: inn_1

Answer: SELECT SUM(beds) FROM Rooms WHERE bedtype = 'King'


Question:
What are the prices of wines produced before the year of 2010?
Additional table information: table: wine_1

Answer: SELECT Price FROM WINE WHERE YEAR < 2010


Question:
What are the ids of instructors who taught in the Fall of 2009 but not in the Spring of 2010?
Additional table information: table: college_2

Answer: SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010


Question:
How many players are there?
Additional table information: table: riding_club

Answer: SELECT COUNT(*) FROM player


Question:
What is the count and code of the job with the most employee?
Additional table information: table: college_1

Answer: SELECT emp_jobcode, COUNT(*) FROM employee GROUP BY emp_jobcode ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the file sizes and formats for all songs with a resolution lower than 800?
Additional table information: table: music_1

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


Question:
What are the grapes, wineries and years for wines with price higher than 100, sorted by year?
Additional table information: table: wine_1

Answer: SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR NULLS FIRST


Question:
Which accelerator name contains substring 'Opera'?
Additional table information: table: browser_web

Answer: SELECT name FROM web_client_accelerator WHERE name LIKE '%Opera%'


Question:
How many transaction does account with name 337 have?
Additional table information: table: customers_and_invoices

Answer: SELECT COUNT(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = '337'


Question:
What are the names and salaries of instructors who advise students in the Math department?
Additional table information: table: college_2

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


Question:
Find the name of account that has the lowest total checking and 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 ORDER BY T2.balance + T3.balance NULLS FIRST LIMIT 1


Question:
Which team had the least number of attendances in home games in 1980?
Additional table information: table: baseball_1

Answer: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC NULLS FIRST LIMIT 1


Question:
What is the average total score of body builders with height bigger than 200?
Additional table information: table: body_builder

Answer: SELECT AVG(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200


Question:
What are the names of all the different reviewers who rates Gone with the Wind?
Additional table information: table: movie_1

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


Question:
What is the first and last name of all the German drivers?
Additional table information: table: formula_1

Answer: SELECT forename, surname FROM drivers WHERE nationality = 'German'


Question:
Return the weight of the shortest person.
Additional table information: table: entrepreneur

Answer: SELECT Weight FROM people ORDER BY Height ASC NULLS FIRST LIMIT 1


Question:
Find courses that ran in Fall 2009 but not in Spring 2010.
Additional table information: table: college_2

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


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

Answer: SELECT clubdesc FROM club WHERE clubname = 'Pen and Paper Gaming'


Question:
Please show the names of the buildings whose status is 'on-hold', in ascending order of stories.
Additional table information: table: company_office

Answer: SELECT name FROM buildings WHERE Status = 'on-hold' ORDER BY Stories ASC NULLS FIRST


Question:
What are the full names of the 3 instructors who teach the most courses?
Additional table information: table: college_3

Answer: SELECT T2.Fname, T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY COUNT(*) DESC LIMIT 3


Question:
For the problem with id 10, return the ids and dates of its problem logs.
Additional table information: table: tracking_software_problems

Answer: SELECT problem_log_id, log_entry_date FROM problem_log WHERE problem_id = 10


Question:
Return the average price of products that have each category code.
Additional table information: table: customer_complaints

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


Question:
Show different type codes of products and the number of products with each type code.
Additional table information: table: solvency_ii

Answer: SELECT Product_Type_Code, COUNT(*) FROM Products GROUP BY Product_Type_Code


Question:
Which classroom has the most students?
Additional table information: table: student_1

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


Question:
Find the number of times ROY SWEAZY has reserved a room.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
Count the number of different parties.
Additional table information: table: party_people

Answer: SELECT COUNT(DISTINCT party_name) FROM party


Question:
Find the number of routes whose destination airports are in Canada.
Additional table information: table: flight_4

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


Question:
What is the name of the airline with the most routes?
Additional table information: table: flight_4

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


Question:
What are all the catalog entry names?
Additional table information: table: product_catalog

Answer: SELECT DISTINCT (catalog_entry_name) FROM catalog_contents


Question:
How many unique labels are there for albums?
Additional table information: table: music_2

Answer: SELECT COUNT(DISTINCT label) FROM albums


Question:
Show budget type codes and the number of documents in each budget type.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, COUNT(*) FROM Documents_with_expenses GROUP BY budget_type_code


Question:
Find the maximum and average capacity among rooms in each building.
Additional table information: table: college_2

Answer: SELECT MAX(capacity), AVG(capacity), building FROM classroom GROUP BY building


Question:
Show different nominees and the number of musicals they have been nominated.
Additional table information: table: musical

Answer: SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee


Question:
How many bank branches are there?
Additional table information: table: loan_1

Answer: SELECT COUNT(*) FROM bank


Question:
What is maximum group equity shareholding of the companies?
Additional table information: table: flight_company

Answer: SELECT MAX(group_equity_shareholding) FROM operate_company


Question:
How many students have a food allergy?
Additional table information: table: allergy_1

Answer: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = 'food'


Question:
What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'?
Additional table information: table: scientist_1

Answer: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'


Question:
Show the station name with at least two trains.
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING COUNT(*) >= 2


Question:
Sort the names of products in ascending order of their price.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_Name FROM Products ORDER BY Product_Price ASC NULLS FIRST


Question:
Show the range that has the most number of mountains.
Additional table information: table: climbing

Answer: SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the name of the marketing region the store Rob Dinning is located in.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Marketing_Region_Name FROM Marketing_Regions AS T1 JOIN Stores AS T2 ON T1.Marketing_Region_Code = T2.Marketing_Region_Code WHERE T2.Store_Name = 'Rob Dinning'


Question:
For every medicine id, what are the names of the medicines that can interact with more than one enzyme?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT T1.id, T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2


Question:
What are the positions with both players having more than 20 points and less than 10 points.
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10


Question:
What is the product category description and unit of measurement of category 'Herbs'?
Additional table information: table: products_gen_characteristics

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


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

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


Question:
Give the color description that is least common across products.
Additional table information: table: products_gen_characteristics

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


Question:
How many players were in the team Boston Red Stockings in 2000?
Additional table information: table: baseball_1

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


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

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


Question:
What are the names and ids of customers whose address contains TN?
Additional table information: table: department_store

Answer: SELECT customer_name, customer_id FROM customers WHERE customer_address LIKE '%TN%'


Question:
Show the most frequently used carrier of the phones.
Additional table information: table: phone_market

Answer: SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the locations of parties and the names of the party hosts in ascending order of the age of the host.
Additional table information: table: party_host

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


Question:
What parties have at least three representatives?
Additional table information: table: election_representative

Answer: SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3


Question:
List all pilot names in ascending alphabetical order.
Additional table information: table: aircraft

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


Question:
List all headquarters and the number of companies in each headquarter.
Additional table information: table: gas_company

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


Question:
Find the emails of customers who has filed a complaints of the product with the most complaints.
Additional table information: table: customer_complaints

Answer: SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the descriptions of all the project outcomes?
Additional table information: table: tracking_grants_for_research

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


Question:
What are ids of the all distinct orders, sorted by placement date?
Additional table information: table: tracking_orders

Answer: SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed NULLS FIRST


Question:
What is the title, phone number and hire date for the employee named Nancy Edwards?
Additional table information: table: store_1

Answer: SELECT title, phone, hire_date FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'


Question:
What are the phone, room, and building of the faculty member called Jerry Prince?
Additional table information: table: activity_1

Answer: SELECT phone, room, building FROM Faculty WHERE Fname = 'Jerry' AND Lname = 'Prince'


Question:
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
Additional table information: table: flight_company

Answer: SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'


Question:
What are the titles of albums by the artist 'AC/DC'?
Additional table information: table: chinook_1

Answer: SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'


Question:
What is the name of organization that has the greatest number of contact individuals?
Additional table information: table: e_government

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


Question:
Show the industries shared by companies whose headquarters are 'USA' and companies whose headquarters are 'China'.
Additional table information: table: company_office

Answer: SELECT Industry FROM Companies WHERE Headquarters = 'USA' INTERSECT SELECT Industry FROM Companies WHERE Headquarters = 'China'


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

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


Question:
How many staff in total?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff


Question:
What are the dates of publications in descending order of price?
Additional table information: table: book_2

Answer: SELECT Publication_Date FROM publication ORDER BY Price DESC


Question:
Which directors had a movie in either 1999 or 2000?
Additional table information: table: culture_company

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


Question:
Find the level name of the catalog with the lowest price (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:
Find the name of projects that require between 100 and 300 hours of work.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300


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

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


Question:
What are the names of products produced by both Creative Labs and Sony?
Additional table information: table: manufactory_1

Answer: SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Creative Labs' INTERSECT SELECT T1.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.manufacturer = T2.code WHERE T2.name = 'Sony'


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

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


Question:
What are the medicine and trade names that cannot interact with the enzyme with the product 'Heme'?
Additional table information: table: medicine_enzyme_interaction

Answer: SELECT name, trade_name FROM medicine EXCEPT SELECT T1.name, T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'


Question:
Return the unit of measure for 'Herb' products.
Additional table information: table: products_gen_characteristics

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


Question:
What is the average and oldest age for each gender of student?
Additional table information: table: dorm_1

Answer: SELECT AVG(age), MAX(age), sex FROM student GROUP BY sex


Question:
What is the number of distinct publication dates?
Additional table information: table: book_2

Answer: SELECT COUNT(DISTINCT Publication_Date) FROM publication


Question:
List the name of actors in ascending alphabetical order.
Additional table information: table: musical

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


Question:
What are the last names and ids of all drivers who had 11 pit stops and participated in more than 5 races?
Additional table information: table: formula_1

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


Question:
Count the number of appelations in Napa County.
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM APPELLATIONS WHERE County = 'Napa'


Question:
How many orders does Luca Mancini have in his invoices?
Additional table information: table: store_1

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


Question:
What are the names of the enzymes used in the medicine  Amisulpride that acts as inhibitors?
Additional table information: table: medicine_enzyme_interaction

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


Question:
What are the full names of students minoring in department 140?
Additional table information: table: college_3

Answer: SELECT T2.Fname, T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140


Question:
What is the lowest and highest rating star?
Additional table information: table: movie_1

Answer: SELECT MAX(stars), MIN(stars) FROM Rating


Question:
What is the last name of the contact individual from the Labour party organization who was contacted most recently?
Additional table information: table: e_government

Answer: SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = 'Labour Party' ORDER BY t2.date_contact_to DESC LIMIT 1


Question:
Find all the order items whose product id is 11. What are the order item ids?
Additional table information: table: tracking_orders

Answer: SELECT order_item_id FROM order_items WHERE product_id = 11


Question:
Find names of colleges with enrollment greater than that of some (at least one) college in the FL state.
Additional table information: table: soccer_2

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


Question:
Which tourist attractions do the tourists Vincent and Marcelle visit? Tell me the names of the attractions.
Additional table information: table: cre_Theme_park

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


Question:
What are the famous title of the artists associated with volumes with more than 2 weeks on top?
Additional table information: table: music_4

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


Question:
What are the first names and department numbers for employees with last name McEwen?
Additional table information: table: hr_1

Answer: SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'


Question:
What are the codes of card types that have 5 or more cards?
Additional table information: table: customers_card_transactions

Answer: SELECT card_type_code FROM Customers_cards GROUP BY card_type_code HAVING COUNT(*) >= 5


Question:
Find the average number of followers for the users who had some tweets.
Additional table information: table: twitter_1

Answer: SELECT AVG(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets)


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

Answer: SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM person WHERE job = 'student')


Question:
What are the names of the technicians by ascending order of age?
Additional table information: table: machine_repair

Answer: SELECT Name FROM technician ORDER BY Age ASC NULLS FIRST


Question:
show the lowest low temperature and highest wind speed in miles per hour.
Additional table information: table: station_weather

Answer: SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather


Question:
What are the ids of all songs that are available on mp4 or have a higher resolution than 720?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' UNION SELECT f_id FROM song WHERE resolution > 720


Question:
How many classes exist for each school?
Additional table information: table: college_1

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


Question:
List the names and birthdays of the top five players in terms of potential.
Additional table information: table: soccer_1

Answer: SELECT DISTINCT T1.player_name, T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5


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

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


Question:
What is the average song rating for each language?
Additional table information: table: music_1

Answer: SELECT AVG(rating), languages FROM song GROUP BY languages


Question:
What are dates of birth of all the guests whose gender is 'Male'?
Additional table information: table: apartment_rentals

Answer: SELECT date_of_birth FROM Guests WHERE gender_code = 'Male'


Question:
What are the products with the maximum page size eqal to A4 or a pages per minute color less than 5?
Additional table information: table: store_product

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


Question:
List all the distinct cities
Additional table information: table: customers_and_addresses

Answer: SELECT DISTINCT city FROM addresses


Question:
What are the title, id, and description of the movie with the greatest number of actors?
Additional table information: table: sakila_1

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


Question:
How many schools have some students playing in goalie and mid positions.
Additional table information: table: soccer_2

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


Question:
Show station names without any trains.
Additional table information: table: train_station

Answer: SELECT name FROM station WHERE NOT station_id IN (SELECT station_id FROM train_station)


Question:
Which city has the most customers living in?
Additional table information: table: customers_and_addresses

Answer: SELECT 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 GROUP BY t3.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the party form that is most common?
Additional table information: table: e_government

Answer: SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the addresses of the course authors who teach either 'operating system' or 'data structure' course.
Additional table information: table: e_learning

Answer: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'


Question:
What are the distinct payment method codes in all the invoices?
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT DISTINCT payment_method_code FROM INVOICES


Question:
What are the names and years of the movies that has the top 3 highest rating star?
Additional table information: table: movie_1

Answer: SELECT T2.title, T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3


Question:
What are the other account details for the account with the name 338?
Additional table information: table: customers_card_transactions

Answer: SELECT other_account_details FROM Accounts WHERE account_name = '338'


Question:
Show all main industry for all companies.
Additional table information: table: gas_company

Answer: SELECT DISTINCT main_industry FROM company


Question:
List the names of aircrafts and that won matches at least twice.
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 HAVING COUNT(*) >= 2


Question:
Which rooms cost between 120 and 150? Give me the room names.
Additional table information: table: inn_1

Answer: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150


Question:
Return the average horizontal bar points across all gymnasts.
Additional table information: table: gymnast

Answer: SELECT AVG(Horizontal_Bar_Points) FROM gymnast


Question:
How many authors are there?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM authors


Question:
Show the name and age for all male people who don't have a wedding.
Additional table information: table: wedding

Answer: SELECT name, age FROM people WHERE is_male = 'T' AND NOT people_id IN (SELECT male_id FROM wedding)


Question:
For each director who directed more than one movie, what are the titles and dates of release for all those movies?
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title


Question:
What are the names of wines, sorted by price ascending?
Additional table information: table: wine_1

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


Question:
How many people in total can stay in the modern rooms of this inn?
Additional table information: table: inn_1

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


Question:
Show the top 3 apartment type codes sorted by the average number of rooms in descending order.
Additional table information: table: apartment_rentals

Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3


Question:
What are the names of the artists who sang 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:
What is the customer id with most number of cards, and how many does he have?
Additional table information: table: customers_card_transactions

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


Question:
List the name of artworks whose type is not 'Program Talent Show'.
Additional table information: table: entertainment_awards

Answer: SELECT Name FROM artwork WHERE TYPE <> 'Program Talent Show'


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

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


Question:
Find the names of the candidates whose support percentage is lower than their oppose rate.
Additional table information: table: candidate_poll

Answer: SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate


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

Answer: SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.
Additional table information: table: race_track

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


Question:
What are the id and name of the stadium where the most injury accidents happened?
Additional table information: table: game_injury

Answer: SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many vehicle in total?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Vehicles


Question:
What are the areas and counties for all appelations?
Additional table information: table: wine_1

Answer: SELECT Area, County FROM APPELLATIONS


Question:
How many distinct president votes are recorded?
Additional table information: table: voter_2

Answer: SELECT COUNT(DISTINCT President_Vote) FROM VOTING_RECORD


Question:
Give me the description of the service type that offers not only the photo product but also the film product.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'photo' INTERSECT SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'film'


Question:
When did the staff member with first name as Janessa and last name as Sawayn join the company?
Additional table information: table: driving_school

Answer: SELECT date_joined_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
What are the names and phone numbers for all suppliers, sorted in alphabetical order of their addressed?
Additional table information: table: department_store

Answer: SELECT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details NULLS FIRST


Question:
How many institutions are there?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM inst


Question:
What are the names of all video games that are collectible cards?
Additional table information: table: game_1

Answer: SELECT gname FROM Video_games WHERE gtype = 'Collectible card game'


Question:
What are the details for the projects which were launched by the organization with the most projects?
Additional table information: table: tracking_grants_for_research

Answer: SELECT project_details FROM Projects WHERE organisation_id IN (SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY COUNT(*) DESC LIMIT 1)


Question:
Count the number of different affected regions.
Additional table information: table: storm_record

Answer: SELECT COUNT(DISTINCT region_id) FROM affected_region


Question:
List the school color of the school that has the largest enrollment.
Additional table information: table: school_player

Answer: SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1


Question:
Find the id of the product ordered the most often on invoices.
Additional table information: table: cre_Drama_Workshop_Groups

Answer: SELECT Product_ID FROM INVOICES GROUP BY Product_ID ORDER BY COUNT(*) DESC LIMIT 1


Question:
For each zip code, return the average mean temperature of August there.
Additional table information: table: bike_1

Answer: SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE '8/%' GROUP BY zip_code


Question:
Find the states where have some college students in tryout.
Additional table information: table: soccer_2

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


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

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


Question:
How many departments are led by heads who are not mentioned?
Additional table information: table: department_management

Answer: SELECT COUNT(*) FROM department WHERE NOT department_id IN (SELECT department_id FROM management)


Question:
What are the names of ships that were involved in a mission launched after 1928?
Additional table information: table: ship_mission

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


Question:
What are the code and description of the most frequent behavior incident type?
Additional table information: table: behavior_monitoring

Answer: SELECT T1.incident_type_code, T2.incident_type_description FROM Behavior_Incident AS T1 JOIN Ref_Incident_Type AS T2 ON T1.incident_type_code = T2.incident_type_code GROUP BY T1.incident_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the details of the shops that can be reached by walk.
Additional table information: table: cre_Theme_park

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


Question:
Find the name of dorms that can accommodate more than 300 students.
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm WHERE student_capacity > 300


Question:
List the service id and details for the events.
Additional table information: table: local_govt_in_alabama

Answer: SELECT service_id, event_details FROM EVENTS


Question:
In which country does Roberto Almeida?
Additional table information: table: store_1

Answer: SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'


Question:
Show names for all aircrafts with distances more than the average.
Additional table information: table: flight_1

Answer: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft)


Question:
What are the names of wines produced before any wine from the Brander winery?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR < (SELECT MIN(YEAR) FROM WINE WHERE Winery = 'Brander')


Question:
Please show the categories of the music festivals and the count.
Additional table information: table: music_4

Answer: SELECT Category, COUNT(*) FROM music_festival GROUP BY Category


Question:
Show the builder of railways associated with the trains named 'Andaman Exp'.
Additional table information: table: railway

Answer: SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = 'Andaman Exp'


Question:
Which ministers are not a part of the Progress Party?
Additional table information: table: party_people

Answer: SELECT minister FROM party WHERE party_name <> 'Progress Party'


Question:
Return the full name of the customer who made the first rental.
Additional table information: table: sakila_1

Answer: SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC NULLS FIRST LIMIT 1


Question:
Find the names of the swimmers who have no record.
Additional table information: table: swimming

Answer: SELECT name FROM swimmer WHERE NOT id IN (SELECT swimmer_id FROM record)


Question:
Show the attendances of the performances at location 'TD Garden' or 'Bell Centre'
Additional table information: table: performance_attendance

Answer: SELECT Attendance FROM performance WHERE LOCATION = 'TD Garden' OR LOCATION = 'Bell Centre'


Question:
What are the names of instructors who earn more than at least one instructor from the Biology department?
Additional table information: table: college_2

Answer: SELECT name FROM instructor WHERE salary > (SELECT MIN(salary) FROM instructor WHERE dept_name = 'Biology')


Question:
Which students live in the city with code 'NYC' and have class senator votes in the spring election cycle? Count the numbers.
Additional table information: table: voter_2

Answer: SELECT COUNT(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = 'NYC' AND T2.Election_Cycle = 'Spring'


Question:
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name


Question:
Return the names and ids of customers who have TN in their address.
Additional table information: table: department_store

Answer: SELECT customer_name, customer_id FROM customers WHERE customer_address LIKE '%TN%'


Question:
Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103.
Additional table information: table: bike_1

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


Question:
Find the total saving balance for each account name.
Additional table information: table: small_bank_1

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


Question:
For each classroom, show the classroom number and count the number of distinct grades that use the room.
Additional table information: table: student_1

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


Question:
How many credit cards does customer Blanche Huels have?
Additional table information: table: customers_card_transactions

Answer: SELECT COUNT(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'


Question:
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
Additional table information: table: department_store

Answer: SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM products)


Question:
On average how large is the population of the counties?
Additional table information: table: election

Answer: SELECT AVG(Population) FROM county


Question:
Return the addresses of the course authors or tutors whose personal name is 'Cathrine'.
Additional table information: table: e_learning

Answer: SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = 'Cathrine'


Question:
What are the phone numbers of all customers and all staff members?
Additional table information: table: customer_complaints

Answer: SELECT phone_number FROM customers UNION SELECT phone_number FROM staff


Question:
Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
Additional table information: table: scientist_1

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


Question:
Which schools have more than 1 player? Give me the school locations.
Additional table information: table: school_player

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


Question:
What are the products with the maximum page size A4 that also have a pages per minute color smaller than 5?
Additional table information: table: store_product

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


Question:
Which allergy type has most number of allergies?
Additional table information: table: allergy_1

Answer: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the first and last name of the faculty who is involved in the largest number of activities.
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the departure and arrival dates of all flights from LA to Honolulu?
Additional table information: table: flight_1

Answer: SELECT departure_date, arrival_date FROM Flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'


Question:
How many aircrafts exist in the database?
Additional table information: table: flight_1

Answer: SELECT COUNT(*) FROM Aircraft


Question:
Show the average transaction amount for different transaction types.
Additional table information: table: tracking_share_transactions

Answer: SELECT transaction_type_code, AVG(amount_of_transaction) FROM TRANSACTIONS GROUP BY transaction_type_code


Question:
What states have at least two representatives?
Additional table information: table: election_representative

Answer: SELECT State FROM representative GROUP BY State HAVING COUNT(*) >= 2


Question:
How many distinct locations of perpetrators are there?
Additional table information: table: perpetrator

Answer: SELECT COUNT(DISTINCT LOCATION) FROM perpetrator


Question:
What is the highest salary among each team? List the team name, id and maximum salary.
Additional table information: table: baseball_1

Answer: SELECT T1.name, T1.team_id, MAX(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id


Question:
How many employees are there all together?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM employee


Question:
What are the dates with a maximum temperature higher than 85?
Additional table information: table: bike_1

Answer: SELECT date FROM weather WHERE max_temperature_f > 85


Question:
List the grapes and appelations of all wines.
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation FROM WINE


Question:
How many rooms cost more than 120, for each different decor?
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor


Question:
Show ids for all aircrafts with more than 1000 distance.
Additional table information: table: flight_1

Answer: SELECT aid FROM Aircraft WHERE distance > 1000


Question:
Find the name and category of the most expensive product.
Additional table information: table: customer_complaints

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


Question:
Count the number of video games with Massively multiplayer online game type .
Additional table information: table: game_1

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


Question:
Show all distinct location names.
Additional table information: table: cre_Theme_park

Answer: SELECT DISTINCT Location_Name FROM LOCATIONS


Question:
Give the districts which have two or more addresses.
Additional table information: table: sakila_1

Answer: SELECT district FROM address GROUP BY district HAVING COUNT(*) >= 2


Question:
Find the last names of teachers teaching in classroom 109.
Additional table information: table: student_1

Answer: SELECT lastname FROM teachers WHERE classroom = 109


Question:
Find the names of customers who have bought by at least three distinct products.
Additional table information: table: department_store

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


Question:
What are the distinct Famous release dates?
Additional table information: table: music_4

Answer: SELECT DISTINCT (Famous_Release_date) FROM artist


Question:
Show names of technicians and series of machines they are assigned to repair.
Additional table information: table: machine_repair

Answer: SELECT T3.Name, T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID


Question:
Find the total balance across checking accounts.
Additional table information: table: small_bank_1

Answer: SELECT SUM(balance) FROM checking


Question:
What is draft detail of the document with id 7?
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT draft_details FROM Document_Drafts WHERE document_id = 7


Question:
Give me a list of id and status of orders which belong to the customer named 'Jeramie'.
Additional table information: table: tracking_orders

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


Question:
What is the name of the document which has been accessed the most times, as well as the number of 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:
What is the average number of customers across banks in the state of Utah?
Additional table information: table: loan_1

Answer: SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah'


Question:
Which year has the most degrees conferred?
Additional table information: table: csu_1

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


Question:
Show the member names which are in both the party with id 3 and the party with id 1.
Additional table information: table: party_people

Answer: SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1


Question:
What are the average, maximum, and minimum number of floors for all buildings?
Additional table information: table: protein_institute

Answer: SELECT AVG(floors), MAX(floors), MIN(floors) FROM building


Question:
What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research?
Additional table information: table: tracking_grants_for_research

Answer: SELECT T1.sent_date FROM documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research'


Question:
How many books are there?
Additional table information: table: book_2

Answer: SELECT COUNT(*) FROM book


Question:
What are the names of customers with checking balances lower than the average checking balance?
Additional table information: table: small_bank_1

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


Question:
Find the first name of students living in city PHL whose age is between 20 and 25.
Additional table information: table: dorm_1

Answer: SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25


Question:
What are the names of the wrestlers, ordered descending by days held?
Additional table information: table: wrestler

Answer: SELECT Name FROM wrestler ORDER BY Days_held DESC


Question:
Show ids, customer ids, card type codes, card numbers for all cards.
Additional table information: table: customers_card_transactions

Answer: SELECT card_id, customer_id, card_type_code, card_number FROM Customers_cards


Question:
What is the name, address, and number of students in the departments that have the 3 most students?
Additional table information: table: college_1

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


Question:
What are the names of all the dorms that can accomdate more than 300 students?
Additional table information: table: dorm_1

Answer: SELECT dorm_name FROM dorm WHERE student_capacity > 300


Question:
What is the average minimum and price of the rooms for each different decor.
Additional table information: table: inn_1

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


Question:
Find the name of the customers who use the most frequently used payment method.
Additional table information: table: customers_and_addresses

Answer: SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1)


Question:
What is the description of the claim status 'Open'?
Additional table information: table: insurance_and_eClaims

Answer: SELECT claim_status_description FROM claims_processing_stages WHERE claim_status_name = 'Open'


Question:
How many scientists do not have any projects assigned to them?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
Find the number of people whose age is greater than all engineers.
Additional table information: table: network_2

Answer: SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer')


Question:
What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre?
Additional table information: table: music_1

Answer: SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is NULLS FIRST


Question:
In what year was the most degrees conferred?
Additional table information: table: csu_1

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


Question:
What is the first and last name of the youngest student with a GPA above 3, and what is their GPA?
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1


Question:
What is the total revenue of all companies whose main office is at Tokyo or Taiwan?
Additional table information: table: manufactory_1

Answer: SELECT SUM(revenue) FROM manufacturers WHERE Headquarter = 'Tokyo' OR Headquarter = 'Taiwan'


Question:
What are the names and buying prices of all the products?
Additional table information: table: products_gen_characteristics

Answer: SELECT product_name, typical_buying_price FROM products


Question:
How long does track Fast As a Shark has?
Additional table information: table: store_1

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


Question:
What are the birth date and birth place of the body builder with the highest total points?
Additional table information: table: body_builder

Answer: SELECT T2.Birth_Date, T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC LIMIT 1


Question:
What are the purchase details of transactions with amount bigger than 10000?
Additional table information: table: tracking_share_transactions

Answer: SELECT T1.purchase_details FROM PURCHASES AS T1 JOIN TRANSACTIONS AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000


Question:
What is allergy type of a cat allergy?
Additional table information: table: allergy_1

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


Question:
How many members of club 'Bootup Baltimore' are younger 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 is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
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 WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'


Question:
What is the total number of students enrolled in schools without any goalies?
Additional table information: table: soccer_2

Answer: SELECT SUM(enr) FROM college WHERE NOT cName IN (SELECT cName FROM tryout WHERE pPos = 'goalie')


Question:
Show name, address road, and city for all branches sorted by open year.
Additional table information: table: shop_membership

Answer: SELECT name, address_road, city FROM branch ORDER BY open_year NULLS FIRST


Question:
What is the nickname of the employee named Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
List the employees who have not showed up in any circulation history of documents. List the employee's name.
Additional table information: table: cre_Doc_Control_Systems

Answer: SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id


Question:
Show the detail of vehicle with id 1.
Additional table information: table: driving_school

Answer: SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1


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

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


Question:
What are the birth dates of employees living in Edmonton?
Additional table information: table: chinook_1

Answer: SELECT BirthDate FROM EMPLOYEE WHERE City = 'Edmonton'


Question:
List all different genre types.
Additional table information: table: store_1

Answer: SELECT DISTINCT name FROM genres


Question:
How many appointments are there?
Additional table information: table: hospital_1

Answer: SELECT COUNT(*) FROM appointment


Question:
What are the first names of all employees that are professors ordered by date of birth?
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob NULLS FIRST


Question:
What are the different affiliations, and what is the total enrollment of schools founded after 1850 for each enrollment type?
Additional table information: table: university_basketball

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


Question:
Which physicians are trained in procedures that are more expensive than 5000?
Additional table information: table: hospital_1

Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000


Question:
Show the ids for projects with at least 2 documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2


Question:
What are the names of entrepreneurs?
Additional table information: table: entrepreneur

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


Question:
Which last names are both used by customers and by staff?
Additional table information: table: driving_school

Answer: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff


Question:
Who performed the song named 'Le Pop'?
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 = 'Le Pop'


Question:
What is the name and city of the airport that the most routes end at?
Additional table information: table: flight_4

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


Question:
List the names of customers who have once canceled the purchase of the product 'food' (the item status is 'Cancel').
Additional table information: table: tracking_orders

Answer: SELECT T1.customer_name FROM customers AS T1, orders AS T2, order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = 'Cancel' AND T4.product_name = 'food' GROUP BY T1.customer_id HAVING COUNT(*) >= 1


Question:
What are the names of the courses that have exactly 1 student enrollment?
Additional table information: table: e_learning

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


Question:
how many programs are broadcast in each time section of the day?
Additional table information: table: program_share

Answer: SELECT COUNT(*), time_of_day FROM broadcast GROUP BY time_of_day


Question:
Count the number of schools that have had basketball matches.
Additional table information: table: university_basketball

Answer: SELECT COUNT(DISTINCT school_id) FROM basketball_match


Question:
Show first name and last name for all students.
Additional table information: table: allergy_1

Answer: SELECT Fname, Lname FROM Student


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

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


Question:
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin'


Question:
Which products has been complained by the customer who has filed least amount of complaints?
Additional table information: table: customer_complaints

Answer: SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id, customers AS t3 GROUP BY t3.customer_id ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
Find the names of departments that are located in Houston.
Additional table information: table: company_1

Answer: SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'


Question:
Who are the ministers and what parties do they belong to, listed descending by the times they took office?
Additional table information: table: party_people

Answer: SELECT minister, party_name FROM party ORDER BY took_office DESC


Question:
What are the names of all people who do not have friends?
Additional table information: table: network_2

Answer: SELECT name FROM person EXCEPT SELECT name FROM PersonFriend


Question:
What are the names and capitals of each country?
Additional table information: table: match_season

Answer: SELECT Country_name, Capital FROM country


Question:
What are the top 10 customers' first and last names by total number of orders and how many orders did they make?
Additional table information: table: store_1

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


Question:
What is the total number of deaths and damage for all storms with a max speed greater than the average?
Additional table information: table: storm_record

Answer: SELECT SUM(number_deaths), SUM(damage_millions_USD) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)


Question:
What are the total number of students who are living in a male dorm?
Additional table information: table: dorm_1

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


Question:
How many credits does the department offer?
Additional table information: table: college_1

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


Question:
What are the names of all playlists that have more than 100 tracks?
Additional table information: table: store_1

Answer: SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING COUNT(T1.track_id) > 100


Question:
How many rooms are located for each 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:
What are the names of projects that require more than 300 hours, and how many scientists are assigned to each?
Additional table information: table: scientist_1

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


Question:
What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8)


Question:
What is the name of the product with the color description 'yellow'?
Additional table information: table: products_gen_characteristics

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


Question:
What is the largest payment amount?
Additional table information: table: sakila_1

Answer: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1


Question:
What is the id and name of the employee with the highest salary?
Additional table information: table: flight_1

Answer: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1


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

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


Question:
Return the id and full name of the customer with the most accounts.
Additional table information: table: customers_and_invoices

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


Question:
What are all the role codes, role names, and role descriptions?
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT role_code, role_name, role_description FROM ROLES


Question:
Which employees do not destroy any document? Find their employee ids.
Additional table information: table: cre_Doc_Tracking_DB

Answer: SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed


Question:
How many dorms are there and what is the total capacity for each gender?
Additional table information: table: dorm_1

Answer: SELECT COUNT(*), SUM(student_capacity), gender FROM dorm GROUP BY gender


Question:
How many persons are not body builders?
Additional table information: table: body_builder

Answer: SELECT COUNT(*) FROM people WHERE NOT people_id IN (SELECT People_ID FROM body_builder)