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
|
List at least 5 users that has received less than 5 low compliments from
other users.
|
less than 5 low compliment refers to number_of_compliments < 5
|
SELECT user_id FROM Users_Compliments WHERE number_of_compliments LIKE 'Low' GROUP BY user_id ORDER BY COUNT(number_of_compliments) > 5 LIMIT 5
| 5,700
|
simple
|
book_publishing_company
|
Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores?
|
qty is abbreviation for quantity; sold more than average refers to qty > AVG(qty); california refers to state = 'CA"
|
SELECT T1.title FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T2.qty > ( SELECT CAST(SUM(qty) AS REAL) / COUNT(title_id) FROM sales ) AND T3.state = 'CA' ORDER BY T2.qty DESC LIMIT 5
| 5,701
|
challenging
|
legislator
|
How many legislators were born in 1736?
|
born in 1736 refers to birthday_bio like '1736%';
|
SELECT COUNT(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%'
| 5,702
|
simple
|
car_retails
|
Who is the sales representative that made the order which was sent to 25 Maiden Lane, Floor No. 4?
|
Sales representative is an employee;
|
SELECT T2.firstName, T2.lastName FROM customers AS T1 INNER JOIN employees AS T2 ON T1.salesRepEmployeeNumber = T2.employeeNumber WHERE T1.addressLine1 = '25 Maiden Lane' AND T1.addressLine2 = 'Floor No. 4'
| 5,703
|
simple
|
mental_health_survey
|
What is the oldest age of the users in 2014's survey?
|
what is your age? refer to QuestionText; 2014 refer to SurveyID; oldest age refers to MAX(AnswerText)
|
SELECT T2.AnswerText FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'What is your age?' AND T2.SurveyID = 2014 ORDER BY T2.AnswerText DESC LIMIT 1
| 5,704
|
simple
|
soccer_2016
|
Which teams did SC Ganguly join in season year 2008?
|
SC Ganguly refers to Player_Name = 'SC Ganguly'; in season year 2008 refers to Season_Year = 2008
|
SELECT T5.Team_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match INNER JOIN Player_Match AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Season AS T4 ON T2.Season_Id = T4.Season_Id INNER JOIN Team AS T5 ON T3.Team_Id = T5.Team_Id WHERE T4.Season_Year = 2008 AND T1.Player_Name = 'SC Ganguly' GROUP BY T5.Team_Name
| 5,705
|
simple
|
sales
|
What is the full name of employee who sold 1000 units?
|
full name of employee = FirstName, MiddleInitial, LastName; units refers to quantity; Quantity = 100
|
SELECT DISTINCT T2.FirstName, T2.MiddleInitial, T2.LastName FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE T1.Quantity = 1000
| 5,706
|
simple
|
simpson_episodes
|
List down the rating of episodes that were produced by Jason Bikowski.
|
produced by Jason Bikowski refers to person = 'Jason Bikowski'
|
SELECT T1.rating FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Jason Bikowski';
| 5,707
|
simple
|
public_review_platform
|
How many users received high compliment type in photo?
|
high compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1
|
SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_id = 1
| 5,708
|
simple
|
regional_sales
|
Among the products sold in Maricopa County, which was the least sold?
|
the least sold product refers to Product Name where MIN(Order Quantity);
|
SELECT T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.County = 'Maricopa County' ORDER BY T2.`Order Quantity` ASC LIMIT 1
| 5,709
|
moderate
|
sales
|
How many "Mountain-500 Black 42" were sold in total?
|
Mountain-500 Black 42' is name of product; sold in total = SUM(Quantity);
|
SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain-500 Black, 42'
| 5,710
|
simple
|
public_review_platform
|
How many "cute" type of compliments does user No. 57400 get?
|
type of compliments refers to compliment_type; user No. refers to user_id;
|
SELECT COUNT(T1.compliment_type) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type LIKE 'cute' AND T2.user_id = 57400
| 5,711
|
simple
|
talkingdata
|
How many of the apps belong in the "Equity Fund" category?
|
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T2.category = 'Equity Fund'
| 5,712
|
simple
|
|
student_loan
|
How many disabled male students joined an organization?
|
organization refers to organ; disabled male students refers to disabled.name who are IN male.name;
|
SELECT COUNT(T1.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name INNER JOIN enlist AS T3 ON T3.name = T2.name
| 5,713
|
simple
|
olympics
|
Which region is Yao Ming from?
|
region refers to region_name;
|
SELECT T1.region_name 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.full_name = 'Yao Ming'
| 5,714
|
simple
|
public_review_platform
|
Among businesses with "Wi-Fi" attribute, which businesses id are located at SC State?
|
"Wi-Fi" attribute refers to attribute_name = 'Wi-Fi' AND attribute_value = 'true'
|
SELECT T3.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'Wi-Fi' AND T2.attribute_value = 'true' AND T3.state = 'SC'
| 5,715
|
moderate
|
mondial_geo
|
Which country has the widest range of religious practices?
|
SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(DISTINCT T2.Name) DESC LIMIT 1
| 5,716
|
simple
|
|
retails
|
Among all the parts under the type "promo brushed steel", how many of them have a total available quantity from all suppliers of under 5000?
|
type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000
|
SELECT SUM(num) FROM ( SELECT COUNT(T3.s_name) AS num FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_type = 'PROMO BRUSHED STEEL' GROUP BY T2.ps_partkey HAVING SUM(T2.ps_availqty) < 5000 ) T
| 5,717
|
moderate
|
talkingdata
|
What percentage of women do not have applications installed on their mobile with respect to men?
|
percentage = MULTIPLY(DIVIDE(SUM(gender = 'F'), SUM(gender = 'M')), 1.0); women refers to gender = 'F'; not installed refers to is_installed = 0; men refers to gender = 'M';
|
SELECT SUM(IIF(T1.gender = 'F', 1, 0)) / SUM(IIF(T1.gender = 'M', 1, 0)) AS per FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id INNER JOIN app_events_relevant AS T3 ON T2.event_id = T3.event_id WHERE T3.is_installed = 0
| 5,718
|
challenging
|
books
|
What is the cheapest order price of the book "The Little House"?
|
"The Little House" is the title of book; cheapest order price refers to Min(price)
|
SELECT MIN(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Little House'
| 5,719
|
simple
|
food_inspection_2
|
Who is the employee that receives 82700 as their salary?
|
employee name refers to first_name, last_name; receives 82700 as salary refers to salary = 82700
|
SELECT first_name, last_name FROM employee WHERE salary = 82700
| 5,720
|
simple
|
retails
|
Among the items shipped in 1994 via truck, how many items were returned?
|
1994 refers to year(l_shipdate) = 1994; via truck refers to l_shipmode = 'TRUCK'; returned refers to l_returnflag = 'R'
|
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994' AND l_returnflag = 'R' AND l_shipmode = 'TRUCK'
| 5,721
|
simple
|
cs_semester
|
How many courses does the student with the highest GPA this semester take?
|
student with the highest GPA refers to student_id where MAX(gpa);
|
SELECT COUNT(course_id) FROM registration WHERE student_id IN ( SELECT student_id FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) )
| 5,722
|
simple
|
retails
|
Among all the customers in Germany, how many of them have an account balance of over 1000?
|
Germany is the name of the nation which refers to n_name = 'GERMANY'; account balance of over 1000 refers to c_acctbal > 1000;
|
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.c_acctbal > 1000
| 5,723
|
simple
|
disney
|
Among the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors.
|
DIVIDE(COUNT(movie_title where genre = 'Comedy'), COUNT(movie_title)) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) between '1991' and '2000';
|
SELECT CAST(COUNT(CASE WHEN T1.genre = 'Comedy' THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title), group_concat(T1.movie_title), group_concat(T2.director) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '1991' AND '2000'
| 5,724
|
challenging
|
hockey
|
Among the coaches who have received an award after the year 1940, how many of them have already died?
|
after the year 1940 refers to year>1940; have already died refers to deathYear IS NOT NULL
|
SELECT COUNT(T1.coachID) FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.deathYear IS NOT NULL AND T2.year > 1940
| 5,725
|
simple
|
public_review_platform
|
Among all the users who received the high number of compliments, what percent received the 'cute' type of compliment.
|
high number of compliments refers to number_of_compliments = 'High'; percentage = divide(count(user_id where compliment_type = 'cute'), count(user_id))*100%
|
SELECT CAST(SUM(CASE WHEN T1.compliment_type = 'cute' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T2.number_of_compliments = 'High'
| 5,726
|
challenging
|
menu
|
How many dishes are there in total in the menus with the name "Waldorf Astoria"?
|
FALSE;
|
SELECT SUM(CASE WHEN T3.name = 'Waldorf Astoria' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id
| 5,727
|
simple
|
public_review_platform
|
How many stars on average does user no.3 give to Yelp_Business in Arizona?
|
user no.3 refers to user_id = 3; in Arizona refers to state = 'AZ'; stars on average = avg(review_stars(user_id = 3))
|
SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state LIKE 'AZ' AND T2.user_id = 3
| 5,728
|
simple
|
chicago_crime
|
What is the average number of incidents per month in 2018 in the ward with the most population?
|
in 2018 refers to date like '%2018%'; ward with most population refers to Max(Population); average number of incident per month refers to Divide(Count(ward_no), 12)
|
SELECT COUNT(T1.ward_no) / 12 AS average FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.date LIKE '%2018%' AND T1.Population = ( SELECT MAX(T1.Population) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.date LIKE '%2018%' )
| 5,729
|
moderate
|
synthea
|
Give the social security number of the female Irish patient allergic to grass pollen.
|
social security number refers to ssn; female refers to gender = 'F'; Irish refers to ethnicity = 'irish'; allergic to grass pollen refers to allergies where DESCRIPTION = 'Allergy to grass pollen';
|
SELECT T2.ssn FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to grass pollen' AND T2.ethnicity = 'irish' AND T2.gender = 'F'
| 5,730
|
moderate
|
student_loan
|
How many disabled students have never been absent from school?
|
never been absent from school refers to month = 0
|
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 0
| 5,731
|
simple
|
works_cycles
|
Is the phone number "114-555-0100" a work number or a home number?
|
SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.PhoneNumber = '114-555-0100'
| 5,732
|
simple
|
|
movie
|
Show the No.3 character name in the credit list of the movie "G.I. Joe: The Rise of Cobra".
|
No.3 character refers to creditOrder = '3'; movie "G.I. Joe: The Rise of Cobra" refers to Title = 'G.I. Joe: The Rise of Cobra'
|
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'G.I. Joe: The Rise of Cobra' AND T2.creditOrder = '3'
| 5,733
|
moderate
|
image_and_language
|
State the object class of sample no.10 of image no.2320341.
|
object class refers to OBJ_CLASS; sample no.10 refers to OBJ_SAMPLE_ID = 10; image no.2320341 refers to IMG_ID = 2320341
|
SELECT T1.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2320341 AND T2.OBJ_SAMPLE_ID = 10
| 5,734
|
simple
|
video_games
|
What are the names of the games published by American Softworks?
|
names of the games refers to game_name; American Softworks refers to publisher_name = 'American Softworks';
|
SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = 'American Softworks'
| 5,735
|
simple
|
donor
|
For project titled 'Toot Your Flute!', what is the main subject of the project materials intended for? Name the other projects with the similar focus.
|
main subject refers to primary_focus_subject
|
SELECT T2.primary_focus_subject FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.title = 'Toot Your Flute!'
| 5,736
|
simple
|
simpson_episodes
|
List the episode ID and title of episode where casting was credited to Bonita Pietila.
|
was credited refers to credited = 'true'; to Bonita Pietila refers to person = 'Bonita Pietila'
|
SELECT T1.episode_id, T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Bonita Pietila' AND T2.role = 'casting';
| 5,737
|
moderate
|
world_development_indicators
|
In 1960, what is largest population for country with upper middle income?
|
in 1960 refers to year = '1960'; the largest population refers to max(value where IndicatorName = 'Population, total'); country with upper middle income refers to incomegroup = 'Upper middle income'
|
SELECT MAX(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Upper middle income' AND T2.Year = 1960 AND T2.IndicatorName = 'Population, total'
| 5,738
|
simple
|
world
|
Among the countries that have GNP greater than 1500, what is the percentage of the countries have English as its language?
|
GNP greater than 1500 refers to GNP > 1500 ; percentage = MULTIPLY(DIVIDE(SUM(Code WHERE GNP > 1500 AND Language = 'English'), COUNT(Code WHERE GNP > 1500)) 1.0); English as its language refers to Language = 'English';
|
SELECT CAST(SUM(IIF(T2.Language = 'English', 1, 0)) AS REAL) * 100 / COUNT(T1.Code) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.GNP > 1500
| 5,739
|
moderate
|
chicago_crime
|
More crimes happened in which community area in January, 2018, Woodlawn or Lincoln Square?
|
in January 2018 refers to date like '%1/2018%'; Woodlawn or Lincoln Square refers to community_area_name in ('Woodlawn', 'Lincoln Square'); number of crime refers to COUNT(report_no); the higher the report_no, the more crimes happened in the community;
|
SELECT T1.community_area_name FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.community_area_name IN ('Woodlawn', 'Lincoln Square') AND T2.date LIKE '%1/2018%' GROUP BY T1.community_area_name ORDER BY COUNT(T1.community_area_name) DESC LIMIT 1
| 5,740
|
moderate
|
books
|
How many books were written by author A.J. Ayer?
|
"A.J. Ayer" is the author_name;
|
SELECT COUNT(*) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id WHERE T2.author_name = 'A.J. Ayer'
| 5,741
|
simple
|
video_games
|
In 2004, what are the names of the platforms where Codemasters publish its games?
|
name of platform refers to platform_name; Codemasters refers to publisher_name = 'Codemasters'; in 2004 refers to release_year = 2004
|
SELECT T4.platform_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T3.release_year = 2004 AND T1.publisher_name = 'Codemasters'
| 5,742
|
simple
|
talkingdata
|
How many male users have a Galaxy Note 3?
|
male refers to gender = 'M'; Galaxy Note 3 refers to device_model = 'Galaxy Note 3';
|
SELECT COUNT(T1.device_id) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.device_model = 'Galaxy Note 3' AND T1.gender = 'M'
| 5,743
|
simple
|
language_corpus
|
How many times on page number 44 does the word "votives" appear?
|
How many times refers to occurrences; page number 44 refers to pid = 44;
|
SELECT T2.occurrences FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'votives' AND T2.pid = 44
| 5,744
|
simple
|
talkingdata
|
What is the percentage of users who experienced event number 6 who have the app installed but do not use the app?
|
percentage = MULTIPLY(DIVIDE(SUM(is_installed = 1 and is_active = 0), COUNT(app_id)), 1.0); event number refers to event_id = 6; installed refers to is_installed = 1; do not use refers to is_active = 0;
|
SELECT SUM(IIF(is_installed = 1 AND is_active = 0, 1, 0)) / COUNT(app_id) AS perrcent FROM app_events WHERE event_id = 6
| 5,745
|
simple
|
beer_factory
|
Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243?
|
in bottles refers to ContainerType = 'Bottle'; location 38.559615, -121.42243 refers to latitude = 38.559615 AND longitude = -121.42243;
|
SELECT COUNT(T4.BrandID) FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID INNER JOIN rootbeer AS T4 ON T1.RootBeerID = T4.RootBeerID WHERE T2.Latitude = 38.559615 AND T2.Longitude = -121.42243 AND T4.ContainerType = 'Bottle'
| 5,746
|
moderate
|
cookbook
|
What is the average vitamin C amount of all cakes?
|
average vitamin C refers to AVG(vitamin_c); all cakes refers to title LIKE '%cake%'
|
SELECT AVG(T1.vitamin_c) FROM Nutrition AS T1 INNER JOIN Recipe AS T2 ON T2.recipe_id = T1.recipe_id WHERE T2.title LIKE '%cake%'
| 5,747
|
simple
|
olympics
|
How many males from Belgium have participated in an Olympic Games?
|
males refer to gender = 'M'; Belgium refers to region_name = 'Belgium';
|
SELECT COUNT(T2.person_id) 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 T1.region_name = 'Belgium' AND T3.gender = 'M'
| 5,748
|
simple
|
music_tracker
|
Name all the release titles of the "ep's" under the alternative tag.
|
release titles of the "ep's" refer to groupName where releaseType = 'ep';
|
SELECT T1.groupName FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag LIKE 'alternative' AND T1.releaseType = 'ep'
| 5,749
|
simple
|
ice_hockey_draft
|
Which team does Andreas Jamtin belong to?
|
FALSE;
|
SELECT DISTINCT T1.TEAM FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Andreas Jamtin'
| 5,750
|
simple
|
world_development_indicators
|
What is the description of the footnote on the series code AG.LND.FRST.K2 in 1990 for Aruba?
|
Year = 1990; Aruba is the name of country where ShortName = 'Aruba'
|
SELECT T2.Description FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Seriescode = 'AG.LND.FRST.K2' AND T2.Year = 'YR1990'
| 5,751
|
simple
|
student_loan
|
List out students that enrolled in occ school and enlisted in a fire department.
|
occ school refers to school = 'occ'; department refers to organ; organ = 'fire_department';
|
SELECT T1.name FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T2.school = 'occ' AND T1.organ = 'fire_department'
| 5,752
|
simple
|
beer_factory
|
Which brand of root beer has the lowest unit profit available to wholesalers? Indicate the ID of the customer that has the highest number of purchases of the said brand.
|
brand of root beer refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost)); ID of the customer refers to CustomerID; highest number of purchases refers to MAX(COUNT(CustomerID));
|
SELECT T3.BrandName, T2.CustomerID FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost, COUNT(T1.BrandID) DESC LIMIT 1
| 5,753
|
moderate
|
works_cycles
|
In 2007, which job position was hired the most?
|
Job position and job title are synonyms; job position that was hired the most refers to MAX(COUNT(JobTitle); HireDate BETWEEN '2007-1-1' AND '2007-12-31';
|
SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1
| 5,754
|
simple
|
public_review_platform
|
What is the closing and opening time of businesses located at Tempe with highest star rating?
|
located at Tempe refers to city = 'Tempe'; highest star rating refers to max(stars)
|
SELECT T2.closing_time, T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Tempe' ORDER BY T1.stars DESC LIMIT 1
| 5,755
|
simple
|
synthea
|
By how much did Elly Koss's weight increase from the observation in 2008 to the observation in 2009?
|
SUBTRACT((DATE like '2009%'), (DATE like '2008%')) where DESCRIPTION = 'Body Weight';
|
SELECT SUM(CASE WHEN strftime('%Y', T2.date) = '2009' THEN T2.VALUE END) - SUM(CASE WHEN strftime('%Y', T2.date) = '2008' THEN T2.VALUE END) AS increase , T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Height'
| 5,756
|
challenging
|
works_cycles
|
Which work order transaction number has the highest product quantity?
|
work order transaction refers to TransactionType = 'W';
|
SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1
| 5,757
|
simple
|
beer_factory
|
Among the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?
|
do not advertise on Twitter refers to twitter IS NULL; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
|
SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.Twitter IS NULL
| 5,758
|
moderate
|
mondial_geo
|
Where is the capital of country which has the largest percentage of Malay people?
|
Malay is one of country names
|
SELECT T1.Capital FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Malay' ORDER BY T2.Percentage DESC LIMIT 1
| 5,759
|
simple
|
talkingdata
|
Locate all events on devices of women under 30 years old.
|
locate = longitude, latitude; women refers to gender = 'F'; under 30 years old refers to age < 30;
|
SELECT T1.device_id FROM gender_age AS T1 INNER JOIN events_relevant AS T2 ON T1.device_id = T2.device_id WHERE T1.gender = 'F' AND T1.age < 30
| 5,760
|
simple
|
book_publishing_company
|
Please list the first names of the employees who work as Managing Editor.
|
Managing Editor is a job description which refers to job_desc
|
SELECT T1.fname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Managing Editor'
| 5,761
|
simple
|
retails
|
Name customers in India with account balances over $5000.
|
customer name refers to c_name; India refers to n_name = 'INDIA'; account balance over $5000 refers to c_acctbal > 5000
|
SELECT T1.c_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_acctbal > 5000 AND T2.n_name = 'INDIA'
| 5,762
|
simple
|
legislator
|
Give the Wikipedia IDs of historical legislators who are Readjuster Democrats.
|
Readjuster Democrats refers to party = 'Readjuster Democrat'
|
SELECT T2.wikipedia_id FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Readjuster Democrat'
| 5,763
|
simple
|
beer_factory
|
How many breweries are located in North America?
|
North America refers to country = 'United States'; North America is the name of continent where country = 'United States' is located;
|
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States'
| 5,764
|
simple
|
regional_sales
|
What is the percentage of total orders from stores in Orange County in 2018?
|
DIVIDE(COUNT(OrderNumber where County = 'Orange County' and SUBSTR(OrderDate, -2) = '18'), COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')) as percentage;
|
SELECT CAST(SUM(CASE WHEN T2.County = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/18'
| 5,765
|
moderate
|
disney
|
What is the most popular movie directed by Ron Clements?
|
Ron Clements refers to director = 'Ron Clements'; the most popular movie refers to movie_title where MAX(total_gross);
|
SELECT T2.name FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Ron Clements' ORDER BY CAST(REPLACE(SUBSTR(total_gross, 2), ',', '') AS int) DESC LIMIT 1
| 5,766
|
moderate
|
world
|
Calculate the percentage of the surface area of all countries that uses Chinese as one of their languages.
|
percentage = DIVIDE(MULTIPLY(SUM(SurfaceArea WHERE Language = 'Chinese'), SUM(SurfaceArea)), 1.0); Chinese as one of the languages refers to Language = 'Chinese';
|
SELECT CAST(SUM(IIF(T2.Language = 'Chinese', T1.SurfaceArea, 0)) AS REAL) * 100 / SUM(T1.SurfaceArea) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode
| 5,767
|
moderate
|
retails
|
Which part has a bigger size, "pink powder drab lawn cyan" or "cornflower sky burlywood green beige"?
|
size refers to p_size; "pink powder drab lawn cyan" or "cornflower sky burlywood green beige" refers to p_name in ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige')
|
SELECT T.p_name FROM ( SELECT p_name, p_size FROM part WHERE p_name IN ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') ) AS T ORDER BY p_size DESC LIMIT 1
| 5,768
|
moderate
|
cookbook
|
How many calories from fat are there in the recipe "Raspberry Chiffon Pie"?
|
calories from fat refers to MULTIPLY(calories, pcnt_cal_fat)||'%; Raspberry Chiffon Pie refers to title
|
SELECT T2.calories * T2.pcnt_cal_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'
| 5,769
|
simple
|
regional_sales
|
Which sales team name has the least orders in 2019?
|
sale team names refer to Sales Team; the least orders in 2019 refer to MIN(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '19'));
|
SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) ASC LIMIT 1
| 5,770
|
moderate
|
music_tracker
|
From 1979 to 1982, what was the percentage of united.states albums out of total albums were released?
|
From 1979 to 1982 refers to groupYear between 1979 and 1982; United States refer to tag; albums refer to releaseType; DIVIDE(COUNT(releaseType = 'album' where tag = 'united.states' and groupYear between 1979 and 1982), COUNT(releaseType = 'album' where groupYear between 1979 and 1982)) as percentage;
|
SELECT CAST(SUM(CASE WHEN T2.tag LIKE 'united.states' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.releaseType) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupYear BETWEEN 1979 AND 1982 AND T1.releaseType LIKE 'album'
| 5,771
|
moderate
|
retails
|
In the parts supply by Supplier#000000654, list the top five parts with the most supply cost in descending order of supply cost.
|
Supplier#000000654 is the name of the supplier which refers to s_name; parts with the most supply cost refer to ps_partkey where MAX(ps_supplycost);
|
SELECT T2.ps_partkey FROM supplier AS T1 INNER JOIN partsupp AS T2 ON T1.s_suppkey = T2.ps_suppkey WHERE T1.s_name = 'Supplier#000000654' ORDER BY T2.ps_supplycost DESC LIMIT 5
| 5,772
|
simple
|
disney
|
List the names of the directors whose films grossed over $100 million.
|
films grossed over $100 million refer to movie_title where total_gross > 100000000;
|
SELECT DISTINCT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T1.movie_title = T3.movie_title WHERE CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) > 100000000
| 5,773
|
moderate
|
movie_3
|
What is the full name of the actor who has acted the most times in comedy films?
|
full name refers to first_name, last_name; 'comedy' is a name of a category;
|
SELECT T.first_name, T.last_name FROM ( SELECT T4.first_name, T4.last_name, COUNT(T2.actor_id) AS num FROM film_category AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN actor AS T4 ON T2.actor_id = T4.actor_id WHERE T3.name = 'Comedy' GROUP BY T4.first_name, T4.last_name ) AS T ORDER BY T.num DESC LIMIT 1
| 5,774
|
challenging
|
video_games
|
In games that can be played on Wii, what is the percentage of games released in 2007?
|
Wii refers to platform_name = 'Wii'; percentage = MULTIPLY(DIVIDE(SUM(release_year = 2007), COUNT(release_year)), 100.0); released in 2007 refers to release_year = 2007;
|
SELECT CAST(COUNT(CASE WHEN T2.release_year = 2007 THEN T3.game_id ELSE NULL END) AS REAL) * 100 / COUNT(T3.game_id) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN game_publisher AS T3 ON T2.game_publisher_id = T3.id WHERE T1.platform_name = 'Wii'
| 5,775
|
challenging
|
world_development_indicators
|
Please list the notes for Aruba on the indicators under the topic of Environment: Energy production & use.
|
note refers to Description; for Aruba refers to ShortName = 'Aruba'
|
SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.ShortName = 'Aruba' AND T3.Topic = 'Environment: Energy production & use'
| 5,776
|
moderate
|
european_football_1
|
How many draw games happened on 2018/8/7 for National League?
|
National League is the name of division; Date = '2018-08-07'; draw refers to FTR = 'D'; games refer to Div;
|
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'National League' AND T1.Date = '2018-08-07' AND T1.FTR = 'D'
| 5,777
|
simple
|
trains
|
Among the cars on a train that runs in the east direction, how many of them have a flat roof and a circle load shape?
|
flat roof refers to roof = 'flat'; load_shape = 'circle'
|
SELECT SUM(CASE WHEN T1.load_shape = 'circle' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east' AND T1.roof = 'flat'
| 5,778
|
moderate
|
world_development_indicators
|
What was the deposit interest rate in the Commonwealth of Australia in 1979 in percentage?
|
deposit interest rate refers to value where IndicatorName = 'Deposit interest rate (%)'; in the Commonwealth of Australia refers to LongName = 'Commonwealth of Australia'; in 1979 refers to Year = '1979'
|
SELECT T1.Value FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.LongName = 'Commonwealth of Australia' AND T1.IndicatorName = 'Deposit interest rate (%)' AND T1.Year = 1979
| 5,779
|
simple
|
movie_3
|
How many different clients have rented materials from Jon Stephens?
|
'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name;
|
SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
| 5,780
|
simple
|
food_inspection_2
|
Give the address of the schools that passed the inspection in March 2010.
|
school refers to facility_type = 'School'; pass refers to results = 'Pass'; in March 2010 refers to inspection_date like '2010-03%'
|
SELECT DISTINCT T1.address FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T2.inspection_date) = '2010-03' AND T2.results = 'Pass' AND T1.facility_type = 'School'
| 5,781
|
moderate
|
car_retails
|
Calculate the average amount of payments made by customers during the first half of 2004.
|
average amount of payments = DIVIDE(SUM(amount), COUNT(customerNumber); first half of 2014 refers to paymentDate > = '2004-01-01' AND paymentDate < '2004-07-01;
|
SELECT AVG(amount) FROM payments WHERE paymentDate BETWEEN '2004-01-01' AND '2004-06-30'
| 5,782
|
simple
|
public_review_platform
|
In how many businesses have customers had a bad or terrible experience?
|
stars = 2 means bad experience; stars = 1 means terrible experience; customers had a bad or terrible experience refers to stars = 2 OR stars = 1
|
SELECT COUNT(business_id) FROM Business WHERE stars IN (1, 2)
| 5,783
|
simple
|
legislator
|
What is the total number of legislators with "John" as their first name?
|
SELECT COUNT(*) FROM current WHERE first_name = 'John'
| 5,784
|
simple
|
|
law_episode
|
What is the full place of birth of Rene Chenevert Balcer?
|
full place of birth refers to birth_place, birth_region; Rene Chenevert Balcer refers to birth_name = 'Rene Chenevert Balcer'
|
SELECT birth_place, birth_region FROM Person WHERE birth_name = 'Rene Chenevert Balcer'
| 5,785
|
simple
|
talkingdata
|
What is the device model used by the most female users over 30?
|
female users refers to gender = 'F'; most female users refers to MAX(COUNT(gender = 'F')); over 30 refers to age > 30;
|
SELECT T.device_model FROM ( SELECT T2.device_model, COUNT(T2.device_model) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.age > 30 AND T1.gender = 'F' GROUP BY T2.device_model ) AS T ORDER BY T.num DESC LIMIT 1
| 5,786
|
moderate
|
college_completion
|
For the state which has the 113 2-year public schools, tell the number of graduated Asian students who seeks another type of degree or certificate at a 2-year institution in 2013.
|
schools_count = 113; 2-year refers to level = '2-year'; public refers to control = 'public'; Asian refers to race = 'A'; seeks another type of degree or certificate at a 2-year institution refers to cohort = '2y all'; in 2013 refers to year = 2013;
|
SELECT COUNT(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.level = '2-year' AND T2.control = 'Public' AND T2.gender = 'B' AND T2.race = 'A' AND T2.cohort = '2y all' AND T1.schools_count = 113
| 5,787
|
moderate
|
law_episode
|
How many people were not credited at the end of the "Admissions" episode?
|
not credited refers to credited = ''; the "Admissions" episode refers to title = 'Admissions'
|
SELECT COUNT(T2.person_id) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Admissions' AND T2.credited = 'false'
| 5,788
|
simple
|
works_cycles
|
Is there a work order where the planned cost is different from the actual cost?
|
planned cost is different from actual cost refers to ActualCost ! = PlannedCost;
|
SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting
| 5,789
|
simple
|
airline
|
How many flights from American Airlines were cancelled due to a type A cancellation code?
|
American Airlines refers to Description = 'American Airlines Inc.: AA'; cancelled refers to Cancelled = 1; cancelled due to type A cancellation code refers to CANCELLATION_CODE = 'A';
|
SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.CANCELLATION_CODE = 'A' AND T2.Description = 'American Airlines Inc.: AA' AND T1.CANCELLED = 1
| 5,790
|
simple
|
restaurant
|
What is the full address of Albert's Café?
|
full address = street_num, street_name, city; Albert's Café refers to label = 'Albert's Café'
|
SELECT T2.street_num, T2.street_name, T1.city FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.label = 'Albert''s Café'
| 5,791
|
simple
|
movies_4
|
Provide the average revenue of all the French movies.
|
French movies refers to country_name = 'France'; average revenue = AVG(revenue)
|
SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France'
| 5,792
|
simple
|
mondial_geo
|
Which country has the least organization membership?
|
SELECT country FROM organization WHERE country IN ( SELECT Code FROM country ) GROUP BY country ORDER BY COUNT(NAME) LIMIT 1
| 5,793
|
simple
|
|
disney
|
How many restricted horror movies were released between 1/1/1990 to 12/31/2015?
|
Restricted refers to MPAA_rating = 'R'; horror refers to genre = 'Horror'; released between 1/1/1990 to 12/31/2015 refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2015);
|
SELECT COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'R' AND genre = 'Horror' AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2015
| 5,794
|
moderate
|
european_football_1
|
How many Eredivisie teams have played in 2008?
|
Eredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;
|
SELECT COUNT(DISTINCT T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 2008
| 5,795
|
simple
|
public_review_platform
|
Write down the any five of ID and name of category that starts with alphabet "P".
|
category that starts with alphabet "P" refers to category_name like 'P%';
|
SELECT category_id, category_name FROM Categories WHERE category_name LIKE 'P%' LIMIT 5
| 5,796
|
simple
|
mondial_geo
|
List all the seas with which the deepest sea merges.
|
SELECT T2.Sea2 FROM sea AS T1 INNER JOIN mergesWith AS T2 ON T1.Name = T2.Sea1 WHERE T1.Name = ( SELECT Name FROM sea ORDER BY Depth DESC LIMIT 1 )
| 5,797
|
simple
|
|
public_review_platform
|
What kind of "wi-fi" does Yelp business No."10172" have?
|
kind of wi-fi refers to attribute_value where attribute_name = 'Wi-Fi'; business No. refers to business_id;
|
SELECT T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.business_id = 10172 AND T1.attribute_name LIKE 'wi-fi'
| 5,798
|
simple
|
superstore
|
How many orders purchased by Aaron Bergman have been delivered with the slowest shipping speed?
|
slowest shipping speed refers to "Ship Mode" = 'Standard Class'
|
SELECT COUNT(*) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aaron Bergman' AND T2.`Ship Mode` = 'Standard Class'
| 5,799
|
simple
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.