db_id stringclasses 69
values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringclasses 69
values |
|---|---|---|---|---|
olympics | List the name of the games that Georgios Abaris participated. | name of games refers to games_name; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Georgios Abaris' | 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... |
world | What is the form of government that the city of Manila has? | form of government refers to GovernmentForm; | SELECT T1.GovernmentForm FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = 'Manila' | 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... |
airline | Among the flights with air carrier described as Asap Air Inc.: ASP, what is the tail number of the flight with the longest departure delay? | Asap Air Inc.: ASP refers to Description = 'Asap Air Inc.: ASP'; tail number refers to TAIL_NUM; longest departure delay refers to MAX(DEP_DELAY); | SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Asap Air Inc.: ASP' ORDER BY T2.DEP_DELAY DESC LIMIT 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 ... |
sales | Calculate the total quantity of products that are gifts. | total quantity = SUM(Quantity); gifts refers to Price = 0; | SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Price = 0 | 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 of the patients born in 1920s had pneumonia? | patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to DESCRIPTION = 'Pneumonia' from conditions; | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE DESCRIPTION = 'Pneumonia' AND strftime('%Y', T1.birthdate) LIKE '192%' | 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
... |
coinmarketcap | List the names and symbols of the coins that were added on June 14, 2013. | added on June 14, 2013 refers to date_added like '2013-06-14%' | SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%' | CREATE TABLE coins
(
id INTEGER not null
primary key,
name TEXT,
slug TEXT,
symbol TEXT,
status TEXT,
category TEXT,
description TEXT,
subreddit TEXT,
notice TEXT,
tags TEXT,
tag_names TEXT,
... |
retail_world | Which company placed the order with the id 10257? | "10257" is the OrderID; company refers to CompanyName | SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10257 | 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,
... |
olympics | Where was the 1920 Summer held? | where it was held refers to city_name; the 1920 Summer refers to games_name = '1920 Summer'; | SELECT T2.city_name 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 T3.games_name = '1920 Summer' | 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... |
movie_3 | How many rentals were returned on 5/27/2005? | return on 5/27/2005 refers to return_date = '2005-05-27'; rental refers to rental_id | SELECT COUNT(rental_id) FROM rental WHERE rental_date = '2005-05-27' | 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... |
social_media | For the tweet which got the most likes, state the gender of the user who tweeted it. | most likes refers to Max(Likes) | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1 | 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 | What is the brand of the device used by the youngest female user? | brand of the device refers to phone_brand; youngest refers to MIN(age); female refers to gender = 'F'; | SELECT phone_brand FROM phone_brand_device_model2 WHERE device_id IN ( SELECT * FROM ( SELECT device_id FROM gender_age WHERE gender = 'F' ORDER BY age LIMIT 1 ) AS T ) | 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... |
mondial_geo | Among the countries with more than 3% population growth rate, state the country name in full along with its GDP. | Population_growth = 3 means 3% population growth rate | SELECT T1.Name, T3.GDP FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T2.Country WHERE T2.Population_Growth > 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... |
beer_factory | Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243? | in bottles refers to ContainerType = 'Bottle'; location 38.559615, -121.42243 refers to latitude = 38.559615 AND longitude = -121.42243; | SELECT COUNT(T4.BrandID) FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID INNER JOIN rootbeer AS T4 ON T1.RootBeerID = T4.RootBeerID WHERE T2.Latitude = 38.559615 AND T2.Longitude = -121.42243 AND T4.ContainerType = 'Bottle... | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
sales_in_weather | Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014? | weather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100 | SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%' | 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... |
public_review_platform | What is the review length of user 11021 to business with business ID 3? | review length refers to review_length; user 11021 refers to user_id = 11021; business ID 3 refers to business_id = 3 | SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3 | 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 | Among the independent countries whose type of government is republic, what is the biggest number of deserts they have? | SELECT COUNT(T3.Desert) FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN geo_desert AS T3 ON T3.Country = T2.Country WHERE T2.Government = 'republic' | 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... | |
regional_sales | What percentage of sell orders on 04/04/2020 were for the state of New York? | sales order on 04/04/2020 refers to OrderDate = '4/4/20'; 'New York' is the City Name; percentage = Divide (Sum(OrderNumber where City Name = 'New York'), Count (OrderNumber)) * 100 | SELECT CAST(SUM(CASE WHEN T2.State = 'New York' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate = '4/4/20' | 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
... |
donor | Which resource type is commonly bought by the Los Angeles Unified School District? | resource type refer to project_resource_type; most commonly bought refer to COUNT(project_resource_type where school_district = ’Los Angeles Unif Sch Dist’); Los Angeles Unified School District refer to school_district = ’Los Angeles Unif Sch Dist’ | SELECT T1.project_resource_type FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T2.school_district = 'Los Angeles Unif Sch Dist' GROUP BY T2.school_district ORDER BY COUNT(T1.project_resource_type) DESC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS "essays"
(
projectid TEXT,
teacher_acctid TEXT,
title TEXT,
short_description TEXT,
need_statement TEXT,
essay TEXT
);
CREATE TABLE IF NOT EXISTS "projects"
(
projectid ... |
mondial_geo | Which country became independent on 1492-01-01? Give the full name of the country. | SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1492-01-01' | 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... | |
soccer_2016 | Who is the youngest player and which city did he/she come from? | youngest player refers to MIN(DOB); city refers to City_Name | SELECT T3.City_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_Id INNER JOIN City AS T3 ON T2.Country_Id = T3.Country_Id ORDER BY T1.DOB 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... |
movie_3 | What are the last updated date for English film titles that were released in 2006? | the last updated date refers to last_update; English is name of language; released in 2006 refers to release_year = 2006
| SELECT DISTINCT T1.last_update FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T2.`name` = 'English' AND T1.release_year = 2006 | 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... |
computer_student | How many people teaches course no.11? | people refers to taughtBy.p_id; course no.11 refers to course_id = 11 | SELECT COUNT(*) FROM taughtBy WHERE course_id = 11 | 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 ... |
retails | List all the dates of the urgent orders. | date refers to o_orderdate; urgent order refers to o_orderpriority = '1-URGENT' | SELECT o_orderdate FROM orders WHERE o_orderpriority = '1-URGENT' | 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`),... |
hockey | For the coach who co-coached with Dave Lewis in 1998, where was his birth place? | co-coached refers to notes = 'co-coach'; birth place refers to 'birthCountry-birthState-birthCity' | SELECT T1.birthCountry FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1998 AND T2.notes = 'co-coach with Dave Lewis' | 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 ... |
works_cycles | Give the Mauritius Rupee's currency code. | Mauritius Rupee is name of currency | SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee' | 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
... |
student_loan | How many of the unemployed students are disabled? | SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN disabled 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... | |
college_completion | Give the name of the 4-year public school in "ID" with the lowest graduation 100 value. | name of the school refers to chronname; 4-year refers to level = '4-year'; public refers to control = 'Public'; ID refers to state_abbr = 'ID'; lowest graduation 100 value refers to MIN(grad_100_value); | SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'ID' AND T1.level = '4-year' AND T1.control = 'Public' GROUP BY T1.chronname ORDER BY SUM(T1.grad_100_value) ASC LIMIT 1 | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
hockey | For the goalie whose legendsID is "P196402" , how many games did he play in the league? | SELECT SUM(T1.GP) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.legendsID = 'P196402' | 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 ... | |
regional_sales | At what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times? | WARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode)) | SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.WarehouseCode = 'WARE-PUJ1005' GROUP BY T2.StoreID ORDER BY COUNT(T1.WarehouseCode) 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
... |
college_completion | Between the Ivy League Schools, which school's state have the lowest sate appropriations to higher education in fiscal year 2011 per resident? | Ivy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; ... | SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) GROUP ... | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
mondial_geo | For all cities where Seine is located at, which city has the greatest population? Calculate the difference from the city with least population. | Seince is a river; Population disparity refers to difference between cities with greatest and least population; Difference between cities with greatest and least population means max(population) - min(population) | SELECT MAX(T1.Population) - MIN(T1.population) FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = 'Seine' | 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... |
address | Provide the countries and the zip codes in the Virgin Islands. | the Virgin Islands refer to state where name = 'Virgin Islands'; | SELECT T2.county, T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virgin Islands' | 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 ... |
shakespeare | In Act 1 Scene 2 of the Twelfth Night, what is the total number of of lines said by Viola? | Twelfth Night refers to Title = 'Twelfth Night'; total number of lines said by Viola refers to count(character_id) where CharName = 'Viola' | SELECT COUNT(T4.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T2.Act = 1 AND T2.Scene = 2 AND T4.id = 1238 AND T4.CharName = 'Viola' AND T1.Title = 'Twelfth Night' | 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 | How many territories are there in the region with the highest number of territories? | highest number of territories refers to max(TerritoryID) | SELECT COUNT(T2.RegionDescription), T1.TerritoryDescription, COUNT(*) AS num FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID GROUP BY T1.TerritoryDescription ORDER BY num 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,
... |
video_games | What is the genre of the game "Grand Theft Auto V"? | genre refers to genre_name; "Grand Theft Auto V" refers to game_name = 'Grand Theft Auto V'; | SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = 'Grand Theft Auto V' | 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... |
donor | How many students will be impacted for the Fit Firsties! Project? | how many students refers to students_reached; Fit Firsties! project refers to title = 'Fit Firsties!' | SELECT T2.students_reached FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.title LIKE 'Fit Firsties!' | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS "essays"
(
projectid TEXT,
teacher_acctid TEXT,
title TEXT,
short_description TEXT,
need_statement TEXT,
essay TEXT
);
CREATE TABLE IF NOT EXISTS "projects"
(
projectid ... |
works_cycles | How many employees in the Information Service department work the evening shift? | Information Service is a name of department; | SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN Shift AS T3 ON T2.ShiftId = T3.ShiftId WHERE T1.Name = 'Information Services' AND T3.Name = 'Evening' | 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
... |
european_football_1 | Please list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season. | Bundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory; | SELECT DISTINCT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' AND T2.name = 'Bundesliga' | CREATE TABLE divisions
(
division TEXT not null
primary key,
name TEXT,
country TEXT
);
CREATE TABLE matchs
(
Div TEXT,
Date DATE,
HomeTeam TEXT,
AwayTeam TEXT,
FTHG INTEGER,
FTAG INTEGER,
FTR TEXT,
season INTEGER,
foreign key (Div) re... |
retails | Give the phone number of the customer with the highest account balance. | phone number of the customer refers to c_phone; the highest account balance refers to MAX(c_acctbal); | SELECT c_phone FROM customer ORDER BY c_acctbal DESC LIMIT 1 | 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`),... |
menu | Which dish has the highest price on the menu "Zentral Theater Terrace"? Please give its name. | highest price refers to MAX(Price); Zentral Theater Terrace is a name of menu; | SELECT T4.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.name = 'Zentral Theater Terrace' ORDER BY T1.price DESC LIMIT 1 | 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 ... |
image_and_language | Which image has the highest number of "white" class attributes? | "white" class attributes refers to ATT_CLASS = 'white'; highest number refers to max(count(ATT_CLASS_ID)) | SELECT T1.IMG_ID AS IMGID FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.ATT_CLASS = 'white' GROUP BY T1.IMG_ID ORDER BY COUNT(T1.ATT_CLASS_ID) DESC LIMIT 1 | CREATE TABLE ATT_CLASSES
(
ATT_CLASS_ID INTEGER default 0 not null
primary key,
ATT_CLASS TEXT not null
);
CREATE TABLE OBJ_CLASSES
(
OBJ_CLASS_ID INTEGER default 0 not null
primary key,
OBJ_CLASS TEXT not null
);
CREATE TABLE IMG_OBJ
(
IMG_ID INTEGER default 0... |
restaurant | Which county and region does the street E. El Camino Real belong to? | street E. El Camino Real refers to street_name = 'E. El Camino Real' | SELECT DISTINCT T2.county, T2.region FROM location AS T1 INNER JOIN geographic AS T2 ON T1.city = T2.city WHERE T1.street_name = 'E. El Camino Real' | 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... |
regional_sales | Which sales team id has the highest number of orders in 2018? | the highest number of orders in 2018 refers to MAX(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')); | SELECT _SalesTeamID FROM `Sales Orders` WHERE OrderDate LIKE '%/%/18' GROUP BY _SalesTeamID ORDER BY COUNT(_SalesTeamID) DESC 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
... |
ice_hockey_draft | List the name of players who have a height over 5'9. | names of players refers to PlayerName; height over 5'9 refers to height_in_inch > '5''9"'; | SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T2.height_in_inch > '5''9"' | CREATE TABLE height_info
(
height_id INTEGER
primary key,
height_in_cm INTEGER,
height_in_inch TEXT
);
CREATE TABLE weight_info
(
weight_id INTEGER
primary key,
weight_in_kg INTEGER,
weight_in_lbs INTEGER
);
CREATE TABLE PlayerInfo
(
ELITEID INTE... |
computer_student | How many non-faculty members are not undergoing the phase of qualifications? | non-faculty members refers to hasPosition = 0; are not undergoing the phase of qualifications refers to inPhase = 0 | SELECT COUNT(*) FROM person WHERE hasPosition = 0 AND inPhase = 0 | 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 ... |
ice_hockey_draft | Which team has the most Swedish? | Swedish refers to nation = 'Sweden'; team with the most Swedish refers to MAX(TEAM WHERE nation = 'Sweden'); | SELECT T.TEAM FROM ( SELECT T2.TEAM, COUNT(DISTINCT T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.nation = 'Sweden' GROUP BY T2.TEAM ORDER BY COUNT(DISTINCT T1.ELITEID) DESC LIMIT 1 ) AS T | CREATE TABLE height_info
(
height_id INTEGER
primary key,
height_in_cm INTEGER,
height_in_inch TEXT
);
CREATE TABLE weight_info
(
weight_id INTEGER
primary key,
weight_in_kg INTEGER,
weight_in_lbs INTEGER
);
CREATE TABLE PlayerInfo
(
ELITEID INTE... |
superstore | Provide the shipping dates and products of the orders by Gene Hale. | Gene Hale' refers to "Customer Name"; shipping date refers to "Ship Date"; products refers to "Product Name" | SELECT DISTINCT T2.`Ship Date`, T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Gene Hale' | 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... |
professional_basketball | In what year did the only team to beat the Houston in the final round of postseason series games earn its lowest ranking? | beat the Huston refers to tmIDLoser = 'HSM'; in final round of post season refers to round = 'DSF' | SELECT T2.year FROM series_post AS T1 INNER JOIN teams AS T2 ON T1.tmIDWinner = T2.tmID WHERE T1.round = 'DSF' AND T1.tmIDLoser = 'HSM' ORDER BY T2.rank ASC LIMIT 1 | 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... |
cars | How many times was Ford Maverick introduced to the market? | Ford Maverick refers to car_name = 'ford maverick'; | SELECT COUNT(T2.model_year) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'ford maverick' | 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... |
professional_basketball | Who is the tallest player in Denver Nuggets since 1980? | "Denver Nuggets" is the name of team; since 1980 refers to year > 1980; tallest player = Max(height) | SELECT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T3.name = 'Denver Nuggets' AND T2.year > 1980 ORDER BY T1.height DESC LIMIT 1 | 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... |
movie_platform | What's the description for the movie list "Short and pretty damn sweet"? | Short and pretty damn sweet is list_title; description refers to list_description; | SELECT list_description FROM lists WHERE list_title = 'Short and pretty damn sweet' | 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... |
law_episode | Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards? | episode refers to award; the Primetime Emmy Awards refers to award_category like 'Primetime Emmy' | SELECT DISTINCT episode_id FROM Award WHERE award_category = 'Primetime Emmy' | 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 ... |
retail_complains | Please calculate the number of clients by each division. | SELECT T2.division, COUNT(T2.division) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id GROUP BY T2.division | 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... | |
cs_semester | For the professors who advise more than 2 students, which professor has a higher teaching ability? Give the full name. | professor advising more than 2 students refers to COUNT(student_id) > 2; higher teachability refers to MAX(teachingability); full name refers to f_name and l_name; | SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, T2.teachingability FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id HAVING COUNT(student_id) > 2 ) T ORDER BY T.teachingability 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... |
mondial_geo | What are the names of the rivers in Canada? | SELECT DISTINCT T1.River FROM located AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Canada' AND T1.River IS NOT NULL | 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... | |
software_company | What is the age of female customers within the number of inhabitants below 30? | female customers within the number of inhabitants below 30 refer to SEX = 'Female' where INHABITANTS_K < 30; | SELECT age FROM Customers WHERE GEOID IN ( SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 ) AND SEX = 'Female' | 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,
... |
software_company | What is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing? | male customers ages from 20 to 30 years old refer to SEX = 'Male' where age BETWEEN 20 AND 30; farming or fishing refers to OCCUPATION; number of inhabitants refers to INHABITANTS_K; | SELECT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30 | 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,
... |
chicago_crime | Give the coordinate of the alleys where a crime was reported and an arrest was made. | coordinate refers to latitude, longitude; alley refers to location_description = 'ALLEY'; an arrest was made refers to arrest = 'TRUE' | SELECT latitude, longitude FROM Crime WHERE location_description = 'ALLEY' AND arrest = 'TRUE' GROUP BY latitude, longitude | 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 ... |
human_resources | What is the education required for David Whitehead to reach his current position? | David Whitehead is the full name of an employee; full name = firstname, lastname | SELECT T2.educationrequired FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'David' AND T1.lastname = 'Whitehead' AND T1.gender = 'M' | CREATE TABLE location
(
locationID INTEGER
constraint location_pk
primary key,
locationcity TEXT,
address TEXT,
state TEXT,
zipcode INTEGER,
officephone TEXT
);
CREATE TABLE position
(
positionID INTEGER
constraint position_pk
... |
public_review_platform | How many "Good for Kids" Yelp_Businesses are open everyday of the week? | Good for Kids refers to attribute_name = 'Good for Kids'and attribute_value = 'true'; open everyday refers to day_id between 1 and 7 | 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_Attributes AS T3 ON T1.business_id = T3.business_id INNER JOIN Attributes AS T4 ON T4.attribute_id = T4.attribute_id WHERE T2.day_id IN (1, 2, 3, 4, 5, 6, 7) AND T4.attribute_name = 'Good for Kids' ... | 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 ... |
synthea | How many patients immunized against 'monovalent rotavirus' ceased their care plan on 11/23/2013? | immunized against monovalent rotavirus refers to immunizations.DESCRIPTION = 'rotavirus monovalent'; ceased their care plan on 11/23/2013 refers to careplans.STOP = '2013-11-23'; | SELECT COUNT(DISTINCT T1.patient) FROM careplans AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'rotavirus monovalent' AND T1.STOP = '2013-11-23' | 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
... |
public_review_platform | How many businesses are with high review count? | high review count refers to review_count = 'High' | SELECT COUNT(business_id) FROM Business WHERE review_count LIKE '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 ... |
bike_share_1 | In 2015, what percentage of trips that had the subscription type was Customer and ended on a rainy day? | in 2015 refers to end_date like '%2015%'; percentage = DIVIDE(COUNT(events = 'Rain'), COUNT(events)); | SELECT CAST(SUM(CASE WHEN T2.events = 'Rain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2015' AND T1.subscription_type = 'Customer' | 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... |
address | Name 10 cities with their states that are under the Lexington-Fayette, KY office of the Canada Border Services Agency. | "Lexington-Fayette, KY" is the CBSA_name | SELECT DISTINCT T2.city, T2.state FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Lexington-Fayette, KY' LIMIT 10 | 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 ... |
professional_basketball | Please list the first names of the players with the most personal fouls in the 'NBL' league. | "NBL" is the lgID; most personal foul refers to Max(Count(PF)) | SELECT T1.firstName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.lgID = 'NBL' GROUP BY T1.playerID, T1.firstName ORDER BY COUNT(PF) DESC LIMIT 1 | 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... |
world | Among the languages used in Baltic Countries, provide the languages which are used by over 80%.
| Baltic Countries refers to Region = 'Baltic Countries'; languages which are used by over 80% refers to Percentage > 80; | SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Region = 'Baltic Countries' AND T2.Percentage > 80 | 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... |
world | What are the official languages used in Belgium? | official languages refers to IsOfficial = 'T'; Belgium is a name of country; | SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Belgium' AND T2.IsOfficial = 'T' | 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... |
soccer_2016 | Provide the country ID of East London. | East London refers to City_Name = 'East London' | SELECT Country_id FROM City WHERE City_Name = 'East London' | 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... |
address | What is the state for area code of 787? | SELECT DISTINCT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787 | 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 ... | |
coinmarketcap | State the transaction date whereby DigixDAO was transacted at the hightest price. | the highest price refers to max(price); DigixDAO refers to name = 'DigixDAO' | SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1 | CREATE TABLE coins
(
id INTEGER not null
primary key,
name TEXT,
slug TEXT,
symbol TEXT,
status TEXT,
category TEXT,
description TEXT,
subreddit TEXT,
notice TEXT,
tags TEXT,
tag_names TEXT,
... |
public_review_platform | Who has got the most number of "funny" type of compliments? Give the user ID. | type of compliments refers to compliment_type; most number of funny type of compliments refers to MAX(COUNT(number of compliments = 'high' WHERE compliment_type = 'funny')); | SELECT user_id FROM Users_Compliments WHERE compliment_id IN ( SELECT compliment_id FROM Compliments WHERE compliment_type LIKE 'funny' ) | 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 ... |
car_retails | How do I contact the President of the company? | President refers to the jobTitle; | SELECT t.email FROM employees t WHERE t.jobTitle = 'President' | 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... |
video_games | How many role-playing games are there? | role-playing game refers to genre_name = 'Role-Playing' | SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Role-Playing' | 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... |
shipping | List the driver's name of the shipment with a weight greater than 95% of the average weight of all shipments. | weight greater than 95% of average weight refers to weight > Multiply (AVG(weight), 0.95); driver name refers to first_name, last_name | SELECT T2.first_name, T2.last_name FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.weight * 100 > ( SELECT 95 * AVG(weight) FROM shipment ) | 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... |
mondial_geo | How many more people speak English than speak Scottish in United Kingdom? | English and Scottish are two languages; United Kingdom is a country | SELECT T3.Population * (T2.Percentage - T1.Percentage) FROM ethnicGroup AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T1.Country = T3.Code WHERE T1.Name = 'Scottish' AND T2.Name = 'English' AND T3.Name = 'United Kingdom' | 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... |
regional_sales | What is the average household income of Glendale? | "Glendale" is the City Name; Average household income refers to avg(Household Income) | SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale' | 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
... |
car_retails | List out full name of employees who are working in Tokyo? | Tokyo is a city; full name = firstName+lastName; | SELECT T1.firstName, T1.lastName FROM employees AS T1 INNER JOIN offices AS T2 ON T1.officeCode = T2.officeCode WHERE T2.city = 'Tokyo' | 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... |
university | Show the name of country id 66. | name of country refers to country_name | SELECT country_name FROM country WHERE id = 66 | 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
... |
movies_4 | For all the movies which were produced by Cruel and Unusual Films, which one has the most popularity? | produced by Cruel and Unusual Films refers to company_name = 'Cruel and Unusual Films'; most popularity refers to max(popularity) | SELECT T3.title 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 T1.company_name = 'Cruel and Unusual Films' ORDER BY T3.popularity DESC LIMIT 1 | 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
(
... |
simpson_episodes | How many awards did simpson 20 won in 2009? | won refers to result = 'Winner'; in 2009 refers to year = 2009 | SELECT COUNT(award_id) FROM Award WHERE SUBSTR(year, 1, 4) = '2009' AND result = 'Winner'; | 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,
... |
retails | Which nation and region does the Customer#000000008 come from? | nation refers to n_name; region refers to r_name; Customer#000000008 refers to c_name = 'Customer#000000008' | SELECT T1.n_name, T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_name = 'Customer#000000008' | 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`),... |
disney | List the movie titles directed by Jack Kinney. | Jack Kinney refers to director = 'Jack Kinney'; | SELECT name FROM director WHERE director = 'Jack Kinney' | 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... |
retails | Which country has the least number of suppliers? | country refers to n_name; the least number of suppliers refers to min(count(s_name)) | SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) LIMIT 1 | 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`),... |
olympics | In which city was the game held where the oldest competitor participated? | in which city refers to city_name; the oldest refers to MAX(age); | SELECT T4.city_name FROM games_competitor AS T1 INNER JOIN games AS T2 ON T1.games_id = T2.id INNER JOIN games_city AS T3 ON T1.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id ORDER BY T1.age DESC LIMIT 1 | 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... |
cars | List the car's name with a price worth greater than 85% of the average price of all cars. | car's name refers to car_name; a price worth greater than 85% of the average price of all cars refers to price > multiply(avg(price), 0.85) | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T2.price * 100 > ( SELECT AVG(price) * 85 FROM price ) | 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... |
codebase_comments | What is the url for repository that has the longest processed time solution? | Url for repository refers to Url; longest processed toe trefers to MAX(ProcessedTime); | SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.ProcessedTime = ( SELECT MAX(ProcessedTime) FROM Solution ) | 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... |
social_media | Among all the tweets with a positive sentiment, what is the percentage of those posted by a male user? | positive sentiment refers to Sentiment > 0; male user refers to Gender = 'Male'; percentage = Divide (Count(TweetID where Gender = 'Male'), Count (TweetID)) * 100 | SELECT SUM(CASE WHEN T2.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS per FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Sentiment > 0 | 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
(
... |
retail_world | Which region does Hoffman Estates belong to? | Hoffman Estates refer to TerritoryDescription; | SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryDescription = 'Hoffman Estates' | 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,
... |
retails | Calculate the percentage of countries that belong to the American region. | the American region refers to r_name = 'America'; percentage = divide(count(n_name where r_name = 'America'), count(n_name)) * 100% | SELECT CAST(SUM(IIF(T1.r_name = 'America', 1, 0)) AS REAL) * 100 / COUNT(T2.n_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey | 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`),... |
retail_world | How many orders was handled by employees who reported to employee id 5? | reported to employee id 5 refers to ReportsTo = 5 | SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.ReportsTo = 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,
... |
books | List the email of customers that bought the book titled Switch on the Night. | "Switch on the Night" is the title | SELECT T4.email FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Switch on the Night' | 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... |
world_development_indicators | How many countries uses the 1968 System of National Accounts methodology? | uses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology' | SELECT COUNT(CountryCode) FROM Country WHERE SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
legislator | Give the YouTube ID of the channel 'RepWassermanSchultz.' | RepWassermanSchultz refers to youtube | SELECT youtube_id FROM `social-media` WHERE youtube = 'RepWassermanSchultz' | 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 ... |
menu | On the menu with the most dishes, how many dishes were there on its second page? | menu with the most dishes refers to menu.id with MAX(dish_count); second page refers to page_number = 2; | SELECT COUNT(T1.dish_id) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.page_number = 2 GROUP BY T3.name ORDER BY T3.dish_count DESC LIMIT 1 | 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 ... |
shooting | What is the most common type of weapon that causes death? | the most common type of weapon refers to max(count(subject_weapon)); causes death refers to subject_statuses = 'Deceased' | SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY COUNT(case_number) DESC LIMIT 1 | CREATE TABLE incidents
(
case_number TEXT not null
primary key,
date DATE not null,
location TEXT not null,
subject_statuses TEXT not null,
subject_weapon TEXT not null,
subjects T... |
cs_semester | List the student's first and last name that got a C in the course named "Applied Deep Learning". | student's first name refers to f_name; student's last name refers to l_name; got a C refers to grade = 'C'; | SELECT T1.f_name, T1.l_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 T3.name = 'Applied Deep Learning ' AND T2.grade = 'C' | 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... |
retail_world | How many sales values have been created by sales representative and which sales representative have the highest sales? | sales representative refers to Title = 'Sales Representative'; sales values refers to MULTIPLY(Quantity, UnitPrice); the highest sales refers to max(MULTIPLY(Quantity, UnitPrice)) | SELECT SUM(T3.UnitPrice * T3.Quantity) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.Title = 'Sales Representative' ORDER BY SUM(T3.UnitPrice * T3.Quantity) | 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,
... |
ice_hockey_draft | Identify the name and position of the player who has committed the most rule violations. | name of the player refers to PlayerName; position of the player refers to position_info; committed the most rule violations refers to MAX(PIM); | SELECT T2.PlayerName, T2.position_info FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.PIM = ( SELECT MAX(PIM) FROM SeasonStatus ) | CREATE TABLE height_info
(
height_id INTEGER
primary key,
height_in_cm INTEGER,
height_in_inch TEXT
);
CREATE TABLE weight_info
(
weight_id INTEGER
primary key,
weight_in_kg INTEGER,
weight_in_lbs INTEGER
);
CREATE TABLE PlayerInfo
(
ELITEID INTE... |
university | What are the names of the top 5 universities with the highest number of international students? | highest number of international students refers to MAX(DIVIDE(MULTIPLY(num_students, pct_international_students), 100)); name of university refers to university_name; | SELECT DISTINCT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY (CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) DESC LIMIT 5 | 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 | List the names of the stations within Mountain View that were installed on 12/31/2013. | Mountain View refers to city = 'Mountain View'; installed on 12/31/2013 refers to installation_date = '12/31/2013'; | SELECT name FROM station WHERE installation_date = '12/31/2013' AND city = 'Mountain View' | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.