db_id stringclasses 69
values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringclasses 69
values |
|---|---|---|---|---|
talkingdata | What is the ID of the device used by the youngest user? | ID of the device refers to device_id; youngest user refers to MIN(age); | SELECT device_id FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age ) | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
world_development_indicators | What percentage of countries in South Asia have the Life expectancy at birth, female (years) greater than 50? | South Asia is the name of the region; IndicatorName = 'Life expectancy at birth, female (years)'; greater than 50 refers to Value>50; DIVIDE(COUNT(CountryCode where IndicatorName = 'Life expectancy at birth, female (years)'; Value>50; Region = 'South Asia'), COUNT(CountryCode where Region = 'South Asia')) as percentage... | SELECT CAST(SUM(CASE WHEN T2.value > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CountryCode) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Region = 'South Asia' AND T2.IndicatorName = 'Life expectancy at birth, female (years)' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
chicago_crime | What is the weekly average number of fraud incidents that were reported in January 2018? Provide the description of the location where the majority of fraud incidents occurred in the said month. | fraud incident refers to title = 'Fraud'; reported in January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; description of location refers to location_description; weekly average refers to Divide (Count(report_no), 4); majority of incidents occurred refers to Max(Count(location_description)) | SELECT CAST(COUNT(T1.fbi_code_no) AS REAL) / 4 FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
cookbook | List the ingredients in Tomato-Cucumber Relish. | Tomato-Cucumber Relish refers to title | SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Tomato-Cucumber Relish' | CREATE TABLE Ingredient
(
ingredient_id INTEGER
primary key,
category TEXT,
name TEXT,
plural TEXT
);
CREATE TABLE Recipe
(
recipe_id INTEGER
primary key,
title TEXT,
subtitle TEXT,
servings INTEGER,
yield_unit TEXT,
prep_min... |
public_review_platform | How many "cool" type compliments does user No. 41717 get? | "cool" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717 | SELECT COUNT(T2.number_of_compliments) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'cool' AND T2.user_id = 41717 | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
public_review_platform | Identify the user who has been yelping since 2004. Is he or she an Yelp Elite member? | has been yelping since 2004 refers to user_yelping_since_year = 2004 | SELECT DISTINCT T2.user_id FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
sales | List the first name of all the customers whose last name is Chen. | SELECT FirstName, LastName FROM Customers WHERE LastName = 'Chen' | CREATE TABLE Customers
(
CustomerID INTEGER not null
primary key,
FirstName TEXT not null,
MiddleInitial TEXT null,
LastName TEXT not null
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null
primary key,
FirstName TEXT not null,
MiddleIn... | |
synthea | How many male patients have been described as immune to quadrivalent HPV? | male refers to gender = 'M'; immune to quadrivalent HPV refers to immunizations.DESCRIPTION = 'HPV quadrivalent'; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'HPV quadrivalent' AND T1.gender = 'M' | CREATE TABLE all_prevalences
(
ITEM TEXT
primary key,
"POPULATION TYPE" TEXT,
OCCURRENCES INTEGER,
"POPULATION COUNT" INTEGER,
"PREVALENCE RATE" REAL,
"PREVALENCE PERCENTAGE" REAL
);
CREATE TABLE patients
(
patient TEXT
... |
food_inspection_2 | What is the facility type of the establishment named "Kinetic Playground"? | the establishment named "Kinetic Playground" refers to dba_name = 'Kinetic Playground' | SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground' | CREATE TABLE employee
(
employee_id INTEGER
primary key,
first_name TEXT,
last_name TEXT,
address TEXT,
city TEXT,
state TEXT,
zip INTEGER,
phone TEXT,
title TEXT,
salary INTEGER,
supervisor INTEGER,
foreign key (s... |
beer_factory | List out root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products? | root beer brand refers to BrandName; not caffeinated refers to Caffeinated = 'FALSE'; not containing cane sugar refers to CaneSugar = 'FALSE'; total amount sold = SUM(PurchasePrice); | SELECT T1.BrandName, SUM(T3.PurchasePrice) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
cookbook | Provide the ingredients that are rationed in the recipe with the highest carbohydrate content. | the highest carbohydrate content refers to MAX(carbo) | SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T2.max_qty = T2.min_qty ORDER BY T3.carbo DESC LIMIT 1 | CREATE TABLE Ingredient
(
ingredient_id INTEGER
primary key,
category TEXT,
name TEXT,
plural TEXT
);
CREATE TABLE Recipe
(
recipe_id INTEGER
primary key,
title TEXT,
subtitle TEXT,
servings INTEGER,
yield_unit TEXT,
prep_min... |
world_development_indicators | In 1970, how many Middle Eastern & North African countries whose value for CO2 emissions from gaseous fuel consumption (kt) indicator is more than 600? | Year = 1970; Middle East & North Africa is the name of the region where Region = 'Middle East & North Africa'; CO2 emissions from gaseous fuel consumption (kt) is the name of indicator where IndicatorName = 'CO2 emissions from gaseous fuel consumption (kt)' | SELECT COUNT(T2.CountryCode) FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T1.IndicatorName = 'CO2 emissions FROM gaseous fuel consumption (kt)' AND T1.Year = 1970 AND T1.Value > 600 | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
retail_world | Is (206) 555-1189 the home phone number for Laura Callahan? | "Laura Callahan" refers to FirstName = 'Laura AND LastName = 'Callahan | SELECT CASE WHEN HomePhone = '(206) 555-1189' THEN 'YES' ELSE 'NO' END FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan' | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
retail_world | List the name of the top ten most ordered product's names in descending order of the number of orders. | most ordered refers to max(COUNT(OrderID)) | SELECT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID GROUP BY T3.ProductName ORDER BY COUNT(*) DESC LIMIT 10 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
movie_platform | How many more movie lists were created by the user who created the movie list "250 Favourite Films"? | 250 Favourite Films refers to list_title; | SELECT COUNT(list_id) FROM lists_users WHERE user_id = ( SELECT user_id FROM lists WHERE list_title = '250 Favourite Films' ) | CREATE TABLE IF NOT EXISTS "lists"
(
user_id INTEGER
references lists_users (user_id),
list_id INTEGER not null
primary key,
list_title TEXT,
list_movie_number INTEGER,
list_update_timestamp_utc TEXT,
list_creat... |
book_publishing_company | State the title and royalty percentage for title ID BU2075 between 10000 to 50000 range. | lorange mean low range; hirange mean high range; range refers to between the low and high range; lorange>10000; hirange<12000 | SELECT T1.title, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 10000 AND T2.hirange < 50000 AND T1.title_ID = 'BU2075' | CREATE TABLE authors
(
au_id TEXT
primary key,
au_lname TEXT not null,
au_fname TEXT not null,
phone TEXT not null,
address TEXT,
city TEXT,
state TEXT,
zip TEXT,
contract TEXT not null
);
CREATE TABLE jobs
(
job_id INTEGER
primary key,... |
chicago_crime | Among the crimes reported to the ward located at 1958 N. Milwaukee Ave., list down the report number of the crimes happened inside the apartment. | 1958 N. Milwaukee Ave. refers to ward_office_address = '1958 N. Milwaukee Ave.'; report number refers to case_number; inside the apartment refers to location_description = 'APARTMENT' | SELECT T1.case_number FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.location_description = 'APARTMENT' AND T2.ward_office_address = '1958 N. Milwaukee Ave.' | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
food_inspection | How many routine inspections did Tiramisu Kitchen have? | Tiramisu Kitchen is the name of the business; routine inspections refer to type = 'Routine - Unscheduled'; | SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.type = 'Routine - Unscheduled' AND T2.name = 'Tiramisu Kitchen' | CREATE TABLE `businesses` (
`business_id` INTEGER NOT NULL,
`name` TEXT NOT NULL,
`address` TEXT DEFAULT NULL,
`city` TEXT DEFAULT NULL,
`postal_code` TEXT DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`phone_number` INTEGER DEFAULT NULL,
`tax_code` TEXT DEFAULT NULL,
`b... |
retails | What is the phone number of Customer#000000001? | customer phone refers to c_phone; Customer#000000001 refers to c_name; | SELECT c_phone FROM customer WHERE c_name = 'Customer#000000001' | CREATE TABLE `customer` (
`c_custkey` INTEGER NOT NULL,
`c_mktsegment` TEXT DEFAULT NULL,
`c_nationkey` INTEGER DEFAULT NULL,
`c_name` TEXT DEFAULT NULL,
`c_address` TEXT DEFAULT NULL,
`c_phone` TEXT DEFAULT NULL,
`c_acctbal` REAL DEFAULT NULL,
`c_comment` TEXT DEFAULT NULL,
PRIMARY KEY (`c_custkey`),... |
movielens | Which different movies from France got the least ratings? | France is a country | SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.rating = 1 | CREATE TABLE users
(
userid INTEGER default 0 not null
primary key,
age TEXT not null,
u_gender TEXT not null,
occupation TEXT not null
);
CREATE TABLE IF NOT EXISTS "directors"
(
directorid INTEGER not null
primary key,
d_quality INTEGER not null,
avg... |
hockey | What is the average height of player who were born in 1990 and after? Compare the average height with players who were born before 1990. | average height refers to AVG(height); born in 1990 refers to birthYear = 1990
| SELECT AVG(IIF(birthYear < 1990, height, NULL)) - AVG(IIF(birthYear >= 1990, height, NULL)) FROM Master | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
video_games | Please list the names of the publishers of all the puzzle games. | name of publisher refers to publisher_name; puzzle refers to genre_name = 'Puzzle' | SELECT DISTINCT T3.publisher_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id INNER JOIN genre AS T4 ON T1.genre_id = T4.id WHERE T4.genre_name = 'Puzzle' | CREATE TABLE genre
(
id INTEGER not null
primary key,
genre_name TEXT default NULL
);
CREATE TABLE game
(
id INTEGER not null
primary key,
genre_id INTEGER default NULL,
game_name TEXT default NULL,
foreign key (genre_id) references genre(id)
);
C... |
bike_share_1 | What is the percentage of the trip were done by a subscriber? | subscription_type = 'Subscriber'; DIVIDE(COUNT(id where subscription_type = 'Subscriber'), COUNT(id)) as percentage; | SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber' | CREATE TABLE IF NOT EXISTS "station"
(
id INTEGER not null
primary key,
name TEXT,
lat REAL,
long REAL,
dock_count INTEGER,
city TEXT,
installation_date TEXT
);
CREATE TABLE IF NOT EXISTS "status"
(
statio... |
law_episode | How many 10-star votes were given to the episode titled "Cherished"? | 10-star vote refers to stars = 10; titled "Cherished" refers to title = 'Cherished' | SELECT T2.votes FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Cherished' AND T2.stars = 10 | CREATE TABLE Episode
(
episode_id TEXT
primary key,
series TEXT,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date DATE,
episode_image TEXT,
rating ... |
food_inspection | Between 2014 to 2016, what is the average inpsection score of the establishment owned by Yiu Tim Chan in 808 Pacific Ave, San Francisco? | average inspection score refers to avg(score); establishment owned by Yiu Tim Chan refers to business_id where owner_name = 'Yiu Tim Chan'; Between 2014 to 2016 refers to year(date) between 2014 and 2016; address = '808 Pacific Ave'; city = 'San Francisco'; | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) BETWEEN '2014' AND '2016' AND T2.owner_name = 'Yiu Tim Chan' AND T2.address = '808 Pacific Ave' AND T2.city = 'San Francisco' | CREATE TABLE `businesses` (
`business_id` INTEGER NOT NULL,
`name` TEXT NOT NULL,
`address` TEXT DEFAULT NULL,
`city` TEXT DEFAULT NULL,
`postal_code` TEXT DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`phone_number` INTEGER DEFAULT NULL,
`tax_code` TEXT DEFAULT NULL,
`b... |
disney | Which movie is the character Robin Hood in? | Robin Hood is the main character of the movie which refers to hero = 'Robin Hood'; movie refers to movie_title; | SELECT movie_title FROM characters WHERE hero = 'Robin Hood' | CREATE TABLE characters
(
movie_title TEXT
primary key,
release_date TEXT,
hero TEXT,
villian TEXT,
song TEXT,
foreign key (hero) references "voice-actors"(character)
);
CREATE TABLE director
(
name TEXT
primary key,
director TEXT,
fo... |
soccer_2016 | Calculate the average players out in the first innings per match. How many of them were out by the leg before wicket? | out by the leg refers to Out_Name = 'lbw'; out in the first innings refers to Innings_No = 2; | SELECT CAST(COUNT(T1.Player_Out) AS REAL) / COUNT(T1.Match_Id), SUM(CASE WHEN T2.Out_Name = 'lbw' THEN 1 ELSE 0 END) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T1.Kind_Out = T2.Out_Id WHERE T1.Innings_No = 2 | CREATE TABLE Batting_Style
(
Batting_Id INTEGER
primary key,
Batting_hand TEXT
);
CREATE TABLE Bowling_Style
(
Bowling_Id INTEGER
primary key,
Bowling_skill TEXT
);
CREATE TABLE City
(
City_Id INTEGER
primary key,
City_Name TEXT,
Country_id INTEGE... |
app_store | How many apps were last updated in January of 2018? Please write one translated review with positive sentiment for each app, if there's any. | updated in January of 2018 refers to Last Updated BETWEEN 'January 1, 2018' and 'January 31, 2018'; | SELECT DISTINCT Translated_Review FROM user_reviews WHERE App IN ( SELECT App FROM playstore WHERE `Last Updated` BETWEEN 'January 1, 2018' AND 'January 31, 2018' ) AND Sentiment = 'Positive' | CREATE TABLE IF NOT EXISTS "playstore"
(
App TEXT,
Category TEXT,
Rating REAL,
Reviews INTEGER,
Size TEXT,
Installs TEXT,
Type TEXT,
Price TEXT,
"Content Rating" TEXT,
Genres TEXT
);
CREA... |
movie_3 | What is the store and inventory ID of the film with the longest duration? | the longest duration refers to MAX(length) | SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1 | CREATE TABLE film_text
(
film_id INTEGER not null
primary key,
title TEXT not null,
description TEXT null
);
CREATE TABLE IF NOT EXISTS "actor"
(
actor_id INTEGER
primary key autoincrement,
first_name TEXT not null,
last_nam... |
student_loan | How many disabled students have payment due? | have payment due refers to bool = 'pos'; | SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T2.bool = 'pos' | CREATE TABLE bool
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE person
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE disabled
(
"name" TEXT default '' not null
primary key,
foreign key ("name") references person ("name")
on update c... |
disney | List the PG-13 romantic comedy movie titles and their release dates. | PG-13 refers to MPAA_rating = 'PG-13'; romantic comedy refers to genre = 'Romantic Comedy'; | SELECT movie_title, release_date FROM movies_total_gross WHERE MPAA_rating = 'PG-13' AND genre = 'Romantic Comedy' | CREATE TABLE characters
(
movie_title TEXT
primary key,
release_date TEXT,
hero TEXT,
villian TEXT,
song TEXT,
foreign key (hero) references "voice-actors"(character)
);
CREATE TABLE director
(
name TEXT
primary key,
director TEXT,
fo... |
movie_3 | List the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed films. | average rental rate of all listed films refers to AVG(rental_rate); rental rate greater than the 60% of average rental rate refers to rental_rate > (AVG(rental_rate)) MULTIPLY 0.6 | SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 ) | CREATE TABLE film_text
(
film_id INTEGER not null
primary key,
title TEXT not null,
description TEXT null
);
CREATE TABLE IF NOT EXISTS "actor"
(
actor_id INTEGER
primary key autoincrement,
first_name TEXT not null,
last_nam... |
works_cycles | Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year? | United States refers to CountryRegionCode = 'US'; | SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
simpson_episodes | Which episode has the highest number of vote of the star score? | highest number of vote of the star score refers to max(votes) | SELECT episode_id FROM Vote ORDER BY votes DESC LIMIT 1; | CREATE TABLE IF NOT EXISTS "Episode"
(
episode_id TEXT
constraint Episode_pk
primary key,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date TEXT,
episode_image TEXT,
... |
music_platform_2 | What is the percentage of the podcast that are categorized in four or more categories? | categorized in 4 or more refers to Count(category) > 4; percentage = Divide(Count(podcast_id(count(category) > 4)), Count(podcast_id)) * 100 | SELECT COUNT(T1.podcast_id) FROM ( SELECT podcast_id FROM categories GROUP BY podcast_id HAVING COUNT(category) >= 4 ) AS T1 | CREATE TABLE runs (
run_at text not null,
max_rowid integer not null,
reviews_added integer not null
);
CREATE TABLE podcasts (
podcast_id text primary key,
itunes_id integer not null,
slug text not null,
itunes_url text not null,
title text not null
... |
mondial_geo | Provide a full list of countries and its population with more than 70% of Chinese. | SELECT T1.Name, T1.Population * T2.Percentage FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Chinese' AND T2.Percentage > 70 | CREATE TABLE IF NOT EXISTS "borders"
(
Country1 TEXT default '' not null
constraint borders_ibfk_1
references country,
Country2 TEXT default '' not null
constraint borders_ibfk_2
references country,
Length REAL,
primary key (Country1, Country2)
);
CREATE TABLE I... | |
movie | What is the gross of a comedy movie with a rating lower than 7 and starred by an actor with a net worth greater than $375,000,000.00? | comedy movie refers to Genre = 'Comedy'; rating lower than 7 refers to Rating < 7; net worth greater than $375,000,000.00 refers to NetWorth > '$375,000,000.00' | SELECT SUM(T1.Gross) 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 CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) > 375000000 AND T1.Rating < 7 AND T1.Genre = 'Comedy' | CREATE TABLE actor
(
ActorID INTEGER
constraint actor_pk
primary key,
Name TEXT,
"Date of Birth" DATE,
"Birth City" TEXT,
"Birth Country" TEXT,
"Height (Inches)" INTEGER,
Biography TEXT,
Gender TEXT,
Ethnicity ... |
soccer_2016 | What are the names of players who had been man of the match more than 5 times in season year 2008? | man of the match more than 5 times refers to COUNT(Man_of_the_Match) > 5; in season year 2008 refers to Season_Year = 2008; name of player refers to Player_Name; | SELECT CASE WHEN COUNT(T2.Man_of_the_Match) > 5 THEN T1.Player_Name ELSE 0 END 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 WHERE T4.Season_Year = 2008 | CREATE TABLE Batting_Style
(
Batting_Id INTEGER
primary key,
Batting_hand TEXT
);
CREATE TABLE Bowling_Style
(
Bowling_Id INTEGER
primary key,
Bowling_skill TEXT
);
CREATE TABLE City
(
City_Id INTEGER
primary key,
City_Name TEXT,
Country_id INTEGE... |
student_loan | How many students in the Air Force? | Air Force refers to organ = 'air_force'; | SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' | CREATE TABLE bool
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE person
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE disabled
(
"name" TEXT default '' not null
primary key,
foreign key ("name") references person ("name")
on update c... |
works_cycles | Which is a high quality product but with the lowest transacted quantity? | High quality refers to the product's quality class, therefore Class = 'H'; the lowest transacted quantity refers to Quantity = 1 | SELECT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'H' ORDER BY T2.Quantity ASC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
citeseer | List all paper ID and its class type with more than 20 cited words. | class type refers to class_label; count(word_cited_id)>20 | SELECT DISTINCT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id GROUP BY T2.paper_id, T1.class_label HAVING COUNT(T2.word_cited_id) > 20 | CREATE TABLE cites
(
cited_paper_id TEXT not null,
citing_paper_id TEXT not null,
primary key (cited_paper_id, citing_paper_id)
);
CREATE TABLE paper
(
paper_id TEXT not null
primary key,
class_label TEXT not null
);
CREATE TABLE content
(
paper_id TEXT not null,
word_cited_... |
address | Which district has the largest land area in Wisconsin? Write the full name of the congress representative and include the postal codes. | "Wisconsin" is the state; largest land area refers to Max(land_area); full name refers to first_name, last_name; postal code refers to zip_code | SELECT T2.zip_code, T1.first_name, T1.last_name FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Wisconsin' ORDER BY T1.land_area DESC LIMIT 1 | CREATE TABLE CBSA
(
CBSA INTEGER
primary key,
CBSA_name TEXT,
CBSA_type TEXT
);
CREATE TABLE state
(
abbreviation TEXT
primary key,
name TEXT
);
CREATE TABLE congress
(
cognress_rep_id TEXT
primary key,
first_name TEXT,
last_name ... |
codebase_comments | How many more stars in percentage are there for the repository of solution "1" than solution "2"? | solution refers to Solution.Id; Solution.Id = 1 OR 2; percentage = DIVIDE(MULTIPLY(SUBTRACT(SUM(Solution.Id = 1), SUM(Solution.Id = 2)), 100)), SUM(Solution.Id = 2); | SELECT CAST(SUM(CASE WHEN T2.Id = 1 THEN T1.Stars ELSE 0 END) - SUM(CASE WHEN T2.Id = 2 THEN T1.Stars ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 2 THEN T1.Stars ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS "Method"
(
Id INTEGER not null
primary key autoincrement,
Name TEXT,
FullComment TEXT,
Summary TEXT,
ApiCalls TEXT,
CommentIsXml INTEGER,
SampledAt INTEGER,
SolutionId INTE... |
talkingdata | Provide the app users IDs and time for the event ID of 82. | app user IDs refers to app_id; time refers to timestamp; | SELECT T1.app_id, T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T2.event_id = 82 | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
software_company | What is the total number of widowed customers with an age below 50? | widowed customers with an age below 50 refer to MARITAL_STATUS = 'Widowed' where age < 50; | SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Widowed' AND age < 50 | CREATE TABLE Demog
(
GEOID INTEGER
constraint Demog_pk
primary key,
INHABITANTS_K REAL,
INCOME_K REAL,
A_VAR1 REAL,
A_VAR2 REAL,
A_VAR3 REAL,
A_VAR4 REAL,
A_VAR5 REAL,
A_VAR6 REAL,
A_VAR7 REAL,
... |
video_games | In 2010, how many PS3 games were released? | in 2010 refers to release_year = 2010; PS3 refers to platform_name = 'PS3'; | SELECT 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 = 'PS3' AND T2.release_year = 2010 | CREATE TABLE genre
(
id INTEGER not null
primary key,
genre_name TEXT default NULL
);
CREATE TABLE game
(
id INTEGER not null
primary key,
genre_id INTEGER default NULL,
game_name TEXT default NULL,
foreign key (genre_id) references genre(id)
);
C... |
shakespeare | Among paragraphs with paragraph number between 1900 to 1950, list the texts said by a character described as a sea captain, friend to Sebatian. | paragraph number between 1900 to 1950 refers to ParagraphNum > = 1500 AND ParagraphNum < = 1950; texts refers to PlainText; a character described as a sea captain, friend to Sebatian refers to characters.Description = 'a sea captain, friend to Sebastian' | SELECT T1.description FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.PlainText = 'a sea captain, friend to Sebastian' AND T2.ParagraphNum BETWEEN 1500 AND 1950 | CREATE TABLE IF NOT EXISTS "chapters"
(
id INTEGER
primary key autoincrement,
Act INTEGER not null,
Scene INTEGER not null,
Description TEXT not null,
work_id INTEGER not null
references works
);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NO... |
chicago_crime | Who is the crime against criminal sexual abuse? | "Criminal Sexual Abuse" is the title of crime | SELECT crime_against FROM FBI_Code WHERE title = 'Criminal Sexual Abuse' | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
shipping | What is the average annual revenue of customers who have shipment weight of less than 65000 pounds? | weight of less than 65000 pounds refers to weight < 65000; average annual revenue refers to AVG(annual_revenue) | SELECT AVG(T1.annual_revenue) FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.weight < 65000 | CREATE TABLE city
(
city_id INTEGER
primary key,
city_name TEXT,
state TEXT,
population INTEGER,
area REAL
);
CREATE TABLE customer
(
cust_id INTEGER
primary key,
cust_name TEXT,
annual_revenue INTEGER,
cust_type TEXT,
addre... |
student_loan | Which organization does student 313 belong to? | organization refers to organ | SELECT organ FROM enlist WHERE name = 'studenT113' | CREATE TABLE bool
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE person
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE disabled
(
"name" TEXT default '' not null
primary key,
foreign key ("name") references person ("name")
on update c... |
works_cycles | Which year is credit card No.9648's Expiration Year? | Expiration year refers to ExpYear | SELECT ExpYear FROM CreditCard WHERE CreditCardID = 9648 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
movie_3 | How many actors with the surname Kilmer are there? | surname means last_name; | SELECT COUNT(actor_id) FROM actor WHERE last_name = 'Kilmer' | CREATE TABLE film_text
(
film_id INTEGER not null
primary key,
title TEXT not null,
description TEXT null
);
CREATE TABLE IF NOT EXISTS "actor"
(
actor_id INTEGER
primary key autoincrement,
first_name TEXT not null,
last_nam... |
retail_world | List the order IDs, product IDs and unit price of orders which total payment is greater than 15000. | total payment is greater than 15000 refers to MULTIPLY((Quantity * UnitPrice * (1 - Discount))) > 15000
| SELECT ProductID, OrderID, UnitPrice FROM `Order Details` WHERE UnitPrice * Quantity * (1 - Discount) > 15000 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
menu | State the full height and width for menu called "El Fuerte Del Palmar". | width refers to full_width; El Fuerte Del Palmar is a name of menu; | SELECT T1.full_height, T1.full_width FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id WHERE T2.name = 'El Fuerte Del Palmar' | CREATE TABLE Dish
(
id INTEGER
primary key,
name TEXT,
description TEXT,
menus_appeared INTEGER,
times_appeared INTEGER,
first_appeared INTEGER,
last_appeared INTEGER,
lowest_price REAL,
highest_price REAL
);
CREATE TABLE Menu
(
id ... |
cs_semester | What is the average teaching ability of the most popular professors? | average = AVG(teachingability); most popular professor refers to MAX(popularity); | SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof ) | CREATE TABLE IF NOT EXISTS "course"
(
course_id INTEGER
constraint course_pk
primary key,
name TEXT,
credit INTEGER,
diff INTEGER
);
CREATE TABLE prof
(
prof_id INTEGER
constraint prof_pk
primary key,
gender TEXT,
first_na... |
codebase_comments | How many solutions whose repository's stars are a third more than forks? | solutions refers to Solution.Id; repository stars are a third more than forks = (MULTIPLY(Stars, 1/3))>Forks; | SELECT COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Forks < T1.Stars * 1 / 3 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS "Method"
(
Id INTEGER not null
primary key autoincrement,
Name TEXT,
FullComment TEXT,
Summary TEXT,
ApiCalls TEXT,
CommentIsXml INTEGER,
SampledAt INTEGER,
SolutionId INTE... |
authors | Write down the title and affiliation of the preprinted paper written by "Roger J.Marshal". | "Roger J. Marshall" is the name of author; preprinted paper refers to ConferenceId = 0 AND JournalId = 0 | SELECT T1.Title, T2.Affiliation FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T2.Name = 'Roger J. Marshall' AND T1.ConferenceID = 0 AND T1.JournalID = 0 | CREATE TABLE IF NOT EXISTS "Author"
(
Id INTEGER
constraint Author_pk
primary key,
Name TEXT,
Affiliation TEXT
);
CREATE TABLE IF NOT EXISTS "Conference"
(
Id INTEGER
constraint Conference_pk
primary key,
ShortName TEXT,
FullName TE... |
public_review_platform | Calculate difference between business that have the highest number of reviews and business that have the lowest number of reviews. | highest number of reviews refers to SUBTRACT(MAX(COUNT(business_id), MIN(COUNT(business_id)))) | SELECT ( SELECT COUNT(business_id) FROM Reviews GROUP BY business_id ORDER BY COUNT(business_id) DESC LIMIT 1 ) - ( SELECT COUNT(business_id) FROM Reviews GROUP BY business_id ORDER BY COUNT(business_id) ASC LIMIT 1 ) AS DIFF | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
social_media | What is the gender of the user who posted a tweet with ID tw-682714583044243456? | "tw-682714583044243456" is the TweetID | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-682714583044243456' | CREATE TABLE location
(
LocationID INTEGER
constraint location_pk
primary key,
Country TEXT,
State TEXT,
StateCode TEXT,
City TEXT
);
CREATE TABLE user
(
UserID TEXT
constraint user_pk
primary key,
Gender TEXT
);
CREATE TABLE twitter
(
... |
car_retails | What is the total price of the order 10100? | SUM(MULTIPLY(quantityOrdered, priceEach) | SELECT SUM(t.priceEach * t.quantityOrdered) FROM orderdetails t WHERE t.orderNumber = '10100' | CREATE TABLE offices
(
officeCode TEXT not null
primary key,
city TEXT not null,
phone TEXT not null,
addressLine1 TEXT not null,
addressLine2 TEXT,
state TEXT,
country TEXT not null,
postalCode TEXT not null,
territory TEXT not null
);
CREATE... |
books | List all of the books that were published in 1995. | published in 1995 refers to publication_date LIKE '1995%'; ; list of book refers to title | SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1995' | CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
);
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
);
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language... |
sales | List the full name of the customer who purchased the most quantity of products. | full name of the customer = FirstName, LastName; most quantity refers to MAX(Quantity); | SELECT T1.FirstName, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID ORDER BY T2.Quantity DESC LIMIT 1 | CREATE TABLE Customers
(
CustomerID INTEGER not null
primary key,
FirstName TEXT not null,
MiddleInitial TEXT null,
LastName TEXT not null
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null
primary key,
FirstName TEXT not null,
MiddleIn... |
retail_world | What is the full address of Rattlesnake Canyon Grocery? | full address refers to ShipAddress, ShipCity, ShipRegion,ShipPostalCode, ShipCountry; 'Rattlesnake Canyon Grocery' is a ShipName; | SELECT DISTINCT ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry FROM Orders WHERE ShipName = 'Rattlesnake Canyon Grocery' | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
movies_4 | What percentage of films are made in the US? | films' and 'movies' are synonyms; made in the US refers to country_iso_code = 'US'; percentage = divide(sum(country_id) when country_iso_code = 'US', count(country_id)) * 100 as percentage | SELECT CAST(COUNT(CASE WHEN T3.COUNTry_iso_code = 'US' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) 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 | CREATE TABLE country
(
country_id INTEGER not null
primary key,
country_iso_code TEXT default NULL,
country_name TEXT default NULL
);
CREATE TABLE department
(
department_id INTEGER not null
primary key,
department_name TEXT default NULL
);
CREATE TABLE gender
(
... |
mondial_geo | What is the capital city of the country that has the percentage of Armenian speakers over 90%? | Percentage of country > 90% refers to percentage > 90; America is one of country names | SELECT T1.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90 | CREATE TABLE IF NOT EXISTS "borders"
(
Country1 TEXT default '' not null
constraint borders_ibfk_1
references country,
Country2 TEXT default '' not null
constraint borders_ibfk_2
references country,
Length REAL,
primary key (Country1, Country2)
);
CREATE TABLE I... |
social_media | Calculate the total likes collected by tweets in `ru` posted by male users. | 'ru' refers to Lang = 'ru'; male user refers to Gender = 'Male' | SELECT SUM(T1.Likes) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'ru' AND T2.Gender = 'Male' | CREATE TABLE location
(
LocationID INTEGER
constraint location_pk
primary key,
Country TEXT,
State TEXT,
StateCode TEXT,
City TEXT
);
CREATE TABLE user
(
UserID TEXT
constraint user_pk
primary key,
Gender TEXT
);
CREATE TABLE twitter
(
... |
talkingdata | How many models does the VIVO phone brand released? | models refers to device_model; | SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE phone_brand = 'vivo' | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
language_corpus | List the page id of wikipedia about Catalan language which have the appearance of the word 'decimal'? | have the appearance of 'decimal' refers to word = 'decimal' | SELECT T2.pid FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'decimal' | CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0);
CREATE TABLE sqlite_s... |
world | List all the countries in the continent of Asia that use English as their unofficial language. | use English as unofficial language refers to Language = 'English' WHERE IsOfficial = 'F'; | SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' AND T2.IsOfficial = 'F' GROUP BY T1.Name | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE `City` (
`ID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`Name` TEXT NOT NULL DEFAULT '',
`CountryCode` TEXT NOT NULL DEFAULT '',
`District` TEXT NOT NULL DEFAULT '',
`Population` INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (`CountryCode`) REFERENCES `Countr... |
talkingdata | What is the age of the youngest female device user? | youngest refers to MIN(age); female refers to gender = 'F'; | SELECT MIN(age) FROM gender_age WHERE gender = 'F' | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
works_cycles | Among the sales people, who are hired prior to 2010? | Sales people refer to PersonType = 'SP'; hired prior to 2010 means the person's hiring date was before 2010, therefore year(HireDate)<2010 | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' AND SUBSTR(T1.HireDate, 0, 4) < 2010 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
bike_share_1 | What is the route that has the longest duration? Indicate the city of where the stations are located. | route implies a course taken in getting from start_station_name to end_station_name; the longest duration refers to MAX(duration); | SELECT T1.start_station_name, T1.end_station_name, T2.city FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name ) | CREATE TABLE IF NOT EXISTS "station"
(
id INTEGER not null
primary key,
name TEXT,
lat REAL,
long REAL,
dock_count INTEGER,
city TEXT,
installation_date TEXT
);
CREATE TABLE IF NOT EXISTS "status"
(
statio... |
beer_factory | List the brand IDs of the beers whose star rating is more than 3. | star rating is more than 3 refers to StarRating > 3; | SELECT BrandID FROM rootbeerreview WHERE StarRating > 3 | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
works_cycles | What is the name of the product with the almost highest review score? | highest review score refers to Rating = 5; | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 ) | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
hockey | Is there any coach who has not been a player before but has won award? State the ID. | coach who has not been a player means playerID is NULL and coachID is not NULL; | SELECT DISTINCT T2.coachID FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.playerID IS NULL | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
retails | Please list the order comments of all the orders made by customers in the household segment. | orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; order comments refer to o_comment; | SELECT T1.o_comment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD' | CREATE TABLE `customer` (
`c_custkey` INTEGER NOT NULL,
`c_mktsegment` TEXT DEFAULT NULL,
`c_nationkey` INTEGER DEFAULT NULL,
`c_name` TEXT DEFAULT NULL,
`c_address` TEXT DEFAULT NULL,
`c_phone` TEXT DEFAULT NULL,
`c_acctbal` REAL DEFAULT NULL,
`c_comment` TEXT DEFAULT NULL,
PRIMARY KEY (`c_custkey`),... |
works_cycles | How many types of credit cards are there and how many are vista? | type of credit card refers to CardType; CardType = 'Vista'; | SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista' | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
retail_complains | Pick 5 clients with 0 priority and write down their last name. | 0 priority refers to priority = 0; last name refers to last | SELECT T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.priority = 0 LIMIT 5 | CREATE TABLE state
(
StateCode TEXT
constraint state_pk
primary key,
State TEXT,
Region TEXT
);
CREATE TABLE callcenterlogs
(
"Date received" DATE,
"Complaint ID" TEXT,
"rand client" TEXT,
phonefinal TEXT,
"vru+line" TEXT,
call_id INTEG... |
university | How many students attended universities were there in 2011? | in 2011 refers to year = 2011; | SELECT SUM(num_students) FROM university_year WHERE year = 2011 | CREATE TABLE country
(
id INTEGER not null
primary key,
country_name TEXT default NULL
);
CREATE TABLE ranking_system
(
id INTEGER not null
primary key,
system_name TEXT default NULL
);
CREATE TABLE ranking_criteria
(
id INTEGER not null
... |
bike_share_1 | Which year had the most number of trips that started at stations in San Francisco? | started at station refers to start_station_name; San Francisco refers to city = 'San Francisco'; year that had the most number of trips refers to MAX(year(start_date)); | SELECT SUBSTR(CAST(T1.start_date AS TEXT), INSTR(T1.start_date, ' '), -4) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco' GROUP BY T1.start_station_name ORDER BY COUNT(T1.id) DESC LIMIT 1 | CREATE TABLE IF NOT EXISTS "station"
(
id INTEGER not null
primary key,
name TEXT,
lat REAL,
long REAL,
dock_count INTEGER,
city TEXT,
installation_date TEXT
);
CREATE TABLE IF NOT EXISTS "status"
(
statio... |
movie_platform | List ther users who gave the worst rating for movie 'Love Will Tear Us Apart'. | worst rating refers to rating_score = 1; | SELECT T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Love Will Tear Us Apart' AND T1.rating_score = 1 | CREATE TABLE IF NOT EXISTS "lists"
(
user_id INTEGER
references lists_users (user_id),
list_id INTEGER not null
primary key,
list_title TEXT,
list_movie_number INTEGER,
list_update_timestamp_utc TEXT,
list_creat... |
movies_4 | List all companies who worked in the movie 'Ultramarines: A Warhammer 40,000 Movie.' | all companies refers to company_name; movie 'Ultramarines: A Warhammer 40,000 Movie' refers to title = 'Ultramarines: A Warhammer 40,000 Movie' | 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 = 'Ultramarines: A Warhammer 40,000 Movie' | CREATE TABLE country
(
country_id INTEGER not null
primary key,
country_iso_code TEXT default NULL,
country_name TEXT default NULL
);
CREATE TABLE department
(
department_id INTEGER not null
primary key,
department_name TEXT default NULL
);
CREATE TABLE gender
(
... |
app_store | Which of the app is the best selling app and what is the sentiments polarity of it? | best selling app = MAX(MULTIPLY(Price, Installs)); | SELECT T1.App, T2.Sentiment_Polarity FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App ORDER BY T1.Price * CAST(REPLACE(REPLACE(Installs, ',', ''), '+', '') AS INTEGER) DESC LIMIT 1 | CREATE TABLE IF NOT EXISTS "playstore"
(
App TEXT,
Category TEXT,
Rating REAL,
Reviews INTEGER,
Size TEXT,
Installs TEXT,
Type TEXT,
Price TEXT,
"Content Rating" TEXT,
Genres TEXT
);
CREA... |
superstore | What is the total sales of furniture products in the east superstore in the year 2016.
| furniture products refers to Category = 'Furnitures'; in the year 2016 refers to "Order Date" BETWEEN '2016-01-01' AND '2016-12-31' | SELECT SUM(T1.Sales) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE STRFTIME('%Y', T1.`Order Date`) = '2016' AND T2.Category = 'Furniture' | CREATE TABLE people
(
"Customer ID" TEXT,
"Customer Name" TEXT,
Segment TEXT,
Country TEXT,
City TEXT,
State TEXT,
"Postal Code" INTEGER,
Region TEXT,
primary key ("Customer ID", Region)
);
CREATE TABLE product
(
"Product ID" TE... |
books | In which cities are the customers of Costa Rica located? | "Costa Rica" is the country_name | SELECT T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica' | CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
);
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
);
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language... |
shakespeare | How many chapters include the character name "First Witch"? | character name "First Witch" refers to CharName = 'First Witch' | SELECT COUNT(T2.chapter_id) FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'First Witch' | CREATE TABLE IF NOT EXISTS "chapters"
(
id INTEGER
primary key autoincrement,
Act INTEGER not null,
Scene INTEGER not null,
Description TEXT not null,
work_id INTEGER not null
references works
);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NO... |
retail_world | Among the seafood products, which product have the highest total production of the production? | seafood product refers to CategoryName = 'Seafood'; product refers to ProductID; highest total production refers to max(add(units in stock, units on order)) | SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Seafood' ORDER BY T1.UnitsInStock + T1.UnitsOnOrder DESC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
retail_complains | List down the full name of clients who have disputed the response from company. | full name refers to first, middle, last; disputed the response refers to Consumer disputed? = 'Yes' | SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Consumer disputed?` = 'Yes' | CREATE TABLE state
(
StateCode TEXT
constraint state_pk
primary key,
State TEXT,
Region TEXT
);
CREATE TABLE callcenterlogs
(
"Date received" DATE,
"Complaint ID" TEXT,
"rand client" TEXT,
phonefinal TEXT,
"vru+line" TEXT,
call_id INTEG... |
chicago_crime | Who is the commander of Morgan Park district? | Morgan Park district refers to district_name = 'Morgan Park' | SELECT commander FROM District WHERE district_name = 'Morgan Park' | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
airline | Please list the departure airports of the flights on 2018/8/1 that were delayed. | departure airports refers ORIGIN; on 2018/8/1 refers to FL_DATE = '2018/8/1'; delayed refers to DEP_DELAY > 0; | SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T2.DEP_DELAY > 0 GROUP BY T1.Description | CREATE TABLE IF NOT EXISTS "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
);
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
);
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM ... |
retail_world | Please indicate the product name of Tokyo Traders company with order quantity greater than 40. | 'Tokyo Traders' is a CompanyName; order quantity greater than 40 refers to Quantity > 40 | SELECT DISTINCT T2.ProductName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID WHERE T1.CompanyName = 'Tokyo Traders' AND T3.Quantity > 40 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
cars | How much is the car with the highest sweep volume? | cost refers to price; the highest sweep volume refers to max(divide(displacement, cylinders)) | SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T1.displacement / T1.cylinders DESC LIMIT 1 | CREATE TABLE country
(
origin INTEGER
primary key,
country TEXT
);
CREATE TABLE price
(
ID INTEGER
primary key,
price REAL
);
CREATE TABLE data
(
ID INTEGER
primary key,
mpg REAL,
cylinders INTEGER,
displacement REAL,
hors... |
books | How many books under 300 pages has HarperCollins Publishers published? | under 300 pages refers to num_pages < 300; 'HarperCollins Publishers" is the publisher_name | SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300 | CREATE TABLE address_status
(
status_id INTEGER
primary key,
address_status TEXT
);
CREATE TABLE author
(
author_id INTEGER
primary key,
author_name TEXT
);
CREATE TABLE book_language
(
language_id INTEGER
primary key,
language_code TEXT,
language... |
student_loan | Calculate the number of students who are not disabled. | students who are not disabled refers to person.name who are NOT in disabled.name; | SELECT COUNT(CASE WHEN T2.name IS NULL THEN T1.name END) AS "number" FROM person AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name | CREATE TABLE bool
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE person
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE disabled
(
"name" TEXT default '' not null
primary key,
foreign key ("name") references person ("name")
on update c... |
app_store | How many neutral reviews does the app "Dino War: Rise of Beasts" have? | neutral reviews refers to Sentiment = 'Neutral'; | SELECT COUNT(App) FROM user_reviews WHERE App = 'Dino War: Rise of Beasts' AND Sentiment = 'Neutral' | CREATE TABLE IF NOT EXISTS "playstore"
(
App TEXT,
Category TEXT,
Rating REAL,
Reviews INTEGER,
Size TEXT,
Installs TEXT,
Type TEXT,
Price TEXT,
"Content Rating" TEXT,
Genres TEXT
);
CREA... |
address | What percentage of households are in "Coroyell" out of its state? | DIVIDE(SUM(households where county = 'CORYELL'), SUM(households)) as percentage; | SELECT CAST(SUM(CASE WHEN T1.county = 'CORYELL' THEN T2.households ELSE 0 END) AS REAL) * 100 / SUM(T2.households) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code | CREATE TABLE CBSA
(
CBSA INTEGER
primary key,
CBSA_name TEXT,
CBSA_type TEXT
);
CREATE TABLE state
(
abbreviation TEXT
primary key,
name TEXT
);
CREATE TABLE congress
(
cognress_rep_id TEXT
primary key,
first_name TEXT,
last_name ... |
college_completion | Give the cohort name for the school with biggest cohort size. | biggest cohort size refers to MAX(cohort_size); cohort = '4y bach' means bachelor's or equivalent-seeking cohort at 4-year institutions; cohort = '4y other' means students seeking another type of degree or certificate at a 4-year institution; cohort = '2y all' means degree-seeking students at 2-year institutions; | SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.cohort_size = ( SELECT MAX(T1.cohort_size) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid ) | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
works_cycles | How many products with the id "989" were sold in August 2013? | TransactionDate BETWEEN '2013-08-01' AND '2013-08-30'; sold in refers to TransactionType = 'S' which means SalesOrder; | SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
retail_world | List the top five most costly products in 1998. | most costly refers to max(add(unit price , Freight)); in 1998 refers to OrderDate > = '1998-01-01 00:00:00' AND OrderDate < '1999-01-01 00:00:00' | SELECT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.OrderDate LIKE '1998%' ORDER BY T3.UnitPrice + T1.Freight DESC LIMIT 5 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... |
beer_factory | What is the precise coordinate of Sac State Union? | precise coordinate = Latitude, Longitude; Sac State Union refers to LocationName = 'Sac State Union'; | SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State Union' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.