db_id
stringclasses
69 values
question
stringlengths
24
321
evidence
stringlengths
0
673
SQL
stringlengths
30
743
question_id
int64
0
6.6k
difficulty
stringclasses
3 values
image_and_language
Which object classes belong to the onion category?
onion category refers to OBJ_CLASS = 'onion';
SELECT OBJ_CLASS_ID FROM OBJ_CLASSES WHERE OBJ_CLASS = 'onion'
6,400
simple
retails
List all the nations in Europe.
nation refers to n_name; Europe refers to r_name = 'EUROPE'
SELECT T2.n_name FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T1.r_name = 'EUROPE'
6,401
simple
mondial_geo
How many percent of the total area of Russia is in Europe?
SELECT T2.Percentage FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Russia' AND T1.Name = 'Europe'
6,402
simple
sales
Tally the product name and quantity of the first ten sales.
first ten sales refers to SalesID BETWEEN 1 AND 10;
SELECT T3.Name, T2.Quantity FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.SalesID BETWEEN 1 AND 10
6,403
simple
chicago_crime
Among the crimes in the Central, calculate the percentage of larceny incidents.
Central refers to side = 'Central'; larceny refers to title = 'Larceny'; percentage = divide(count(report_no where title = 'Larceny'), count(report_no)) where side = 'Central' * 100%
SELECT CAST(COUNT(CASE WHEN T3.title = 'Larceny' THEN T2.report_no END) AS REAL) * 100 / COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T1.side = 'Central'
6,404
challenging
university
Please list the IDs of the universities with a student staff ratio of over 15 in 2011.
in 2011 refers to year 2011; student staff ratio of over 15 refers to student_staff_ratio > 15; ID of the university refers to university_id
SELECT university_id FROM university_year WHERE year = 2011 AND student_staff_ratio > 15
6,405
simple
works_cycles
Who is the top sales person who achived highest percentage of projected sales quota in 2013?
2013 refers to QuotaDate = '2013'; DIVIDE(SalesLastYear), (SUM(SalesQuota where YEAR(QuotaDate) = 2013)) as percentage
SELECT BusinessEntityID FROM SalesPerson WHERE BusinessEntityID IN ( SELECT BusinessEntityID FROM SalesPersonQuotaHistory WHERE STRFTIME('%Y', QuotaDate) = '2013' ) ORDER BY CAST(SalesLastYear AS REAL) / SalesQuota DESC LIMIT 1
6,406
moderate
olympics
What is the NOC code of the region where the tallest male Olympic competitor is from?
NOC code of the region refers to noc; male refers to gender = 'M'; the tallest refers to MAX(height);
SELECT T1.noc FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.gender = 'M' ORDER BY T3.height DESC LIMIT 1
6,407
moderate
retail_world
Name the suppliers that supply products under the category 'cheeses.'
suppliers refers to CompanyName; 'cheeses' is a Description
SELECT DISTINCT T1.CompanyName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.Description = 'Cheeses'
6,408
simple
food_inspection_2
How many of the inspections with serious point levels have no fines?
serious point level refers to point_level = 'Serious'; no fines refers to fine = 0
SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0
6,409
simple
shakespeare
What is the percentage of act number 5 in Titus Andronicus?
act number 5 refers to Act = 5; Titus Andronicus refers to Title = 'Titus Andronicus'; percentage = divide(sum(Act = 5), count(Act)) as percentage
SELECT CAST(SUM(IIF(T2.act = 5, 1, 0)) AS REAL) * 100 / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Titus Andronicus'
6,410
moderate
restaurant
Please list all of the restaurants that serve European food.
restaurant refers to label; European food refers to food_type = 'european'
SELECT label FROM generalinfo WHERE food_type = 'european'
6,411
simple
works_cycles
What is the name of the supplier number 1492?
supplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor
SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492
6,412
simple
sales
How many of the employees have the last name "Ringer" ?
SELECT COUNT(LastName) FROM Employees WHERE LastName = 'Ringer'
6,413
simple
computer_student
Find the ID of advisor of student ID 80 and state the level of courses taught by him/her.
ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel
SELECT T1.p_id_dummy, T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id = 80
6,414
simple
regional_sales
How many orders were shipped by the sales team with the highest amount of shipped orders in 2020? Give the name of the said sales team.
shipped refers to ShipDate; in 2020 refers to SUBSTR(ShipDate, -2) = '20'; highest amount of shipped orders refers to Max(Count(OrderNumber))
SELECT COUNT(T1.OrderNumber), T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.ShipDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
6,415
challenging
superstore
In west superstore, what is the name and the shipping mode of the product that was ordered with the shortest shipment time?
name refers to "Product Name"; shipping mode refers to Ship Mode; shortest shipment time refers to min(subtract(Ship Date, Order Date))
SELECT DISTINCT T2.`Product Name`, T1.`Ship Mode` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Region = 'West' ORDER BY T1.`Ship Date` - T1.`Order Date` LIMIT 1
6,416
moderate
soccer_2016
What is the city name of country ID 3?
SELECT City_Name FROM City WHERE Country_ID = 3
6,417
simple
ice_hockey_draft
List the names of all players from Avangard Omsk who played in the 2000-2001 season of the International league that have no goals in draft year.
names of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; International league refers to LEAGUE = 'International'; no goals in draft year refers to G = 0; 2000-2001 season refers to SEASON = '2000-2001';
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' AND T1.TEAM = 'Czech Republic (all)' AND T1.G = 0
6,418
moderate
ice_hockey_draft
What is the height of David Bornhammar in inches?
heigh in inches refers to height_in_inch;
SELECT T2.height_in_inch FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'David Bornhammar'
6,419
simple
retail_world
When was the employee who handled order id 10281 hired?
When was hired refers to HireDate
SELECT T1.HireDate FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10281
6,420
simple
professional_basketball
How old was Alexis Ajinca when he was first drafted?
age when drafted refers to Subtract(draftYear, year(birthDate)); first drafted refers to draftYear
SELECT draftYear - strftime('%Y', birthDate) FROM draft AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Alexis' AND T1.lastName = 'Ajinca' AND draftRound = 1
6,421
moderate
retails
Among the customers from the United States, which market segment has the highest number of customers?
the highest number of customers refer to MAX(COUNT(c_custkey)); the United States is the name of the nation which refers to n_name = 'UNITED STATES'; market segment refers to c_mktsegment;
SELECT T.c_mktsegment FROM ( SELECT T1.c_mktsegment, COUNT(T1.c_custkey) AS num FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'UNITED STATES' GROUP BY T1.c_mktsegment ) AS T ORDER BY T.num DESC LIMIT 1
6,422
moderate
movies_4
What keyword can the user use to search for the movie Finding Nemo?
What keyword refers to keyword_name; Finding Nemo refers to title = 'Finding Nemo'
SELECT T3.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T1.title = 'Finding Nemo'
6,423
simple
books
What is the full name of the customer who owns the "[email protected]" e-mail address?
"[email protected]" is the email of customer; full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = '[email protected]'
6,424
simple
food_inspection
What is the average score for "Chairman Bao" in all its unscheduled routine inspections?
DIVIDE(SUM(score where type = 'Routine - Unscheduled' and name = 'Chairman Bao'), COUNT(type = 'Routine - Unscheduled' where name = 'Chairman Bao'));
SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id
6,425
moderate
professional_basketball
List all the coaches with more game lost than won from year 2000-2010. List the coach ID, team name and year.
from year 2000 to 2010 refers to year between 2000 and 2010; more game lost then won refers to lost > won
SELECT DISTINCT T1.coachID, T2.tmID, T1.year FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 2000 AND 2010 AND T2.lost > T2.won
6,426
simple
donor
State the name of vendor that supplies book resources to all school with literacy subject as their primary focus.
literacy subject as primary focus refers to primary_focus_subject = 'Literacy'
SELECT DISTINCT T1.vendor_name FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T2.primary_focus_subject LIKE 'Literacy'
6,427
simple
retail_world
Mention the first name of employee who took care the order id 10250.
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10250
6,428
simple
simpson_episodes
List all keywords associated with the episode 'Take My Life, Please'.
episode 'Take My Life, Please' refers to title =   'Take My Life, Please'
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';
6,429
simple
hockey
List all goalies who played in the year 2005 season and shorter than 72 inches. List all the team names he play for.
shorter than 72 inches refers to height<72
SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.tmID = T3.tmID WHERE T2.year = 2005 AND T1.height < 72
6,430
moderate
movielens
Which genre contains the greatest number of non-English films?
isEnglish = 'F' means non-English
SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' GROUP BY T2.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1
6,431
simple
donor
Give the coordinates of the buyer of R & A Plant Genetics from Benchmark Education.
coordinates refer to (school_latitude, school_longitude); R & A Plant Genetics refer to item_name; Benchmark Education refer to vendor_name
SELECT T2.school_latitude, T2.school_longitude FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.item_name = 'R & A Plant Genetics' AND T1.vendor_name = 'Benchmark Education'
6,432
simple
codebase_comments
How much is the processed time of downloading the most popular repository?
more watchers mean that this repository is more popular;
SELECT ProcessedTime FROM Repo WHERE Watchers = ( SELECT MAX(Watchers) FROM Repo )
6,433
simple
retail_world
What are the names of the products that were ordered that have a unit price of no more than 5?
unit price of no more than 5 refers to UnitPrice < 5; name of products refers to ProductName
SELECT DISTINCT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.UnitPrice < 5
6,434
simple
computer_student
What year in the program do the students with more than 2 advisors are in?
students refers to student = 1; more than 2 advisors refers to count(p_id_dummy) > 2
SELECT T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.student = 1 GROUP BY T2.p_id HAVING COUNT(T2.p_id) > 2
6,435
simple
retail_complains
List the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.
1 star refers to Stars = 1; on March 14, 2016 refers to Date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA'
SELECT T2.Product FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Newton' AND T1.state_abbrev = 'MA' AND T2.Date = '2016-03-14' AND T2.Stars = 1
6,436
moderate
computer_student
List the professor ID who taught the course ID from 121 to 130 of basic undergraduate courses.
professor ID refers to taughtBy.p_id; course ID from 121 to 130 of basic undergraduate courses refers to courseLevel = 'Level_300' and course.course_id between 121 and 130
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_300' AND T1.course_id > 121 AND T1.course_id < 130
6,437
simple
olympics
In which cities beginning with the letter M have the Olympic Games been held?
cities beginning with the letter M refer to city_name LIKE 'M%';
SELECT city_name FROM city WHERE city_name LIKE 'M%'
6,438
simple
restaurant
In which regions are there no African food restaurants?
no African food restaurants refers to food_type <> 'african'
SELECT DISTINCT T2.region FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type != 'african'
6,439
simple
sales_in_weather
Among the days on which over 100 units of item no.5 were sold in store no.3, on which date was the temperature range the biggest?
over 100 units refers to units > 100; item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; the temperature range was the biggest refers to Max(Subtract(tmax, tmin))
SELECT T2.`date` FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 AND T2.units > 100 ORDER BY tmax - tmin DESC LIMIT 1
6,440
moderate
video_games
On which platform was Panzer Tactics released in 2007?
platform refers to platform_name; Panzer Tactics refers to game_name = 'Panzer Tactics'; released in 2007 refers to release_year = 2007
SELECT T5.platform_name FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN game AS T3 ON T1.game_id = T3.id INNER JOIN game_platform AS T4 ON T1.id = T4.game_publisher_id INNER JOIN platform AS T5 ON T4.platform_id = T5.id WHERE T3.game_name = 'Panzer Tactics' AND T4.release_year = 2007
6,441
moderate
book_publishing_company
What is the highest level of job to get to for the employee who got hired the earliest?
highest job level refers to MAX(job_lvl); hired the earliest refers to MIN(hire_date)
SELECT T2.max_lvl FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id ORDER BY T1.hire_date LIMIT 1
6,442
simple
law_episode
How many people gave the most enjoyed episode a 10-star rating?
the most enjoyed refers max(rating); 10-star refers to stars = 10
SELECT COUNT(T1.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10
6,443
simple
donor
What is the percentage of payment methods of donations made in March 2013?
made in March 2013 refers to substr(donation_timestamp,1,7) = '2013-03'; percentage refers to DIVIDE(SUM(payment_method made in March 2013), SUM(payment_method))*100
SELECT payment_method , CAST(COUNT(donationid) AS REAL) * 100 / 51090 FROM donations WHERE donation_timestamp LIKE '2013-03%' GROUP BY payment_method
6,444
simple
simpson_episodes
What is the average heights of crew members from Animation Department?
from Animation Department refers to category = 'Animation Department'; AVG(height_meters) where category = 'Animation Department'
SELECT AVG(T1.height_meters) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Animation Department';
6,445
simple
social_media
Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?
"Sante Fe" is the State; "Argentina" is the Country; posted on 31st refers to Day = 31
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'
6,446
simple
retails
Calculate the total profit made by chocolate floral blue coral cyan.
SUBTRACT(MULTIPLY(l_extendedprice, (SUBTRACT(1, l_discount)), MULTIPLY(ps_supplycost, l_quantity))) where p_name = 'chocolate floral blue coral cyan';
SELECT SUM(T3.l_extendedprice * (1 - T3.l_discount) - T2.ps_supplycost * T3.l_quantity) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN lineitem AS T3 ON T2.ps_partkey = T3.l_partkey AND T2.ps_suppkey = T3.l_suppkey WHERE T1.p_name = 'chocolate floral blue coral cyan'
6,447
moderate
human_resources
What are the maximum and minimum salary range and position title of Bill Marlin?
Bill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary
SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'
6,448
simple
video_games
Provide the number of games sold in North America on the PS4 platform.
number of games sold refers to sum(multiply(num_sales, 100000)); in North America refers to region_name = 'North America'; on the PS4 platform refers to platform_name = 'PS4'
SELECT SUM(T1.num_sales * 100000) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id INNER JOIN game_platform AS T3 ON T1.game_platform_id = T3.id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T2.region_name = 'North America' AND T4.platform_name = 'PS4'
6,449
moderate
works_cycles
What is the email address of the Facilities Manager?
Facilities Manager is a job title
SELECT T3.EmailAddress FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmailAddress AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.JobTitle = 'Facilities Manager'
6,450
simple
video_games
How many more games were sold on game platform ID 50 than on game platform ID 51 in region ID 1?
result = subtract(sum(num_sales where game_platform_id = 50), sum(num_sales where game_platform_id = 51))
SELECT (SUM(CASE WHEN T.game_platform_id = 50 THEN T.num_sales ELSE 0 END) - SUM(CASE WHEN T.game_platform_id = 51 THEN T.num_sales ELSE 0 END)) * 100000 AS nums FROM region_sales AS T WHERE T.region_id = 1
6,451
moderate
beer_factory
Among the transactions made in July, 2014, how many of them were made by a male customer?
in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07'; male customer refers to Gender = 'M';
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07'
6,452
moderate
chicago_crime
List the name and population of the communities where more than average solicit for prostitutes were reported.
"SOLICIT FOR PROSTITUTE" is the secondary_description; more than average refers to count(iucr_no) > Divide (Count(secondary_description = 'SOLICIT FOR PROSTITUTE'), Count(iucr_no)); name of community refers to community_area_name
SELECT T2.community_area_name, T2.population FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T1.iucr_no WHERE T3.iucr_no = ( SELECT iucr_no FROM IUCR WHERE secondary_description = 'SOLICIT FOR PROSTITUTE' GROUP BY iucr_no HAVING COUNT(iucr_no) > ( SELECT SUM(CASE WHEN secondary_description = 'SOLICIT FOR PROSTITUTE' THEN 1.0 ELSE 0 END) / COUNT(iucr_no) AS average FROM IUCR ) )
6,453
challenging
regional_sales
List by ID all sales teams that have sold products at a 10% discount in store.
ID refers to _SalesTeamID; 10% discount refers to Discount Applied = 0.1; 'In-Store' is the Sales Channel
SELECT DISTINCT T FROM ( SELECT CASE WHEN `Discount Applied` = '0.1' AND `Sales Channel` = 'In-Store' THEN _SalesTeamID ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
6,454
simple
retails
What is the profit for part no.98768 in order no.1?
part no.98768 refers to l_partkey = 98768; order no.1 refers to l_orderkey = 1; profit = subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))
SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_orderkey = 1 AND T1.l_partkey = 98768
6,455
simple
books
What is the book with the most orders?
books refers to title; the most orders refers to Max(Count(order_id))
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1
6,456
simple
image_and_language
How many images have at least 25 attributes?
images refers to IMG_ID; have at least 25 attributes refers to count(ATT_CLASS_ID) > = 25
SELECT COUNT(*) FROM ( SELECT IMG_ID FROM IMG_OBJ_att GROUP BY IMG_ID HAVING COUNT(ATT_CLASS_ID) > 25 ) T1
6,457
simple
works_cycles
Among the products that are purchased, how many of them have never received the highest rating?
product that are purchased refers to MakeFlag = 0; never received highest rating refers to Rating! = 5
SELECT COUNT(T1.ProductID) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND T1.Rating != 5
6,458
simple
car_retails
Which of the customers, whose Tokyo-based sales representative reports to the Vice President of Sales whose employee number is 1056, has paid the highest payment? List the customer's name, the contact person and calculate the total amount of that customer's total payments.
Tokyo is a city; 'reportsTO' is the leader of the 'employeeNumber'; highest payment refers to MAX(amount); total amount of payments = SUM(amount);
SELECT T2.customerName, T2.contactFirstName, T2.contactLastName, SUM(T3.amount) FROM employees AS T1 INNER JOIN customers AS T2 ON T2.salesRepEmployeeNumber = T1.employeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN offices AS T4 ON T1.officeCode = T4.officeCode WHERE T4.city = 'Tokyo' AND T1.reportsTo = 1056 GROUP BY T2.customerName, T2.contactFirstName, T2.contactLastName ORDER BY amount DESC LIMIT 1
6,459
challenging
books
What percentage of books written by Hirohiko make up the number of books published by Viz Media?
"Hirohiko Araki" is the author_name; 'Viz Media' is the publisher_name; percentage = Divide (Count(author_name = 'Hirohiko Araki'), Count(book_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.author_name = 'Hirohiko Araki' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T2.author_id = T1.author_id INNER JOIN book AS T3 ON T3.book_id = T2.book_id INNER JOIN publisher AS T4 ON T4.publisher_id = T3.publisher_id WHERE T4.publisher_name = 'VIZ Media'
6,460
challenging
donor
How many donors from New Jersey have made a donation for an honoree?
from New Jersey refers to donor_state = 'NJ'; for an honoree refers to for_honoree = 't';
SELECT COUNT(donationid) FROM donations WHERE for_honoree = 't' AND donor_state = 'NJ'
6,461
simple
legislator
What is the party of the legislator named Susan M. Collins?
legislator's name refers to offical_full_name;
SELECT T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Susan M. Collins' GROUP BY T2.party
6,462
simple
works_cycles
Please list the departments that are part of the Executive General and Administration group.
Department refers to Name where GroupName = 'Executive General and Administration'
SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'
6,463
simple
movie
Count the male actors born in USA that starred in Ghost.
male refers to Gender = 'Male'; born in USA refers to Birth Country = 'USA'; Ghost refers to Title = 'Ghost'
SELECT COUNT(*) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Ghost' AND T3.Gender = 'Male' AND T3.`Birth Country` = 'USA'
6,464
moderate
restaurant
What is the name of the 24 hour diner at San Francisco?
name refers to label; 24 hour diner refers to food_type = '24 hour diner'; San Francisco refers to city = 'san francisco'
SELECT label FROM generalinfo WHERE food_type = '24 hour diner' AND city = 'san francisco'
6,465
simple
works_cycles
As of 12/31/2011, how long has the employee assigned to all pending for approval papers been working in the company from the date he was hired?
pending for approval papers refer to Status = 1; length of stay in the company as of 12/31/2011 = SUBTRACT(2011, year(HireDate));
SELECT 2011 - STRFTIME('%Y', T2.HireDate) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 1
6,466
moderate
public_review_platform
How many "5" star reviews does the Yelp business No. "10682" get?
5 star reviews refers to review_stars = 5; business No. refers to business_id;
SELECT COUNT(review_length) FROM Reviews WHERE business_id = 10682 AND review_stars = 5
6,467
simple
professional_basketball
Which coach has the most 'won' than 'lost' in year '1988'?
in year '1988' refers to year = 1988; the most 'won' than 'lost' refers to max(subtract(won, lost))
SELECT coachID FROM coaches WHERE year = 1988 ORDER BY won - lost DESC LIMIT 1
6,468
simple
disney
Who is the villain in the movie "The Great Mouse Detective"?
The Great Mouse Detective refers to movie_title = 'The Great Mouse Detective';
SELECT villian FROM characters WHERE movie_title = 'The Great Mouse Detective'
6,469
simple
donor
What is the total number of students impacted by the projects with a donation from a donor with zip code "22205"?
zip code "22205" refers to donor_zip = '22205'; students impacted refers to students_reached
SELECT SUM(T2.students_reached) FROM donations AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.donor_zip = 22205
6,470
simple
world
What is the average life expentancy of countries that speak Arabic?
average life expectancy = AVG(LifeExpectancy); speak Arabic refers to `Language` = 'Arabic';
SELECT AVG(T1.LifeExpectancy) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Arabic'
6,471
simple
food_inspection
Which restaurant had more low risk violation in inspections, Tiramisu Kitchen or OMNI S.F. Hotel - 2nd Floor Pantry?
Tiramisu Kitchen and OMNI S.F. Hotel - 2nd Floor Pantry are names of the business; more low risk violations refer to MAX(COUNT(risk_category = 'Low Risk'));
SELECT CASE WHEN SUM(CASE WHEN T2.name = 'OMNI S.F. Hotel - 2nd Floor Pantry' THEN 1 ELSE 0 END) > SUM(CASE WHEN T2.name = 'Tiramisu Kitchen' THEN 1 ELSE 0 END) THEN 'OMNI S.F. Hotel - 2nd Floor Pantry' ELSE 'Tiramisu Kitchen' END AS result FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk'
6,472
challenging
sales
List the customer's ID and last name of the customer that purchased a product with a quantity greater than 90% of the average quantity of all listed products.
quantity greater than 90% of the average quantity = Quantity > MULTIPLY(AVG(Quantity), 0.9);
SELECT T2.CustomerID, T2.LastName FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Quantity > ( SELECT AVG(Quantity) FROM Sales ) * 0.9
6,473
moderate
talkingdata
What were the locations of the events on 8th May, 2016?
location = longitude, latitude; on 8th May, 2016 refers to `timestamp` LIKE '2016-05-08%';
SELECT longitude, latitude FROM `events` WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-08'
6,474
simple
public_review_platform
List out 10 business ID that are being reviewed the most by users and list out what are top 3 business categories.
being reviewed the most refers to MAX(user_id); business categories refer to category_name;
SELECT T2.business_id, T3.category_name FROM Reviews AS T1 INNER JOIN Business_categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id GROUP BY T2.business_id ORDER BY COUNT(T1.user_id) DESC LIMIT 10
6,475
moderate
student_loan
Among the students who have been absent for four months, provide any five students' names and enlisted organizations.
absent for four months refers to month = 4; enlisted organizations refers to organ;
SELECT T2.name, T2.organ FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.month = 4 LIMIT 5
6,476
simple
disney
Determine the average gross for Disney's PG-13-rated action movies.
DIVIDE(SUM(total_gross where genre = 'Action' and MPAA_rating = 'PG-13'), COUNT(movie_title where genre = 'Action' and MPAA_rating = 'PG-13'));
SELECT SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) / COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'PG-13'
6,477
simple
cs_semester
How many research assistants of Ogdon Zywicki have an average salary?
research assistant refers to the student who serves for research where the abbreviation is RA; average salary refers to salary = 'med';
SELECT COUNT(T1.prof_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T1.salary = 'med' AND T2.last_name = 'Zywicki'
6,478
simple
sales
Identify the name of the sales person with employee ID 7.
name of the sales person = FirstName, MiddleInitial, LastName;
SELECT FirstName, MiddleInitial, LastName FROM Employees WHERE EmployeeID = 7
6,479
simple
restaurant
List restaurant ids located in Danville city.
SELECT id_restaurant FROM location WHERE city = 'Danville'
6,480
simple
human_resources
State the name of the city where Jose Rodriguez works.
Jose Rodriguez is the fullname of an employee; full name = firstname, lastname; name of city refers to locationcity
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'
6,481
simple
student_loan
How many students enlisted in the Navy?
Navy refers to organ = 'navy';
SELECT COUNT(name) FROM enlist WHERE organ = 'navy'
6,482
simple
college_completion
Provide the institute name with less than 200 graduate cohort of all races and genders in 2013. Also, please state the total number of full-time equivalent undergraduates for the institute.
institute name refers to chronname; less than 200 graduate cohort refers to grad_cohort < 200; all races refers to race = 'X'; all genders refers to gender = 'B'; in 2013 refers to year = 2013; total number of full-time equivalent undergraduates refers to fte_value;
SELECT T1.chronname, T2.grad_cohort FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T1.unitid = T2.unitid WHERE T2.year = 2013 AND T2.gender = 'B' AND T2.race = 'X' AND T2.grad_cohort < 200
6,483
moderate
soccer_2016
How many players were born before 10/16/1975, and have a bowling skill of less than 3?
born before 10/16/1975 refers to DOB < 1975-10-16; bowling skill of less than 3 refers to Bowling_skill < 3
SELECT COUNT(*) FROM Player WHERE DOB < '1975-10-16' AND Bowling_skill < 3
6,484
simple
disney
Who are the voice actors in the movie that came out on 11/24/2010?
Came out on 11/24/2010 refers to release_date = 'Nov 24, 2010';
SELECT T2.`voice-actor` FROM movies_total_gross AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T1.release_date = 'Nov 24, 2010'
6,485
simple
movie_3
Who is the manager of the store with the largest collection of films?
Who refers to first_name, last_name; the largest collection of films refers to MAX(film_id)
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.film_id) AS num FROM inventory AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1
6,486
moderate
food_inspection_2
What is the name of the establishment that Joshua Rosa inspected?
name of the establishment refers to dba_name
SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
6,487
simple
retails
What is the nationality of "Customer#000000055"?
"Customer#000000055" is the name of the customer which refers to c_name; nationality is the state of belonging to a particular country, therefore nationality refers to n_name;
SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055'
6,488
simple
works_cycles
Please list the reviewers who have given the highest rating for a medium class, women's product.
highest rating refers to Rating = 5; high class refers to Class = 'H'; men's product refers to Style = 'M'
SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5
6,489
simple
food_inspection
Among the violations in 2016, how many of them have unscheduled inspections?
unscheduled inspections refer to type = 'Routine - Unschedule'; year(date) = 2016;
SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.type = 'Routine - Unscheduled'
6,490
simple
world_development_indicators
How many countries in the North America Region has completed the vital registration?
has completed the vital registration refers to VitalRegistrationComplete = 'Yes'
SELECT COUNT(CountryCode) FROM Country WHERE VitalRegistrationComplete = 'Yes' AND Region = 'North America'
6,491
simple
synthea
Provide the name of the patient who had a claim on 1947/9/11.
name of the patient implies full name and refers to first, last; on 1947/9/11 refers to BILLABLEPERIOD = '1947-09-11';
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.billableperiod = '1947-09-11'
6,492
simple
mondial_geo
Of all the countries in which English is spoken, what percentage has English as their only language?
Percentage = [count(countries 100% English) / count(countries English)] * 100%
SELECT CAST(SUM(CASE WHEN T2.Percentage = 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'English'
6,493
moderate
cars
Calculate the percentage of American cars among all cars.
American car refers to country = 'USA'; percentage = divide(count(ID where country = 'USA'), count(ID)) * 100%
SELECT CAST(SUM(CASE WHEN T3.country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country
6,494
simple
regional_sales
Calculate the average monthly order and percentage of warehouse "WARE-NMK1003" in 2019. Among them, mention number of orders for floor lamps.
"WARE-NMK1003" is the WarehouseCode; in 2019 refers to SUBSTR(OrderDate, -2) = '19'; average = Divide (Count (OrderNumber where SUBSTR(OrderDate, -2) = '19'), 12); Percentage = Divide (Count(OrderNumber where WarehouseCode = 'WARE-NMK1003'), Count(OrderNumber)) * 100; 'Floor Lamps' is the Product Name; number of orders refers to Count(OrderNumber)
SELECT CAST(SUM(CASE WHEN T2.WarehouseCode = 'WARE-NMK1003' THEN 1 ELSE 0 END) AS REAL) / 12 , CAST(SUM(CASE WHEN T2.WarehouseCode = 'WARE-NMK1003' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.OrderNumber), COUNT(CASE WHEN T1.`Product Name` = 'Floor Lamps' AND T2.WarehouseCode = 'WARE-NMK1003' THEN T2.`Order Quantity` ELSE NULL END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T2.OrderDate LIKE '%/%/19'
6,495
challenging
video_games
How many game publisher IDs have published games on the X360 platform?
X360 refers to platform_name = 'X360';
SELECT COUNT(T1.game_publisher_id) FROM game_platform AS T1 INNER JOIN platform AS T2 ON T1.platform_id = T2.id WHERE T2.platform_name = 'X360'
6,496
simple
address
For the county where DeSantis Ron is from, what is the average female median age?
average female median age refers to Divide (Sum(female_median_age), Count(county))
SELECT SUM(T4.female_median_age) / COUNT(T1.county) FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id INNER JOIN zip_data AS T4 ON T1.zip_code = T4.zip_code WHERE T3.first_name = 'DeSantis' AND T3.last_name = 'Ron'
6,497
moderate
hockey
What position did player id "hartgi01" play in his Stanley Cup finals performance?
position refers to pos
SELECT DISTINCT pos FROM ScoringSC WHERE playerID = 'hartgi01'
6,498
simple
olympics
What is the percentage of female athletes below 20s who participated in the 2002 Winter Olympic?
DIVIDE(COUNT(person_id where gender = 'F' and age < 20), COUNT(person_id)) as percentage where games_name = '2002 Winter';
SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2002 Winter' AND T2.age < 20
6,499
moderate