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 |
---|---|---|---|---|---|
public_review_platform
|
What is the review length of user 35026 to business with business ID 2?
|
user 35026 refers to user_id = 35026
|
SELECT review_length FROM Reviews WHERE user_id = 35026 AND business_id = 2
| 5,800 |
simple
|
cars
|
Which car in the database provides the best crash protection based on its weight? How much is it?
|
the best crash protection refers to max(weight); cost refers to price
|
SELECT T1.ID, T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T1.weight DESC LIMIT 1
| 5,801 |
simple
|
movie_3
|
What is the percentage more for the rental payment for store No.2 than store No.1?
|
store no. 1 refers to store_id = 1; store no.2 refers to store_id = 2; rental payment refers to amount; percent more = Divide (Subtract(amount where store_id = 2, amount where store_id = 1), amount where store_id = 1) *100
|
SELECT CAST((SUM(IIF(T2.store_id = 2, T1.amount, 0)) - SUM(IIF(T2.store_id = 1, T1.amount, 0))) AS REAL) * 100 / SUM(IIF(T2.store_id = 1, T1.amount, 0)) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN store AS T3 ON T2.store_id = T3.store_id
| 5,802 |
moderate
|
books
|
The book name "The Season: A Candid Look at Broadway" was published by which publisher?
|
"The Season: A Candid Look at Broadway" is the title of the book; publisher refers to publisher_name
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Season: A Candid Look at Broadway'
| 5,803 |
simple
|
law_episode
|
How many awards has Rene Balcer been nominated for?
|
SELECT COUNT(T2.award_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.name = 'Rene Balcer'
| 5,804 |
simple
|
|
superstore
|
Who is the customer with an order shipped on March 5, 2013, in the eastern region?
|
Who is the customer refers to Customer Name; shipped on March 5, 2013 refers to "Ship Date" = '2013-03-05'; eastern region refers to Region = 'East'
|
SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Ship Date` = '2013-03-05'
| 5,805 |
simple
|
movies_4
|
What is the production company of the movie "Crazy Heart"?
|
movie "Crazy Heart" refers to title = 'Crazy Heart'; production company refers to company_name
|
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Crazy Heart'
| 5,806 |
simple
|
social_media
|
Tweets posted from which city has a higher number of average likes, Bangkok or Chiang Mai?
|
"Bangkok" and "Chiang Mai" are both City; average number of like = Divide (Sum(Likes), Count(TweetID))
|
SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')
| 5,807 |
challenging
|
cars
|
Show the origin country of Chevrolet Malibu.
|
origin country refers to country; Chevrolet Malibu refers to car_name = 'chevrolet malibu'
|
SELECT T3.country FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T1.car_name = 'chevrolet malibu'
| 5,808 |
simple
|
olympics
|
Give the id of the event "Shooting Mixed Skeet".
|
"Shooting Mixed Skeet" refers to event_name = 'Shooting Mixed Skeet';
|
SELECT id FROM event WHERE event_name = 'Shooting Mixed Skeet'
| 5,809 |
simple
|
professional_basketball
|
In which league did the player who weighs 40% less than the heaviest player and whose height is 80 inches play?
|
weigh 40% less than the heaviest player refers to weight = Multiply(Max (weight), 0.6); league refers to lgID
|
SELECT T2.lgID FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID GROUP BY T2.lgID, T1.weight HAVING T1.weight = MAX(T1.weight) - MAX(T1.weight) * 0.4
| 5,810 |
moderate
|
soccer_2016
|
In which venue did Kochi Tuskers Kerala play most of their matches?
|
Kochi Tuskers Kerala refers to Team_Name = 'Kochi Tuskers Kerala'; most of their matches refers to max(Venue_Id)
|
SELECT T1.Venue_Name FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id INNER JOIN Team AS T3 ON T2.Team_1 = T3.Team_Id WHERE T3.Team_Name = 'Kochi Tuskers Kerala' GROUP BY T1.Venue_Name
| 5,811 |
simple
|
donor
|
State the short description for the project which got the donation at 14:44:29 on 2012/9/6.
|
donation at 14:44:29 on 2012/9/6 refers to donation_timestamp = '2012/9/6 14:44:29';
|
SELECT T1.short_description FROM essays AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T2.donation_timestamp LIKE '2012-09-06 14:44:29'
| 5,812 |
simple
|
retail_world
|
What is the average salary of sales representatives in the United Kingdom?
|
average salary = avg(Salary); sales representative refers to Title = 'Sales Representative'; in the United Kingdom refers to Country = 'UK'
|
SELECT AVG(Salary) FROM Employees WHERE Title = 'Sales Representative' AND Country = 'UK'
| 5,813 |
simple
|
retail_world
|
In total, how many orders were shipped via United Package?
|
via United Package refers to CompanyName = 'United Package'
|
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package'
| 5,814 |
simple
|
software_company
|
Please list the occupations of the customers with an education level of 11.
|
education level of 11 refers to EDUCATIONNUM = 11;
|
SELECT DISTINCT OCCUPATION FROM Customers WHERE EDUCATIONNUM = 11
| 5,815 |
simple
|
music_tracker
|
How many singles were released in 1979?
|
releaseType = 'single'; groupYear = 1979;
|
SELECT COUNT(releaseType) FROM torrents WHERE releaseType LIKE 'single' AND groupYear = 1979
| 5,816 |
simple
|
public_review_platform
|
Compare and get the difference of the number of businesses that are open in Monday and Tuesday from 10 am to 9 pm.
|
10 am refers to opening_time = '10AM'; 9 pm refers to closing_time = '9PM'; 'Monday' and 'Tuesday' are both day_of_week; difference number of business = Subtract(Count(business_id(day_of_week = 'Monday')), Count(business_id(day_of_week = 'Tuesday')))
|
SELECT SUM(CASE WHEN T3.day_of_week = 'Monday' THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.day_of_week = 'Tuesday' THEN 1 ELSE 0 END) AS DIFF FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '10AM' AND T2.closing_time = '9PM'
| 5,817 |
moderate
|
legislator
|
State all the Facebook ID for current legislators under the democrat party.
|
SELECT T2.facebook_id FROM `current-terms` AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide = T2.bioguide WHERE T1.party = 'Democrat' GROUP BY T2.facebook_id
| 5,818 |
simple
|
|
talkingdata
|
List down the labels' IDs and categories of the app ID "5758400314709850000".
|
SELECT T1.label_id, T2.category FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T1.app_id = 5758400314709850000
| 5,819 |
simple
|
|
computer_student
|
Please list the levels of the all courses taught by teacher no.79.
|
levels of the all courses refers to courseLevel; teacher no.79 refers to taughtBy.p_id = 79
|
SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 79
| 5,820 |
simple
|
beer_factory
|
How many female customers permit the company to send regular emails to them?
|
female refers to Gender = 'F'; customer permits the company to send regular emails to them refers to SubscribedToEmailList = 'TRUE';
|
SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE'
| 5,821 |
simple
|
shakespeare
|
Calculate average scene per act in Antony and Cleopatra.
|
Antony and Cleopatra refers to Title = 'Antony and Cleopatra'; average scene per act = divide(sum(Scene), count(act))
|
SELECT CAST(SUM(T2.Scene) AS REAL) / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Antony and Cleopatra'
| 5,822 |
simple
|
movie_3
|
What is the first name of the customers whose address is in the postal code that begins with 76?
|
postal code that begins with 76 refers to postal_code like '76%'
|
SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'
| 5,823 |
simple
|
soccer_2016
|
What is the name of the team that won the first ever match?
|
name of the team refers to Team_Name; won the first ever match refers to Match_Winner where max(Match_Date)
|
SELECT T1.Team_Name FROM team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Season_Id = 1 ORDER BY T2.Match_Date LIMIT 1
| 5,824 |
simple
|
works_cycles
|
What is the first name of the male employee who has a western name style?
|
western name style refers to NameStyle = 0; Male refers to Gender = 'M';
|
SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.Gender = 'M'
| 5,825 |
simple
|
authors
|
List the names of all authors affiliated with Birkbeck University of London.
|
affiliated with Birkbeck University of London refers to Affiliation = 'Birkbeck University of London'
|
SELECT Name FROM Author WHERE Affiliation = 'Birkbeck University of London'
| 5,826 |
simple
|
video_games
|
State the name of the publisher with the most games.
|
name of publisher refers to publisher_name; the most games refers to max(game_id)
|
SELECT T.publisher_name FROM ( SELECT T2.publisher_name, COUNT(DISTINCT T1.game_id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id GROUP BY T2.publisher_name ORDER BY COUNT(DISTINCT T1.game_id) DESC LIMIT 1 ) t
| 5,827 |
moderate
|
food_inspection
|
How many eateries had low risk for violation with unpermitted food facility description?
|
eateries represent business; low risk for violation refers to risk_category = 'Low Risk';
|
SELECT COUNT(DISTINCT business_id) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Unpermitted food facility'
| 5,828 |
simple
|
ice_hockey_draft
|
What is the percentage of Russian players who have a height of under 200 inch?
|
percentage = MULTIPLY(DIVIDE(SUM(nation = 'Russia' WHERE height_in_cm < 200), COUNT(ELITEID)), 100); Russian refers to nation = 'Russia'; players refers to PlayerName; height of under 200 inch refers to height_in_cm < 200;
|
SELECT CAST(COUNT(CASE WHEN T1.height_in_cm < 200 AND T2.nation = 'Russia' THEN T2.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height
| 5,829 |
moderate
|
cs_semester
|
For the professor who is working with Harrietta Lydford, how is his popularity?
|
research assistant refers to the student who serves for research where the abbreviation is RA; higher popularity means more popular; prof_id refers to professor’s ID;
|
SELECT T1.popularity FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Harrietta' AND T3.l_name = 'Lydford'
| 5,830 |
simple
|
world_development_indicators
|
Among the low income countries, which country has the lowest fertility rate?
|
fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'; lowest refers to MIN(Value); IncomeGroup = 'Low income';
|
SELECT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' ORDER BY T2.Value LIMIT 1
| 5,831 |
moderate
|
university
|
List the ranking criteria under the Shanghai Ranking system.
|
Shanghai Ranking system refers to system_name = 'Shanghai Ranking'; ranking criteria refers to criteria_name
|
SELECT T2.criteria_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T1.system_name = 'Shanghai Ranking'
| 5,832 |
simple
|
shakespeare
|
How many scenes are there in King John?
|
King John refers to Title = 'King John'
|
SELECT COUNT(T2.Scene) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'King John'
| 5,833 |
simple
|
computer_student
|
List the advisor IDs for students with eighth year of program and position status in faculty of those professors.
|
advisor IDs refers to p_id_dummy and person.p_id where professor = 1; eighth year of program refers to yearsInprogram = 'Year_8'; position status in faculty of those professors refers to hasPosition
|
SELECT T1.p_id_dummy, T2.hasPosition FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_8'
| 5,834 |
simple
|
codebase_comments
|
Among the repositories whose number of stars received are between 6,000 to 9,000, which repository has the highest number of solution paths and many of those solution paths needs to be compiled if user wants to implement it?
|
Stars between 6,000 to 9,000; highest number of solution paths refers to max(count(Path)); needs to be compiled if user wants to implement it refers to WasCompiled = 0;
|
SELECT T2.RepoId, COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars BETWEEN 6000 AND 9000 AND T2.WasCompiled = 0 GROUP BY T2.RepoId ORDER BY COUNT(T2.RepoId) DESC LIMIT 1
| 5,835 |
challenging
|
social_media
|
Which country's tweets collected the most likes?
|
country collected the most likes refers to Country where Max(Sum(Likes))
|
SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Likes) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID GROUP BY T2.Country ) T ORDER BY T.num DESC LIMIT 1
| 5,836 |
simple
|
regional_sales
|
Which region is Joshua Bennet located in?
|
"Joshua Bennett" is the name of Sales Team
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN `Sales Team` = 'Joshua Bennett' THEN Region ELSE NULL END AS T FROM `Sales Team` ) WHERE T IS NOT NULL
| 5,837 |
simple
|
genes
|
Among the pairs of genes that are not from the class of motorproteins, how many of them are negatively correlated?
|
If Expression_Corr < 0, it means the negatively correlated
|
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Class = 'Motorproteins'
| 5,838 |
simple
|
works_cycles
|
What is the profit on net of the products that have exactly 200 maximum order quantity? Indicate the name of the vendors to which these products were purchased from.
|
maximum orders refers to MaxOrderQty; MaxOrderQty = 200; profit on net = SUBTRACT(LastReceiptCost, StandardPrice);
|
SELECT T1.LastReceiptCost - T1.StandardPrice, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty = 200
| 5,839 |
moderate
|
talkingdata
|
What is the age of the oldest male user of the app?
|
oldest user refers to MAX(age); male refers to gender = 'M';
|
SELECT MAX(age) FROM gender_age WHERE gender = 'M'
| 5,840 |
simple
|
soccer_2016
|
Compute the run rate at the end of 16 overs of the match ID 335999. Please include the name of the "Man of_the Match".
|
end of 16 overs refers to count(Toss_Name = 'field' ) = 16; run rate = divide(count(Runs_Scored) when Toss_Name = 'bat', sum(Over_Id)when Toss_Name = 'field'); name refers to Player_Name
|
SELECT CAST(COUNT(CASE WHEN T1.Toss_Name = 'bat' THEN T3.Runs_Scored ELSE NULL END) AS REAL) / SUM(CASE WHEN T1.Toss_Name = 'field' THEN 1 ELSE 0 END) FROM Toss_Decision AS T1 INNER JOIN Match AS T2 ON T1.Toss_Id = T2.Toss_Decide INNER JOIN Batsman_Scored AS T3 ON T2.Match_Id = T3.Match_Id WHERE T2.Match_Id = 335987 AND T2.Match_Date = '2008-04-18' GROUP BY T3.Over_Id HAVING COUNT(T1.Toss_Name = 'field') = 16
| 5,841 |
challenging
|
retail_world
|
How many customers are there in the country with the highest number of customers?
|
highest number refers to max(count(CustomerID))
|
SELECT COUNT(CustomerID) FROM Customers GROUP BY Country ORDER BY COUNT(CustomerID) DESC LIMIT 1
| 5,842 |
simple
|
language_corpus
|
Please list the title of the pages on which the word "grec" occurred for over 20 times.
|
occurred for over 20 times refers to occurrences > 20;
|
SELECT T3.title FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec' AND T2.occurrences > 20
| 5,843 |
simple
|
sales_in_weather
|
How many days did the show fell more than 5 inches?
|
snow fell more than 5 inches refers to snowfall > 5
|
SELECT COUNT(DISTINCT `date`) FROM weather WHERE snowfall > 5
| 5,844 |
simple
|
retail_world
|
What are the names of Robert King's territories?
|
Robert King is a full name of an employee where LastName = 'King' AND FirstName = 'Robert'; names of territories refer to TerritoryDescription;
|
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.LastName = 'King' AND T1.FirstName = 'Robert'
| 5,845 |
simple
|
authors
|
What is the homepage URL for the journal that published the most papers?
|
published the most papers refer to MAX(JournalId); homepage URL refers to HomePage
|
SELECT T2.HomePage FROM Paper AS T1 INNER JOIN Journal AS T2 ON T1.JournalId = T2.Id GROUP BY T1.JournalId ORDER BY COUNT(T1.JournalId) DESC LIMIT 1
| 5,846 |
simple
|
food_inspection_2
|
What is the inspection result for inspection done by Thomas Langley?
|
inspection result refers to results
|
SELECT DISTINCT T2.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Thomas' AND T1.last_name = 'Langley'
| 5,847 |
simple
|
image_and_language
|
How many images include the "wood" objects?
|
images refer to IMG_ID; "wood" objects refer to OBJ_CLASS = 'wood';
|
SELECT COUNT(DISTINCT T1.IMG_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'wood'
| 5,848 |
simple
|
retail_world
|
State the name of employee that manages the order from Victuailles en stock?
|
name of employee refers to FirstName; from Victuailles en stock refers to CompanyName = 'Victuailles en stock'
|
SELECT DISTINCT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T3.CompanyName = 'Victuailles en stock'
| 5,849 |
simple
|
public_review_platform
|
Under the category name of "Coffee & Tea", mention any 5 business ID , their state and city.
|
SELECT T2.business_id, T3.state, T3.city FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Coffee & Tea' LIMIT 5
| 5,850 |
simple
|
|
movies_4
|
Write down five rumoured movie titles within the genre of Drama.
|
rumoured movie refers to movie_status = 'rumoured'; genre of Drama refers to genre_name = 'Drama'
|
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.movie_status = 'Rumored' AND T3.genre_name = 'Drama' LIMIT 5
| 5,851 |
moderate
|
talkingdata
|
Calculate the percentage of male users among all device users.
|
percentage = DVIDE(SUM(gender = 'M'), COUNT(device_id)); male refers to gender = 'M';
|
SELECT SUM(IIF(gender = 'M', 1, 0)) / COUNT(device_id) AS per FROM gender_age
| 5,852 |
simple
|
hockey
|
Among the teams that played in 1922's Stanley Cup finals, how many of them had over 20 points in that year?
|
how many teams refer to COUNT(tmID); over 20 points refer to Pts>20; year = 1922;
|
SELECT COUNT(T1.tmID) FROM TeamsSC AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = '1922' AND T2.Pts > 20
| 5,853 |
simple
|
soccer_2016
|
Provide match ID which had the extra type of penalty.
|
extra type of penalty refers to Extra_Name = 'penalty';
|
SELECT T1.Match_Id FROM Extra_Runs AS T1 INNER JOIN Extra_Type AS T2 ON T1.Extra_Type_Id = T2.Extra_Id WHERE T2.Extra_Name = 'penalty'
| 5,854 |
simple
|
professional_basketball
|
Among the players from the NBL league, how many of them were born in Spencer?
|
"NBL" is the lgID; 'Spencer' is the birthCity
|
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Spencer' AND T2.lgID = 'NBL'
| 5,855 |
simple
|
human_resources
|
What is the required education for the position of regional manager?
|
required education refers to educationrequired; position of regional manager refers to positiontitle = 'Regional Manager'
|
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager'
| 5,856 |
simple
|
beer_factory
|
Between Sac State Union and Sac State American River Courtyard, which location sold the most Dog n Suds root beer?
|
Between Sac State Union and Sac State American River Courtyard refers to LocationName IN('Sac State American River Courtyard', 'Sac State Union'); Dog n Suds refers to BrandName = 'Dog n Suds'; sold the most root beer refers to MAX(COUNT(BrandID));
|
SELECT T3.LocationName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Dog n Suds' AND T3.LocationName IN ('Sac State American River Courtyard', 'Sac State Union') GROUP BY T1.LocationID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
| 5,857 |
challenging
|
food_inspection
|
In businesses with an owner address 500 California St, 2nd Floor of Silicon Valley, list the type of inspection of the business with the highest score.
|
the highest score MAX(score); Silicon Valley is located in 'SAN FRANCISCO';
|
SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_address = '500 California St, 2nd Floor' AND T2.owner_city = 'SAN FRANCISCO' ORDER BY T1.score DESC LIMIT 1
| 5,858 |
moderate
|
works_cycles
|
Please list the phone numbers of all the store contacts.
|
store contact refers to PersonType = 'SC';
|
SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
| 5,859 |
simple
|
public_review_platform
|
Among the active businesses located at Mesa, AZ, list the category and attributes of business with a low review count.
|
active business refers to active = 'true': 'Mesa' is the name of city; 'AZ' is the state; low review count refers to review_count = 'Low'; category refers to category_name
|
SELECT T3.category_name FROM Business 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 WHERE T1.review_count = 'Low' AND T1.city = 'Mesa' AND T1.active = 'true' AND T1.state = 'AZ'
| 5,860 |
moderate
|
food_inspection_2
|
State the name of dbas with verified quality.
|
name of dba refers to dba_name; with verified quality refers to results = 'Pass' or results = 'Pass w/Conditions'
|
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results LIKE '%Pass%'
| 5,861 |
simple
|
video_games
|
What are the years that "WiiU" got a new game?
|
year refers to release_year; "WiiU" refers to platform_name = 'WiiU'
|
SELECT T2.release_year FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id WHERE T1.platform_name = 'WiiU' ORDER BY T2.release_year DESC LIMIT 1
| 5,862 |
simple
|
sales
|
Calculate the quantity percentage of the gift products in the total trading quantity.
|
percentage = MULTIPLY(DIVIDE(SUM(Quantity WHERE Price = 0), SUM(Quantity)), 1.0); gift products refers to Price = 0;
|
SELECT CAST(SUM(IIF(T1.Price = 0, T2.Quantity, 0)) AS REAL) * 100 / SUM(T2.Quantity)FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID
| 5,863 |
moderate
|
synthea
|
List out the start date of the care plan of alive patients.
|
start of the care plan refers to careplans.START; alive patients refers to deathdate is null;
|
SELECT DISTINCT T1.START FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.deathdate IS NULL
| 5,864 |
simple
|
restaurant
|
Which country has the most restaurants with Italian food?
|
Italian food refers to food_type = 'Italian'
|
SELECT T2.county FROM generalinfo AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.food_type = 'Italian' GROUP BY T2.county ORDER BY COUNT(T1.id_restaurant) DESC LIMIT 1
| 5,865 |
simple
|
image_and_language
|
Tell the attribute of the weeds in image no.2377988.
|
attribute of the weeds refers to OBJ_CLASS = 'weeds'; image no.2377988 refers to IMG_ID = 2377988
|
SELECT T2.ATT_CLASS FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T4.OBJ_CLASS = 'weeds' AND T1.IMG_ID = 2377988
| 5,866 |
moderate
|
works_cycles
|
Lists all companies by BusinessEntityID that increased their current year sales by more than 60% over last year's sales and have a bonus greater than 3,000.
|
increased their current year sales by more than 60% refers to
DIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6
|
SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000
| 5,867 |
simple
|
public_review_platform
|
Which businesses with the category name Accessories have opening hours before 7AM?
|
opening hours before 7AM refer to opening_time < '7AM'; businesses refer to business_id;
|
SELECT T1.business_id FROM Business_Hours 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 WHERE T3.category_name = 'Accessories' AND SUBSTR(T1.opening_time, -4, 2) * 1 < 7 AND T1.opening_time LIKE '%AM'
| 5,868 |
moderate
|
shooting
|
What percentage of deaths were caused by rifles?
|
rifle refers to subject_weapon = 'rifles'; death refers to subject_statuses = 'Deceased'; percentage = divide(count(incidents where subject_weapon = 'rifles'), count(incidents)) where subject_statuses = 'Deceased' * 100%
|
SELECT CAST(SUM(subject_statuses = 'Deceased') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Rifle'
| 5,869 |
simple
|
books
|
How many books were published by Brava in 2006?
|
"Brava" is the publisher_name; in 2006 refers to SUBSTR(publication_date, 1, 4) = '2006'
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Brava' AND STRFTIME('%Y', T1.publication_date) = '2006'
| 5,870 |
simple
|
movie_platform
|
How many movies directed by Francis Ford Coppola have a popularity of more than 1,000? Indicate what is the highest amount of likes that each critic per movie has received, if there's any.
|
Francis Ford Coppola refers to director_name; popularity of more than 1,000 refers to movie_popularity >1000;highest amount of likes that each critic per movie has received refers to MAX(critic_likes)
|
SELECT COUNT(T2.movie_title), T1.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Francis Ford Coppola' AND T2.movie_popularity > 1000
| 5,871 |
moderate
|
ice_hockey_draft
|
Which team has the most Swedish?
|
Swedish refers to nation = 'Sweden'; team with the most Swedish refers to MAX(TEAM WHERE nation = 'Sweden');
|
SELECT T.TEAM FROM ( SELECT T2.TEAM, COUNT(DISTINCT T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.nation = 'Sweden' GROUP BY T2.TEAM ORDER BY COUNT(DISTINCT T1.ELITEID) DESC LIMIT 1 ) AS T
| 5,872 |
simple
|
movie_3
|
How many films rented to the customer RUTH MARTINEZ were returned in August, 2005?
|
returned in August, 2005 refers to year(return_date) = 2005 and month (return_date) = 8
|
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' AND STRFTIME('%m',T2.return_date) = '8' AND STRFTIME('%Y', T2.return_date) = '2005'
| 5,873 |
moderate
|
movie_3
|
How many films are there under the category of "Horror"?
|
"Horror" is the name of category
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'
| 5,874 |
simple
|
simpson_episodes
|
What is the average number of stars assigned to The simpson 20s: S20-E12? What is the said episode all about?
|
average number of stars refers to AVG(stars); simpson 20s: S20-E12 refers to episode_id = 'S20-E12'; episode all about refers to summary
|
SELECT AVG(T2.stars), T1.summary FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.episode_id = 'S20-E12';
| 5,875 |
simple
|
university
|
Calculate number of male students in Emory University in 2011.
|
in 2011 refers to year 2011; number of male students refers to SUBTRACT(num_students, DIVIDE(MULTIPLY(num_students, pct_male_students), 100)); in Emory University refers to university_name = 'Emory University'
|
SELECT CAST((T1.num_students - (T1.num_students * T1.pct_female_students)) AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Emory University' AND T1.year = 2011
| 5,876 |
simple
|
movie_platform
|
When did the creator of the list "250 Favourite Films" last updated a movie list?
|
250 Favourite Films refers to list_title; last update refers to list_update_date_utc;
|
SELECT T2.list_update_date_utc FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.list_title = '250 Favourite Films' ORDER BY T2.list_update_date_utc DESC LIMIT 1
| 5,877 |
moderate
|
computer_student
|
Which professor teaches the highest number of professional or master/graduate courses?
|
professor refers to taughtBy.p_id; highest number of professional or master/graduate courses refers to max(count(taughtBy.course_id)) where courseLevel = 'Level_500'
|
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_500' GROUP BY T2.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
| 5,878 |
simple
|
authors
|
List the title and author's name of papers published in the 2007 Neoplasia journal.
|
published in the 2007 refers to Year = 2007; Neoplasia journal refers to FullName = 'Neoplasia'
|
SELECT T1.Title, T2.Name FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId INNER JOIN Journal AS T3 ON T1.JournalId = T3.Id WHERE T3.FullName = 'Neoplasia' AND T1.Year = 2007
| 5,879 |
moderate
|
bike_share_1
|
List down the trips in which their start and end station are similar. Give me their trip IDs and location coordinates.
|
start and end station are similar refers to start_station_name = end_station_name; latitude and longitude coordinates can be used to indicate a location;
|
SELECT T1.id, T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = T1.end_station_name
| 5,880 |
simple
|
movie_3
|
Calculate customers' total payment amount in August, 2005.
|
in August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount)
|
SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'
| 5,881 |
simple
|
student_loan
|
What is the school and organization enrolled by student211?
|
organization refers to organ; student211 is a name of student;
|
SELECT T2.school, T1.organ FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T1.name = 'student211'
| 5,882 |
simple
|
video_games
|
Calculate the total sales made by the games released in 2000.
|
total sales = SUM(num_sales); released in 2000 refers to release_year = 2000;
|
SELECT SUM(T1.num_sales) FROM region_sales AS T1 INNER JOIN game_platform AS T2 ON T1.game_platform_id = T2.id WHERE T2.release_year = 2000
| 5,883 |
simple
|
regional_sales
|
In the Northeast region, what is the average household income for each city located in the state with the highest number of stores?
|
average household income = Divide (Sum(Household Income), Count(City Name)); highest number of store refers to Max(Count(StoreID))
|
SELECT AVG(T2.`Household Income`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast' GROUP BY T2.State ORDER BY COUNT(T2.StoreID) DESC LIMIT 1
| 5,884 |
moderate
|
food_inspection_2
|
Among the employees that receive a salary between $75000 to $85000, what is the difference between the number of employees which undergone an inspection that fined 100 and 500?
|
salary between $75000 and $85000 refers to 75000 < = salary < = 80000; difference = subtract(count(inspection_id where fine = 100), count(inspection_id where fine = 500)) where 75000 < = salary < = 80000
|
SELECT SUM(CASE WHEN T3.fine = 100 THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.fine = 500 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.salary BETWEEN 75000 AND 80000
| 5,885 |
challenging
|
hockey
|
Which position has won the most awards and who is the most recent player that was awarded with an award in that position? Indicate the name of the award and the full name of the player.
|
position has won the most awards refers to pos(max(count(award))); most recent player refers to playerID(pos(max(count(award)))& max(year)); full name = nameGiven + lastName
|
SELECT T1.pos, T2.award, T1.nameGiven, T1.lastName FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T2.coachID = T1.coachID GROUP BY T1.pos, T2.award, T1.nameGiven, T1.lastName ORDER BY COUNT(T2.award) LIMIT 1
| 5,886 |
challenging
|
shakespeare
|
How many number of paragraphs are there in chapter ID 18881?
|
number of paragraphs refers to ParagraphNum
|
SELECT COUNT(ParagraphNum) FROM paragraphs WHERE chapter_id = 18881
| 5,887 |
simple
|
retail_world
|
What is the total production of the products from the supplier “Escargots Nouveaux”?
|
total production of the products = add(units in stock , units on order); supplier “Escargots Nouveaux” refers to CompanyName = 'Escargots Nouveaux'
|
SELECT SUM(T1.UnitsInStock + T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Escargots Nouveaux'
| 5,888 |
simple
|
european_football_1
|
Of all the divisions in the world, what percentage of them belong to England?
|
DIVIDE(COUNT(division where country = 'England'), COUNT(division)) as percentage;
|
SELECT CAST(COUNT(CASE WHEN country = 'England' THEN division ELSE NULL END) AS REAL) * 100 / COUNT(division) FROM divisions
| 5,889 |
simple
|
books
|
How many books were ordered in the last month of the year 2020?
|
ordered in last month of the year 2020 refers to Substr(order_date, 1, 7) = '2020-12'
|
SELECT COUNT(*) FROM cust_order WHERE order_date LIKE '2020-12%'
| 5,890 |
simple
|
mondial_geo
|
Which city in Japan has the most people in the country?
|
most people refers to largest population
|
SELECT T2.Name FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' ORDER BY T2.Population DESC LIMIT 1
| 5,891 |
simple
|
public_review_platform
|
How many businesses operating in the shopping business have opening times before 8AM?
|
shopping business refers to category_name = 'Shopping'; opening time before 8AM refers to opening_time < '8AM';
|
SELECT COUNT(T3.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.opening_time < '8AM' AND T1.category_name LIKE 'Shopping'
| 5,892 |
moderate
|
books
|
In books authored by Abraham Lincoln, what is the percentage of the books published in 1992?
|
"Abraham Lincoln" is the author_name; published in 1992 refers to publication_date LIKE '1992%'; percentage = Divide (Sum(publication_date LIKE '1992%'), Count(publication_date)) * 100
|
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.publication_date) = '1992' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Abraham Lincoln'
| 5,893 |
challenging
|
image_and_language
|
How many objects are there in the attribute class id with the highest number of objects?
|
objects refers to OBJ_SAMPLE_ID; attribute class id with the highest number of objects refers to max(COUNT(ATT_CLASS_ID))
|
SELECT COUNT(ATT_CLASS_ID) FROM IMG_OBJ_att GROUP BY IMG_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1
| 5,894 |
simple
|
retail_complains
|
What is the name of the state that the client with the email "[email protected]" lives in?
|
SELECT T3.state FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN client AS T3 ON T2.district_id = T3.district_id WHERE T3.email = '[email protected]'
| 5,895 |
simple
|
|
professional_basketball
|
Which non-playoffs team had the most points in the regular season in the year 1998?
|
non-playoff refers to PostGP = 0; in the year 1998 refers to year = 1998; the most points refers to max(o_pts)
|
SELECT T2.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 1998 AND T1.PostGP = 0 ORDER BY T1.points DESC LIMIT 1
| 5,896 |
moderate
|
public_review_platform
|
In users yelping since 2011 to 2013, how many of them have high count of fans?
|
In users yelping since 2011 to 2013 refers to user_yelping_since_year > = 2011 AND user_yelping_since_year < 2014
|
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2011 AND 2013 AND user_fans LIKE 'High'
| 5,897 |
simple
|
codebase_comments
|
How many percent more of the watchers for the repository of solution No.83855 than No.1502?
|
solution No. refers to Solution.Id; percentage = DIVIDE(MULTIPLY(SUBTRACT(SUM(Solution.Id = 83855), SUM(Solution.Id = 1502)), 100)), SUM(Soltution.Id = 1502);
|
SELECT CAST(SUM(CASE WHEN T2.Id = 83855 THEN T1.Watchers ELSE 0 END) - SUM(CASE WHEN T2.Id = 1502 THEN T1.Watchers ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 1502 THEN T1.Watchers ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId
| 5,898 |
challenging
|
app_store
|
What percentage of no comment reviews are from "Teen" content rating apps?
|
no comment refers to Translated_Review = 'nan'; percentage = DIVIDE((SUM(Content Rating = 'Teen')), COUNT(*));
|
SELECT CAST(COUNT(CASE WHEN T1.`Content Rating` = 'Teen' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Translated_Review = 'nan'
| 5,899 |
moderate
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.