db_id stringlengths 4 28 | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringlengths 352 37.3k |
|---|---|---|---|---|
hockey | Please list the first names of the coaches whose team played in 1922's Stanley Cup finals. | teams refer to tmID; year = 1922; | SELECT T3.firstName FROM Coaches AS T1 INNER JOIN TeamsSC AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.year = 1922 | 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 ... |
sales_in_weather | Among the stores in weather station 14 in February 2014, which store had sold no less than 300 quantities for item number 44 in a single day? | weather station 14 refers to station_nbr = 14; February 2014 refers to substring (date, 1, 7) = '2014-02' ; sold no less than 300 quantities refers to units > = 300; item no.44 refers to item_nbr = 44; store refers to store_nbr | SELECT T1.store_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.station_nbr = 14 AND T1.`date` LIKE '%2014-02%' AND T1.item_nbr = 44 AND units >= 300 | CREATE TABLE sales_in_weather
(
date DATE,
store_nbr INTEGER,
item_nbr INTEGER,
units INTEGER,
primary key (store_nbr, date, item_nbr)
);
CREATE TABLE weather
(
station_nbr INTEGER,
date DATE,
tmax INTEGER,
tmin INTEGER,
tavg INTEGER,
dep... |
works_cycles | List the first and last name of all unmarried male Production Supervisors. | unmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title | SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%' | 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
... |
college_completion | In the state with the highest state appropriations to higher education in fiscal year 2011 per resident, which institution has the lowest number of undergraduates in 2010? | highest state appropriations to higher education in fiscal year 2011 per resident refers to MAX(state_appr_value); lowest number of undergraduates refers to MIN(student_count); in 2010 refers to year = 2010; | SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state INNER JOIN institution_grads AS T3 ON T3.unitid = T1.unitid WHERE T1.student_count = ( SELECT MIN(T1.student_count) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state ... | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
public_review_platform | Among the Yelp_Business in Arizona, how many of them closes at 12PM on Sundays? | in Arizona refers to state = 'AZ'; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday' | SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM' AND T3.state LIKE 'AZ' | 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 ... |
movie_3 | How many actors starred in the film id 508? | SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508 | 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... | |
soccer_2016 | What is the name of the youngest player? | name refers to Player_Name; youngest player refers to max(DOB) | SELECT Player_Name FROM Player ORDER BY DOB DESC LIMIT 1 | 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... |
chicago_crime | Where is the coordinate (41.66236555, -87.63470194) located? Give the name of the district. | coordinate (41.66236555, -87.63470194) refers to latitude = '41.66236555' AND longitude = '-87.63470194'; name of the district refers to district_name | SELECT T2.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.longitude = '-87.63470194' AND T1.latitude = '41.66236555' | 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 ... |
beer_factory | Give the name of the brands that brewed their first drink between 1996 and 2000 in the descending order of the date brewed. | name of the brands refers to BrandName; between 1996 and 2000 refers to FirstBrewedYear > = 1996 AND FirstBrewedYear < = 2000; | SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear BETWEEN '1996' AND '2000' ORDER BY FirstBrewedYear DESC | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
retails | How much is the part supply cost for the medium metallic grey dodger linen? | part supply cost refers to ps_supplycost; medium metallic grey dodger linen refers to p_name = 'medium metallic grey dodger linen' | SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'medium metallic grey dodger linen' | 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`),... |
student_loan | How many unemployed disabled students have been absent for 8 months from school? | absent for 8 months refers to month = 8; | SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name INNER JOIN disabled AS T3 ON T2.name = T3.name WHERE T1.month = 8 | 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... |
retails | How many orders of more than 10 items have been returned? | more than 10 items have been returned refer to l_returnflag = 'R' where l_quantity > 10; orders refer to l_orderkey; | SELECT COUNT(l_linenumber) FROM lineitem WHERE l_quantity > 10 AND l_returnflag = 'R' | 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`),... |
chicago_crime | Find the community area where the least number of domestic crimes happened. | least number of domestic crime refers to Min(Count(domestic = "TRUE")); community area refers to community_area_no | SELECT T2.community_area_no FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.domestic = 'TRUE' GROUP BY T2.community_area_no ORDER BY COUNT(T2.community_area_no) ASC LIMIT 1 | 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 ... |
public_review_platform | How many businesses are there in Phoenix city? Find the percentage of businesses in Phoenix city in the total city. | percentage = MULTIPLY(DIVIDE(SUM(city = 'Phoenix' END), COUNT(category_id)), 1.0); | SELECT SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.city) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_i... | 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 ... |
mondial_geo | Please list the top 3 countries with the highest inflation rate. | SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.Inflation DESC LIMIT 3 | 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... | |
simpson_episodes | How many episodes have more than 1000 votes? | more than 1000 votes refers to votes > 1000 | SELECT COUNT(episode_id) FROM Episode WHERE votes > 1000; | 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,
... |
talkingdata | What is the device id of the oldest user? | oldest user refers to MAX(age); | SELECT device_id FROM gender_age WHERE age = ( SELECT MAX(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... |
retail_world | How many orders have been shipped through United Package? | shipped through refers to ShipVia; United Package refers to CompanyName = 'United Package' | SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package' | 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,
... |
books | How many books have been published in Japanese? | in Japanese refers to language_name = 'Japanese | SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese' | 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... |
olympics | From 1900 to 1992, how many games did London host? | From 1900 to 1992 refers to games_year BETWEEN 1900 AND 1992; London refers to city_name = 'London'; games refer to games_name; | SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' AND T3.games_year BETWEEN 1900 AND 1992 | CREATE TABLE city
(
id INTEGER not null
primary key,
city_name TEXT default NULL
);
CREATE TABLE games
(
id INTEGER not null
primary key,
games_year INTEGER default NULL,
games_name TEXT default NULL,
season TEXT default NULL
);
CREATE TABLE ga... |
restaurant | Which restaurant on the street Alameda de las Pulgas in the city of Menlo Park is the worst rated? | restaurant refers to label; street Alameda de las Pulgas refers to street_name = 'avenida de las pulgas'; the worst rated refers to min(review) | SELECT T2.label FROM location AS T1 INNER JOIN generalinfo AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.street_name = 'avenida de las pulgas' AND T2.city = 'menlo park' ORDER BY review LIMIT 1 | CREATE TABLE geographic
(
city TEXT not null
primary key,
county TEXT null,
region TEXT null
);
CREATE TABLE generalinfo
(
id_restaurant INTEGER not null
primary key,
label TEXT null,
food_type TEXT null,
city TEXT null,
review REA... |
movie_platform | Show the portrait picture of the user who created the list "Vladimir Vladimirovich Nabokov". | the list "Vladimir Vladimirovich Nabokov" refers to list_title = 'Vladimir Vladimirovich Nabokov'; portrait picture refers to user_avatar_image_url | SELECT T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Vladimir Vladimirovich Nabokov' | 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... |
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' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
hockey | How old was the goaltender who scored the fewest goals while on the ice when he retired from the NHL? | goaltender' and 'goalie' are synonyms; fewest goals while on the ice refers to min(GA); How old = subtract(lastNHL(playerID(min(GA))), birthYear(playerID(min(GA))))) | SELECT T2.lastNHL - T2.birthYear FROM GoaliesSC AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.lastNHL IS NOT NULL GROUP BY T2.lastNHL, T2.birthYear ORDER BY SUM(GA) LIMIT 1 | 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 ... |
computer_student | For the professor who advised student no.6, please list the IDs of the courses he or she teaches. | professor refers to p_id_dummy and professor = 1; student no.6 refers to advisedBy.p_id = 6; IDs of the courses refers to taughtBy.course_id | SELECT T2.course_id FROM taughtBy AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id INNER JOIN advisedBy AS T3 ON T3.p_id = T1.p_id WHERE T1.p_id = 9 | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase ... |
video_games | What is the genre of the game "Mario vs. Donkey Kong"? | genre refers to genre_name; game "Mario vs. Donkey Kong" refers to game_name = 'Mario vs. Donkey Kong' | SELECT T1.genre_name FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T2.game_name = 'Mario vs. Donkey Kong' | 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... |
movie_platform | Please provide the title of the list with the most comments on the list. | the most comments refers to Max(list_comments); | SELECT list_title FROM lists GROUP BY list_title ORDER BY COUNT(list_comments) DESC LIMIT 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... |
public_review_platform | How many photos type compliment given from users with high cool votes? | photos type compliment refers to compliment_type = 'photos'; high cool votes refers to review_votes_cool = 'High' | SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id INNER JOIN Reviews AS T4 ON T1.user_id = T4.user_id WHERE T3.compliment_type = 'photos' AND T4.review_votes_cool = 'High' | 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 ... |
retail_world | Which employee handled the most amount of orders in 1996? Give the full name, title, and address of this employee. | most amount of orders refers to max(count(OrderID)); in 1996 refers to OrderDate > = '1996-01-01 00:00:00' AND OrderDate < '1997-01-01 00:00:00'; full name refers to FirstName, LastName | SELECT FirstName, LastName, Title, address FROM Employees WHERE EmployeeID = ( SELECT T1.EmployeeID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderDate BETWEEN '1996-01-01 00:00:00' AND '1997-01-01 00:00:00' GROUP BY T1.EmployeeID ORDER BY COUNT(T2.OrderID) 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,
... |
university | Provide the ranking system ID of the Center for World University Rankings. | the Center for World University Rankings refers to system_name = 'Center for World University Rankings'; | SELECT id FROM ranking_system WHERE system_name = 'Center for World University Rankings' | 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
... |
books | Name the publisher who published the most books. | published the most books refers to Max(Count(book_id)); publisher refers to publisher_name | SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1 | 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... |
works_cycles | What is the product ID No.793's model name? | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793 | 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
... | |
codebase_comments | What is the percentage of the methods' solutions that need to be compiled among the methods whose comments is XML format? | comment is XML format refers to CommentIsXml = 1; solution needs to be compiled refesr to WasCompiled = 0; percentage = MULTIPLY(DIVIDE(SUM(WasCompiled = 0), COUNT(Solution.Id)), 100); | SELECT CAST(SUM(CASE WHEN T1.WasCompiled = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.CommentIsXml = 1 | 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... |
retails | What is the nationality of "Customer#000000055"? | "Customer#000000055" is the name of the customer which refers to c_name; nationality is the state of belonging to a particular country, therefore nationality refers to n_name; | SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055' | 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`),... |
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 | CREATE TABLE Customers
(
CustomerID INTEGER
constraint Customers_pk
primary key,
"Customer Names" TEXT
);
CREATE TABLE Products
(
ProductID INTEGER
constraint Products_pk
primary key,
"Product Name" TEXT
);
CREATE TABLE Regions
(
StateCode TEXT
... |
talkingdata | Please provide the age group of any LG Nexus 4 device users. | age group refers to `group`; LG Nexus 4 refers to phone_brand = 'LG' AND device_model = 'Nexus 4'; | SELECT T1.`group` FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'LG' AND T2.device_model = 'Nexus 4' | 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... |
movies_4 | Work out the difference in revenues made between the English and Latin movies. | English refers to language_name = 'English'; Latin refers to language_name = 'Latin'; difference in revenues = subtract(sum(movie_id) when language_name = 'English', sum(movie_id) when language_name = 'Latin') | SELECT SUM(CASE WHEN T3.language_name = 'English' THEN T1.revenue ELSE 0 END) - SUM(CASE WHEN T3.language_name = 'Latin' THEN T1.revenue ELSE 0 END) AS DIFFERENCE FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_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
(
... |
olympics | Mention the height of people who belong to region id 7. | SELECT T2.height FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T1.region_id = 7 | CREATE TABLE city
(
id INTEGER not null
primary key,
city_name TEXT default NULL
);
CREATE TABLE games
(
id INTEGER not null
primary key,
games_year INTEGER default NULL,
games_name TEXT default NULL,
season TEXT default NULL
);
CREATE TABLE ga... | |
video_games | How many games do not have any sales in Europe? | do not have any sales refers to num_sales = 0; in Europe refers to region_name = 'Europe' | SELECT COUNT(*) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Europe' AND T1.num_sales = 0 | 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... |
menu | Please list the page numbers of all the menu pages on which the dish "Chicken gumbo" had appeared. | Chicken gumbo is a name of dish; | SELECT T1.page_number FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Chicken gumbo' | 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 ... |
shakespeare | What is the name of the character that can be found in paragraph 8 of chapter 18820? | name of the character refers to CharName; paragraph 8 refers to ParagraphNum = 8; chapter 18820 refers to chapter_id = 18820 | SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 8 AND T2.chapter_id = 18820 | 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... |
address | What is the longitude and latitude for the district represented by Grayson Alan? | SELECT T1.latitude, T1.longitude FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Grayson' AND T3.last_name = 'Alan' | 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 ... | |
cs_semester | Among undergraduate students, list the name of the course with the highest student satisfaction. | Undergraduate students refers to type = 'UG'; satisfaction refers to sat; highest satisfaction refers to MAX(sat); | SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.type = 'UG' ORDER BY T2.sat DESC LIMIT 1 | 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... |
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 | 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 ... |
restaurant | How many American food restaurants are unpopular in Carmel? | American Food Restaurant refers to food_type = 'ameraican'; unpopular refers to min(review); Carmel refers to city = 'Carmel' | SELECT COUNT(id_restaurant) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' AND review = ( SELECT MIN(review) FROM generalinfo WHERE food_type = 'american' AND city = 'carmel' ) | CREATE TABLE geographic
(
city TEXT not null
primary key,
county TEXT null,
region TEXT null
);
CREATE TABLE generalinfo
(
id_restaurant INTEGER not null
primary key,
label TEXT null,
food_type TEXT null,
city TEXT null,
review REA... |
sales | Among all customers handled by Innes E. del Castillo, how many have purchased Short-Sleeve Classic Jersey, L? | Short-Sleeve Classic Jersey, L' is name of product; | SELECT COUNT(T2.CustomerID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T3.FirstName = 'Innes' AND T3.LastName = 'del Castillo' AND T1.Name = 'Short-Sleeve Classic Jersey, L' AND T3.MiddleInitial = 'e' | 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... |
chicago_crime | How many vandalisms were arrested in the ward represented by Edward Burke? | vandalism refers to title = 'Vandalism'; arrested refers to arrest = 'TRUE' | SELECT SUM(CASE WHEN T1.alderman_last_name = 'Burke' THEN 1 ELSE 0 END) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Vandalism' AND T2.arrest = 'TRUE' AND T1.alderman_first_name = 'Edward' | 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 ... |
talkingdata | Among all the times event no.2 happened when the app user was not active, when was the earliest time this situation happened? | event no. refers to event_id; event_id = 2; not active refers to is_active = 0; earliest time refers to MIN(timestamp); | SELECT T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T1.is_active = 0 AND T2.event_id = 2 ORDER BY T2.timestamp LIMIT 1 | 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... |
simpson_episodes | List out the names of the awarded character in the awards held in 2009. | in 2009 refers to year = 2009; name of awarded character refers to character
| SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009; | 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,
... |
regional_sales | List down the product IDs and names that include the word "Outdoor". | names that include the word "Outdoor" refer to Product Name LIKE '%Outdoor%'; | SELECT ProductID, T FROM ( SELECT ProductID , CASE WHEN `Product Name` LIKE '%Outdoor%' THEN `Product Name` ELSE NULL END AS T FROM Products ) WHERE T IS NOT NULL ORDER BY T DESC | CREATE TABLE Customers
(
CustomerID INTEGER
constraint Customers_pk
primary key,
"Customer Names" TEXT
);
CREATE TABLE Products
(
ProductID INTEGER
constraint Products_pk
primary key,
"Product Name" TEXT
);
CREATE TABLE Regions
(
StateCode TEXT
... |
soccer_2016 | What is the average winning margin of the matches held in Newlands? | average winning margin refers to avg(win_margin); held in Newlands refers to venue_name = 'Newlands' | SELECT AVG(T1.win_margin) FROM Match AS T1 INNER JOIN Venue AS T2 ON T1.venue_id = T2.venue_id WHERE T2.venue_name = 'Newlands' | 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... |
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 | 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... |
movies_4 | What is the longest runtime of all movies? | longest runtime refers to max(runtime) | SELECT MAX(runtime) FROM 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
(
... |
hockey | What are the awards won by the coach who coached the team with the most number of victories of all time? Indicate the choach ID. | victories' and 'wins' are synonyms; most number of victories refers to max(w) | SELECT DISTINCT T2.coachID, T1.award FROM AwardsCoaches AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID GROUP BY T2.coachID, T1.award ORDER BY SUM(T2.w) DESC LIMIT 1 | 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 ... |
food_inspection_2 | Provide the inspection ID of the establishment named "PIZZA RUSTICA, INC." | "PIZZA RUSTICA, INC." refers to dba_name = 'PIZZA RUSTICA, INC' | SELECT DISTINCT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'PIZZA RUSTICA, INC' | 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... |
car_retails | To whom does Steve Patterson report? Please give his or her full name. | reportsTO' is the leader of the 'employeeNumber'; | SELECT t2.firstName, t2.lastName FROM employees AS t1 INNER JOIN employees AS t2 ON t2.employeeNumber = t1.reportsTo WHERE t1.firstName = 'Steve' AND t1.lastName = 'Patterson' | 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... |
cs_semester | What is the first and last name of students with highest gpa? | first name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa); | SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student ) | 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... |
movie_3 | How many rental IDs belong to Eleanor Hunt? | 'Eleanor Hunt' is the full name of a customer; full name refers to first_name, last_name | SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Eleanor' AND T2.last_name = 'Hunt' | 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... |
university | Give the name and score of the university ID 124. | name of university refers to university_name; | SELECT T2.university_name, T1.score FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.id = 124 | 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
... |
student_loan | What is the ratio of disable female to male students? | ratio refers to DIVIDE(COUNT(name not from male), COUNT(name from male)) | SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T2.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`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... |
car_retails | For the order has the most product ordered, name the customer who placed the order. | The largest order in terms of total price refers to MAX(SUM(MULTIPLY(quantityOrdered, priceEach)). | SELECT T2.firstName, T2.lastName FROM offices AS T1 INNER JOIN employees AS T2 ON T1.officeCode = T2.officeCode WHERE T2.employeeNumber = ( SELECT MAX(employeeNumber) FROM employees ) | 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... |
world_development_indicators | Please list annual indicator names which have values of more than 100 in 1965. | Annual refers to Periodicity; values of more than 100 implies Value>100; Year = '1965'; | SELECT DISTINCT T2.IndicatorName FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName WHERE T1.Year = 1965 AND T1.Value > 100 AND T2.Periodicity = 'Annual' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
music_tracker | How many tags does the release "city funk" have? | release "city funk" refers to groupName = 'city funk'; | SELECT COUNT(T2.tag) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T1.groupName = 'city funk' | CREATE TABLE IF NOT EXISTS "torrents"
(
groupName TEXT,
totalSnatched INTEGER,
artist TEXT,
groupYear INTEGER,
releaseType TEXT,
groupId INTEGER,
id INTEGER
constraint torrents_pk
primary key
);
CREATE TABLE IF NOT EXISTS "tags"
(
"in... |
authors | List the title and author's name of papers published in the 2007 Neoplasia journal. | published in the 2007 refers to Year = 2007; Neoplasia journal refers to FullName = 'Neoplasia' | SELECT T1.Title, T2.Name FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId INNER JOIN Journal AS T3 ON T1.JournalId = T3.Id WHERE T3.FullName = 'Neoplasia' AND T1.Year = 2007 | 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... |
shakespeare | What is the chapter description where the paragraph "What, wilt thou hear some music, my sweet love?" belongs? | paragraph "What, wilt thou hear some music, my sweet love?" refers to PlainText = 'What, wilt thou hear some music, my sweet love?' | SELECT T1.id, T1.Description FROM chapters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.chapter_id WHERE T2.PlainText = 'What, wilt thou hear some music, my sweet love?' | 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... |
soccer_2016 | What is the name of the team that won the most number of matches in season 1? | name of the team refers to Team_Name; the most number of matches refers to max(count(Match_Winner)); season 1 refers to season_Id = 1 | SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT Match_Winner FROM `Match` WHERE season_Id = 1 GROUP BY Match_Winner ORDER BY COUNT(Match_Winner) DESC LIMIT 1 ) | 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... |
cookbook | How many cups of 1% lowfat milk should be added to no.1436 recipe? | 1% lowfat milk is a name of an ingredient; no.1436 recipe refers to recipe_id = 1436; max_qty = min_qty | SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = '1% lowfat milk' AND T2.unit = 'cup(s)' AND T2.recipe_id = 1436 | 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... |
works_cycles | List all the socks products. | Socks is a name of product subcategory | SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks' | 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
... |
legislator | What are the full names of the non-google female entity legislators that have not been registered in Federal Election Commission data? | full names = first_name, last_name; non-google entity refers to google_entity_id_id is null; female refers to gender_bio = 'F'; have not been registered in Federal Election Commission data refers to fec_id is null; | SELECT first_name, last_name FROM historical WHERE gender_bio = 'F' AND google_entity_id_id IS NULL AND fec_id IS NULL | CREATE TABLE current
(
ballotpedia_id TEXT,
bioguide_id TEXT,
birthday_bio DATE,
cspan_id REAL,
fec_id TEXT,
first_name TEXT,
gender_bio TEXT,
google_entity_id_id TEXT,
govtrack_id INTEGER,
house_history_id ... |
works_cycles | What are the color of products that were reviewed? | SELECT T1.Color FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 709 OR 937 OR 798 | 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
... | |
craftbeer | Of all the beer styles produced by Stevens Point Brewery, how many percent do they allot for American Adjunct Lager? | Percent allotted = count(American Adjunct Lager beer styles) / count(styles) * 100% | SELECT CAST(SUM(IIF(T1.style = 'American Adjunct Lager', 1, 0)) AS REAL) * 100 / COUNT(T1.brewery_id) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.name = 'Stevens Point Brewery' | CREATE TABLE breweries
(
id INTEGER not null
primary key,
name TEXT null,
city TEXT null,
state TEXT null
);
CREATE TABLE IF NOT EXISTS "beers"
(
id INTEGER not null
primary key,
brewery_id INTEGER not null
constraint beers_ibfk_1
referen... |
public_review_platform | Indicate the business id and days which are opened from 8AM to 6PM. | opened from 8AM to 6PM refers to Business_Hours where opening_time = '8AM' and closing_time = '6PM'; days refer to day_id; | SELECT DISTINCT day_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM' | 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 ... |
mondial_geo | How much does the gross domestic products goes to the industry sector for Singapore? | Singapore is one of country names; GDP refers to gross domestic products; GDP to the industry sector = GDP * Industry | SELECT T2.GDP * T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Singapore' | 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... |
professional_basketball | Which team(s) has greater than 75% lost among all the games played. | greater than 75% lost refers to Divide(lost, games) > 0.75; team refers to tmID | SELECT name FROM teams WHERE CAST(lost AS REAL) * 100 / games > 75 | CREATE TABLE awards_players
(
playerID TEXT not null,
award TEXT not null,
year INTEGER not null,
lgID TEXT null,
note TEXT null,
pos TEXT null,
primary key (playerID, year, award),
foreign key (playerID) references players (playerID)
on update ca... |
olympics | How many competitors over the age of 30 participated in the 1992 Winter Olympics? | competitors over the age of 30 refer to person_id where age > 30; the 1992 Winter Olympics refers to games_name = '1992 Winter'; | SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1992 Winter' AND T2.age > 30 | CREATE TABLE city
(
id INTEGER not null
primary key,
city_name TEXT default NULL
);
CREATE TABLE games
(
id INTEGER not null
primary key,
games_year INTEGER default NULL,
games_name TEXT default NULL,
season TEXT default NULL
);
CREATE TABLE ga... |
beer_factory | What is the phone number of the customer who owns the credit card of number 6011179359005380? | FALSE; | SELECT DISTINCT T1.PhoneNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardNumber = 6011179359005382 | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
public_review_platform | Among the businesses in Chandler, list the attribute of the business with a low review count. | in Chandler refers to city = 'Chandler'; attribute refers to attribute_name | SELECT DISTINCT T3.attribute_id, T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.attribute_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.review_count = 'Low' AND T1.city = 'Chandler' | 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 ... |
world_development_indicators | List out the name and indicator code of high income: nonOECD countries | high income: non-OECD' refer to IncomeGroup; | SELECT DISTINCT T1.CountryCode, T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'High income: nonOECD' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
works_cycles | What is the age of the oldest Marketing Specialist by 12/31/2015 and what is his/her hourly rate? | age as of 12/31/2015 = SUBTRACT(2015, year(BirthDate)); hourly rate refers to Rate; | SELECT 2015 - STRFTIME('%Y', T1.BirthDate), T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Marketing Specialist' ORDER BY 2015 - STRFTIME('%Y', T1.BirthDate) 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
... |
world_development_indicators | Please calculate the percentage of Sub-Saharan African countries which are in the Special trade system. | Sub-Saharan African is the name of the region; SystemOfTrade = 'Special trade system'; countries refer to CountryCode; DIVIDE(COUNT (CountryCode where SystemOfTrade = 'Special trade system' and Region = 'Sub-Saharan Africa'), COUNT(CountryCode where Region = 'Sub-Saharan Africa')) as percentage; | SELECT CAST(SUM(CASE WHEN Region = 'Sub-Saharan Africa' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE SystemOfTrade = 'Special trade system' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
authors | List the name of the author that affiliated with University of Illinois Chicago? | 'University of Illinois Chicago' is an affiliation | SELECT Name FROM Author WHERE Affiliation = 'University of Illinois Chicago' | 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... |
talkingdata | List down the labels' IDs and categories of the app ID "5758400314709850000". | SELECT T1.label_id, T2.category FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T1.label_id = T2.label_id WHERE T1.app_id = 5758400314709850000 | 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... | |
simpson_episodes | Who produced The simpson 20s: Season 20? | produced refers to role = 'producer' | SELECT DISTINCT person FROM Credit WHERE role = 'producer'; | 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,
... |
address | Show the zip code of the county represented by Buchanan Vernon. | SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Buchanan' AND T1.last_name = 'Vernon' | 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 ... | |
computer_student | What is the average number of students for each advisor? | students refers to advisedBy.p_id; advisor refers to p_id_dummy; average number = avg(count(advisedBy.p_id)) | SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy | CREATE TABLE course
(
course_id INTEGER
constraint course_pk
primary key,
courseLevel TEXT
);
CREATE TABLE person
(
p_id INTEGER
constraint person_pk
primary key,
professor INTEGER,
student INTEGER,
hasPosition TEXT,
inPhase ... |
legislator | Give the state and type of term of the legislator with the google entity ID of kg:/m/02pyzk. | type of term refers to type; google entity ID refers to google_entity_id_id; google_entity_id_id = 'kg:/m/02pyzk'; | SELECT T2.state, T2.type FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.google_entity_id_id = 'kg:/m/02pyzk' | CREATE TABLE current
(
ballotpedia_id TEXT,
bioguide_id TEXT,
birthday_bio DATE,
cspan_id REAL,
fec_id TEXT,
first_name TEXT,
gender_bio TEXT,
google_entity_id_id TEXT,
govtrack_id INTEGER,
house_history_id ... |
public_review_platform | Please list the business IDs of the Yelp_Business that have a business time of longer than 12 hours on Sundays. | business time of longer than 12 hours refers to subtract(closing_time, opening_time) > 12; on Sundays refers to day_of_week = 'Sunday' | SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T1.closing_time + 12 - T1.opening_time > 12 AND T2.day_of_week LIKE 'Sunday' GROUP BY T1.business_id | 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 ... |
works_cycles | Jill ranked which medium-quality class product as the highest, and how long will it take the company to manufacture such a product? | second-lowest rating refers to Rating = 2; high-quality class product refers to Class = 'H'; length of time it takes the company to manufacture a product refers to DaysToManufacture; | SELECT T1.DaysToManufacture FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = 5 AND T1.Class = 'M' ORDER BY T2.Rating 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
... |
synthea | Please give the full names of all the patients who had been prescribed with Acetaminophen. | full name refers to first, last; prescribed with Acetaminophen refer to DESCRIPTION like 'Acetaminophen%' from medications; | SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.description LIKE 'Acetaminophen%' | 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
... |
olympics | What is the average height of the male Olympic competitors from Finland? | DIVIDE(SUM(height), COUNT(id)) where region_name = 'Finland' and gender = 'M'; | SELECT AVG(T3.height) 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 = 'Finland' AND T3.gender = 'M' | CREATE TABLE city
(
id INTEGER not null
primary key,
city_name TEXT default NULL
);
CREATE TABLE games
(
id INTEGER not null
primary key,
games_year INTEGER default NULL,
games_name TEXT default NULL,
season TEXT default NULL
);
CREATE TABLE ga... |
books | How many publishers have the word "book" in their name? | publisher have the word 'book' refers to publisher_name LIKE '%book%' | SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%' | 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... |
public_review_platform | How many user's compliment in photo has medium in number? | user's compliment in photo refers to compliment_type = 'photo'; photo has medium in number refers to number_of_compliments = 'Medium' | SELECT COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium' | 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 ... |
soccer_2016 | What is the name of the player who has been chosen the most times for 'Man of the Series'? | name of the player refers to Player_Name; most times for 'Man of the Series' refers to max(count(Man_of_the_Match)) | SELECT T3.Player_Name FROM Season AS T1 INNER JOIN Match AS T2 ON T1.Man_of_the_Series = T2.Man_of_the_Match INNER JOIN Player AS T3 ON T2.Man_of_the_Match = T3.Player_Id GROUP BY T3.Player_Name ORDER BY COUNT(T1.Man_of_the_Series) DESC LIMIT 1 | 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... |
soccer_2016 | Which venue did Kolkata Knight Riders play most of their matches as a Team 1? | venue refers to Venue_Name; Kolkata Knight Riders refers to Team_Name = 'Kolkata Knight Riders'; most of their matches refers to max(count(Venue_Id)); Team 1 refers to Team_Id = Team_1 | SELECT T3.Venue_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 INNER JOIN Venue AS T3 ON T2.Venue_Id = T3.Venue_Id WHERE T1.Team_Name = 'Kolkata Knight Riders' GROUP BY T3.Venue_Id ORDER BY COUNT(T3.Venue_Id) DESC LIMIT 1 | 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... |
mondial_geo | List all countries with 'Category III' membership in 'IFAD' organization. Please also provide the capital of the country. | SELECT Name, Capital FROM country WHERE Code IN ( SELECT Country FROM isMember WHERE type = 'Category III' AND Organization = 'IFAD' ) | 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... | |
works_cycles | What are the top 5 types of products with the highest selling price? ? | highest selling price refers to MAX(ListPrice); | SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5 | 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
... |
chicago_crime | How many cases have been arrested among the crimes that happened in the restaurant of Englewood? | arrested refers to arrest = 'TRUE'; restaurant refers to location_description = 'RESTAURANT'; Englewood refers to district_name = 'Englewood' | SELECT SUM(CASE WHEN T1.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Englewood' AND T1.location_description = 'RESTAURANT' | 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 ... |
retail_complains | What is the birth date of the youngest client? | birth date refers to year, month, day; youngest client refers to max(year, month, day) | SELECT day, month, year FROM client ORDER BY year DESC, month DESC, day DESC LIMIT 1 | 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... |
public_review_platform | Find the Yelp user with the average 5-star rating of all reviews who has been yelping the longest. | Yelp user refers to user_id; average 5-star rating refers to user_average_stars = 5; yelping the longest refers to min(user_yelping_since_year) | SELECT user_id FROM Users WHERE user_average_stars = 5 ORDER BY user_yelping_since_year ASC LIMIT 1 | 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 ... |
mondial_geo | In which city is the sea whose depth is 4232 meters less than that of the Bay of Bengal? | SELECT T2.City FROM sea AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Sea INNER JOIN city AS T3 ON T3.Name = T2.City WHERE ( SELECT Depth FROM sea WHERE Name LIKE '%Bengal%' ) - T1.Depth = 4235 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.