db_id stringclasses 69
values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringclasses 69
values |
|---|---|---|---|---|
image_and_language | List all the IDs of images that have objects with the attributes of 'wired'. | IDs of images refer to IMG_ID; objects with the attributes of 'wired' refer to ATT_CLASS = 'wired'; | SELECT DISTINCT T2.IMG_ID FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'wired' | 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... |
world_development_indicators | What upper middle income country under East Asia & Pacific region which covers the topic about Social Protection & Labor: Migration
? Indicate the short name of the said country. | upper middle income country refers to incomegroup = 'Upper middle income' | SELECT DISTINCT T1.ShortName FROM Country AS T1 INNER JOIN footnotes AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.IncomeGroup = 'Upper middle income' AND T1.Region = 'East Asia & Pacific' AND T3.Topic = 'Social Protection & Labor: Migration' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
image_and_language | Count the number of 'dress' object classes and include their X and Y coordinates in image ID 1764. | dress' object classes refer to OBJ_CLASS = 'dress'; image ID 1764 refers to IMG_ID = 1764; X and Y refer to coordinates of the bounding box; | SELECT T1.X, T1.Y FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1764 AND T2.OBJ_CLASS = 'dress' | 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... |
olympics | What are the names of the cities where Carl Lewis Borack competed? | name of the cities refers to city_name | SELECT T4.city_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T1.full_name = 'Carl Lewis Borack' | 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... |
sales_in_weather | What was the average temperature differences during May 2012 for store number 6 and 7? | during May 2012 refers to SUBSTR(date, 1, 7) = '2012-05'; store number 6 refers to store_nbr = 6; store number 7 refers to store_nbr = 7; average temperature difference = Subtract (Divide (Sum(tavg), Count (date) where the store_nbr = 6), Divide (Sum(tavg), Count(date) where store_nbr = 7)) | SELECT ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr AND T1.`date` LIKE '%2012-05%' AND T2.store_nbr = 6 ) - ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr... | 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... |
mondial_geo | Which nations have a 100% Spanish-speaking population? | SELECT Country FROM language WHERE Name = 'Spanish' AND Percentage = 100 | 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... | |
synthea | Provide the body weight of Elly Koss in every observation. | body weight VALUE and UNITS where DESCRIPTION = 'Body Weight' from observations; | SELECT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.DESCRIPTION = 'Body Weight' | 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
... |
image_and_language | What is the average difference in the y coordinate of 2 object samples with the relation "parked on" in image no.1? | relation "parked on" refers to PRED_CLASS = 'parked on'; image no.1 refers to IMG_ID = 1; average difference in the y coordinate = divide(sum(Y), count(PRED_CLASS)) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID | SELECT CAST(SUM(T3.Y) AS REAL) / COUNT(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE NULL END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID | 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... |
synthea | How many black patients stopped their care plan in 2017? | black refers to race = 'black'; stopped their care plan in 2017 refers to substr(careplans.STOP, 1, 4) = '2017'; | SELECT COUNT(DISTINCT T2.patient) FROM careplans AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.race = 'black' AND strftime('%Y', T1.STOP) = '2017' | 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
... |
music_platform_2 | What are the titles of the podcasts whose reviews were created between 2018-08-22T11:53:16-07:00 and 2018-11-20T11:14:20-07:00? | created between 2018-08-22T11:53:16-07:00 and 2018-11-20T11:14:20-07:00 refers to created at BETWEEN '2018-08-22T11:53:16-07:00' and '2018-11-20T11:14:20-07:00' | SELECT DISTINCT T1.title FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.created_at BETWEEN '2018-08-22T11:53:16-07:00' AND '2018-11-20T11:14:20-07:00' | CREATE TABLE runs (
run_at text not null,
max_rowid integer not null,
reviews_added integer not null
);
CREATE TABLE podcasts (
podcast_id text primary key,
itunes_id integer not null,
slug text not null,
itunes_url text not null,
title text not null
... |
movie_platform | List all movie title rated in April 2020 from user who was a trialist. | movie title rated in April 2020 refers to rating_timestamp_utc LIKE '%2020-04-%'; user is a trial list refers to user_trialist = 1; | SELECT T1.movie_title FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_trialist = 1 AND T2.rating_timestamp_utc LIKE '2020-04%' | 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... |
retail_world | Please list the full names and titles of all employees. | full name refers to LastName, FirstName | SELECT FirstName, LastName, Title FROM Employees | 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,
... |
world_development_indicators | On which years did Aruba got a footnote on the series code AG.LND.FRST.K2? | Aruba is the name of country where ShortName = 'Aruba' | SELECT T2.Year 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' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
works_cycles | What is the discount percentage of "LL Road Frame Sale"? | discount percentage refers to DiscountPct; LL Road Frame Sale is a description of special offer; | SELECT DiscountPct FROM SpecialOffer WHERE Description = 'LL Road Frame Sale' | 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 | For how many terms have the oldest current legislator served? | oldest legislator refers to MIN(birthday_bio); | SELECT COUNT(T2.bioguide) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = ( SELECT MIN(birthday_bio) FROM current ) | 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 ... |
movie_3 | Which category is the most common? | most common category refers to MAX(COUNT(category.name)) | SELECT T.name FROM ( SELECT T2.name, COUNT(T2.name) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1 | CREATE TABLE film_text
(
film_id INTEGER not null
primary key,
title TEXT not null,
description TEXT null
);
CREATE TABLE IF NOT EXISTS "actor"
(
actor_id INTEGER
primary key autoincrement,
first_name TEXT not null,
last_nam... |
movie_platform | Among all movies in the list, calculate the percentage of movies that were never been rated? | percentage of movies that were never been rated refers to DIVIDE(COUNT(main_movies.movie_id ! = main_ratings.movie_id),COUNT(movie_id)) | SELECT CAST(SUM(CASE WHEN T2.movie_id IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.movie_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id | 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... |
hockey | State the goalie who has the lowest percentage of goals against among all the shots against recorded. Name the players and season where he played. | goals against refers to GA; shots against refers to SA; lowest percentage of goals against among all the shots against refers to MIN(DIVIDE(GA,SA)*100) | SELECT T1.firstName, T1.lastName, T2.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE CAST(T2.GA AS REAL) / T2.SA IS NOT NULL ORDER BY CAST(T2.GA AS REAL) / T2.SA 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 ... |
shipping | How many shipments were shipped by the driver named Zachary Hicks? | SELECT COUNT(*) FROM shipment AS T1 INNER JOIN driver AS T2 ON T1.driver_id = T2.driver_id WHERE T1.driver_id = 23 | 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... | |
public_review_platform | How many Yelp businesses are there in 'AZ' with less than "3" stars? | AZ refers to state = 'AZ'; stars < 3; | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars < 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 ... |
world_development_indicators | What are the special notes for the country whose average adolescent fertility rate is the highest? | the average adolescent fertility rate is DIVIDE(SUM(value), SUM(IndicatorName like 'adolescent fertility rate%')); MAX(average adolescent fertility rate) | SELECT DISTINCT T1.SpecialNotes FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Value = ( SELECT Value FROM Indicators WHERE IndicatorName LIKE 'Adolescent fertility rate%' ORDER BY Value DESC LIMIT 1 ) | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
car_retails | For the planes which has the hightest total price, how much it exceeds the average? | plane is a product line; total price = MULTIPLY(quantityOrdered, priceEach); how much the total price exceeds the average = SUBTRACT(MAX(MULTIPLY(quantityOrdered, priceEach))), AVG(priceEach)); | SELECT MAX(quantityOrdered * priceEach) - AVG(priceEach) FROM orderdetails WHERE productCode IN ( SELECT productCode FROM products WHERE productLine = 'Planes' ) | CREATE TABLE offices
(
officeCode TEXT not null
primary key,
city TEXT not null,
phone TEXT not null,
addressLine1 TEXT not null,
addressLine2 TEXT,
state TEXT,
country TEXT not null,
postalCode TEXT not null,
territory TEXT not null
);
CREATE... |
books | Which books were released by Orson Scott Card in 2001? | "Orson Scott Card" is the author_name; released in 2001 refers to publication_date LIKE '2001%'; books refers to title | SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Orson Scott Card' AND STRFTIME('%Y', T1.publication_date) = '2001' | 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... |
mondial_geo | Which two countries does the Detroit River flow through? Give the full name of the country. | SELECT T3.Name FROM located AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country WHERE T2.Name = 'Detroit River' | 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... | |
sales_in_weather | How many units of item no.9 were sold in store no.1 on 2012/1/1? | store no. 1 refers to store_nbr = 1; item no. 9 refers to item_nbr = 9; on 2012/1/1 refers to date = '2012-01-01' | SELECT units FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 AND item_nbr = 9 | 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... |
simpson_episodes | List down the rating of episodes that were produced by Jason Bikowski. | produced by Jason Bikowski refers to person = 'Jason Bikowski' | SELECT T1.rating FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Jason Bikowski'; | 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,
... |
beer_factory | Calculate the total purchases made by customers using their Visa credit cards in the Sac State American River Courtyard between 6/3/2014 and 11/27/2015. | total purchases = SUM(PurchasePrice); Visa credit card refers to CreditCardType = 'Visa'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; between 6/3/2014 and 11/27/2015 refers to TransactionDate BETWEEN '2014-06-03' AND '2015-11-27'; | SELECT SUM(T1.PurchasePrice) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'Visa' AND T1.TransactionDate BETWEEN '2014-06-03' AND '2015-11-27' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
college_completion | Among the states that start with letter A and attained a national sector average of 16.5, give the number of degree-seeking students in the cohort of those students in 2012 . | state that starts with letter A refers to state LIKE 'A%'; national sector average of 16.5 refers to awards_per_natl_value = 16.5; number of degree-seeking students in the cohort refers to grad_cohort; in 2012 refers to year = '2012'; | SELECT SUM(T2.grad_cohort) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.state LIKE 'A%' AND T1.awards_per_natl_value = 16.5 AND T2.year = 2012 | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
shooting | For case number '134472-2015', list the last name of the officers involved and state the subject statuses. | SELECT T2.last_name, T1.subject_statuses FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '134472-2015' | 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... | |
authors | Write down the author name, affiliation, jounal short name and full name of the paper "Decreased Saliva Secretion and Down-Regulation of AQP5 in Submandibular Gland in Irradiated Rats". | "Decreased Saliva Secretion and Down-Regulation of AQP5 in Submandibular Gland in Irradiated Rats" is the Title of paper | SELECT T2.Name, T2.Affiliation, T3.ShortName, T3.FullName 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 T1.Title = 'Decreased Saliva Secretion and Down-Regulation of AQP5 in Submandibular Gland in Irradiated Rats' | 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... |
world_development_indicators | Find the countries in south Asia which are in the low-income group. What is the source of their recent income and expenditure data? List it alongside the table name of the countries. | South Asia is the name of the region; IncomeGroup = 'Low income'; | SELECT TableName, SourceOfMostRecentIncomeAndExpenditureData FROM Country WHERE Region = 'South Asia' AND IncomeGroup = 'Low income' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
professional_basketball | For team who has more home won than home lost more than 80%, list the team name and the offense points. | home won than home lost more than 80% refers to Divide(Subtract(homeWon, homeLost), games) > 0.8; offense point refers to o_fgm | SELECT name, o_pts FROM teams WHERE CAST((homeWon - homeLost) AS REAL) * 100 / games > 80 | 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... |
public_review_platform | How many active businesses are located at Phoenix, Arizona? | active business refers to active = 'true'; 'Phoenix' is the city | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'True' | 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 ... |
beer_factory | Find and list the full name and email of the customers who used American Express cards in Sac State Union. | full name = First, Last; American Express cards refers to CreditCardType = 'American Express'; Sac State Union refers to LocationName = 'Sac State Union'; | SELECT DISTINCT T1.First, T1.Last, T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.LocationName = 'Sac State Union' AND T2.CreditCardType = 'American Express' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
citeseer | List all words cited in the AI class label. | SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI' | CREATE TABLE cites
(
cited_paper_id TEXT not null,
citing_paper_id TEXT not null,
primary key (cited_paper_id, citing_paper_id)
);
CREATE TABLE paper
(
paper_id TEXT not null
primary key,
class_label TEXT not null
);
CREATE TABLE content
(
paper_id TEXT not null,
word_cited_... | |
retail_world | How much is the total purchase price, including freight, of the top 2 most expensive products? | total purchase price including freight refers to add(multiply(UnitPrice , Quantity) , Freight); most expensive refers to max(UnitPrice) | SELECT T2.UnitPrice * T2.Quantity + T1.Freight FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID ORDER BY T2.UnitPrice * T2.Quantity + T1.Freight DESC LIMIT 2 | 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,
... |
simpson_episodes | List down the episode ID of episodes aired in 2008 with 5 stars and below. | aired in 2008 refers to air_date LIKE '2008%'; 5 stars and below refers to stars < 5 | SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T2.stars < 5; | 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,
... |
food_inspection_2 | What is the job title of employee who did inspection ID 52269? | job title refers to title | SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52269 | 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... |
simpson_episodes | List all keywords associated with the episode 'Take My Life, Please'. | episode 'Take My Life, Please' refers to title = 'Take My Life, Please' | SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please'; | 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,
... |
legislator | What was current legislator Sherrod Brown's Washington, D.C. office phone number during his term starting on 2013/1/3? | Washington, DC office phone number refers to phone; terms starting on 2013/1/3 refers to start = '2013-01-03'; | SELECT T1.phone FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Sherrod Brown' AND T1.start = '2013-01-03' | 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 ... |
retail_world | Name all products supplied by Zaanse Snoepfabriek. | products refers to ProductName; 'Zaanse Snoepfabriek' is a CompanyName | SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Zaanse Snoepfabriek' | 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,
... |
talkingdata | Among the app users who were not active when event no.2 happened, how many of them belong to the category Property Industry 1.0? | not active refers to is_active = 0; event no. refers to event_id; event_id = 2; | SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id INNER JOIN app_events AS T3 ON T2.app_id = T3.app_id WHERE T3.is_active = 0 AND T1.category = 'Property Industry 1.0' AND T3.event_id = 2 | 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... |
human_resources | Please list the social security numbers of the male employees with a salary of over $70,000 a year. | social security numbers refers to ssn; male employees refers to gender = 'M'; salary of over $70,000 a year refers to salary > '70000' | SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000 | 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
... |
synthea | According to all the observations of Elly Koss, what was her average weight? | DIVIDE(SUM(VALUE), COUNT(VALUE)) WHERE DESCRIPTION = 'Body Weight'; | SELECT AVG(T2.VALUE), T2.units FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.description = 'Body Weight' | 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
... |
simpson_episodes | What was the first award won by the cast or crew member of the show? Give the name of the person who won the said award. | won refers to result = 'Winner'; first award refers to Min(year) | SELECT T2.award, T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Winner' ORDER BY T2.year LIMIT 1; | CREATE TABLE IF NOT EXISTS "Episode"
(
episode_id TEXT
constraint Episode_pk
primary key,
season INTEGER,
episode INTEGER,
number_in_series INTEGER,
title TEXT,
summary TEXT,
air_date TEXT,
episode_image TEXT,
... |
world_development_indicators | List the long name of countries with indicator name in 1980. | with any indicator name implies IndicatorName is not NULL; Year = '1980'; | SELECT DISTINCT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Year = 1980 AND T2.IndicatorName IS NOT NULL | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
restaurant | How many deli in Belmont have a review rating of 2 or more? | deli ris a food type; Belmont refers to city = 'belmont'; review rating of 2 or more refers to review > 2 | SELECT COUNT(id_restaurant) FROM generalinfo WHERE city = 'belmont' AND review > 2 AND food_type = 'deli' | 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... |
works_cycles | List all the work orders that is related to the Down Tube. | Down Tube is a name of a product; | SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube' | 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
... |
car_retails | Who is the sales agent of the distinct customer who paid the highest amount in the year 2004? | SELECT DISTINCT T3.lastName, T3.firstName FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN employees AS T3 ON T2.salesRepEmployeeNumber = T3.employeeNumber WHERE STRFTIME('%Y', T1.paymentDate) = '2004' ORDER BY T1.amount DESC LIMIT 1 | 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... | |
soccer_2016 | What is the average number of extra runs made as noballs? | noballs refers to Extra_Name = 'noballs' ; average number = divide(sum(Extra_Runs), count(Extra_Runs)) | SELECT AVG(T1.Extra_Runs) FROM Extra_Runs AS T1 INNER JOIN Extra_Type AS T2 ON T1.Extra_Type_Id = T2.Extra_Id WHERE T2.Extra_Name = 'noballs' | 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... |
disney | The song "Once Upon a Dream" is associated with the movie directed by whom? | directed by whom refers to director; movie refers to movie_title; | SELECT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.song = 'Once Upon a Dream' | 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... |
works_cycles | How many types of tax did the sales happen in Quebec have? | If Name = "+" in the value from SalesTaxRate, it means this sales are charged by multiple types of tax; Quebec refers to the name of State Province | SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec' | 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
... |
retails | How many orders in total have the customers in the household segment made? | orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; | SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD' | CREATE TABLE `customer` (
`c_custkey` INTEGER NOT NULL,
`c_mktsegment` TEXT DEFAULT NULL,
`c_nationkey` INTEGER DEFAULT NULL,
`c_name` TEXT DEFAULT NULL,
`c_address` TEXT DEFAULT NULL,
`c_phone` TEXT DEFAULT NULL,
`c_acctbal` REAL DEFAULT NULL,
`c_comment` TEXT DEFAULT NULL,
PRIMARY KEY (`c_custkey`),... |
menu | What dishes made their first and last appearances in 1855 and 1900, respectively? | first appearance in 1855 refers to first_appeared = 1855; last appearance in 1900 refers to last_appeared = 1900; | SELECT name FROM Dish WHERE first_appeared = 1855 AND last_appeared = 1900 | 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 ... |
superstore | What is the highest profit order in the East superstore of customers from Houston, Texas? | highest profit refers to max(Profit); Houston, Texas refers to City = 'Houston' and State = 'Texas' | SELECT T1.`Order ID` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.City = 'Houston' AND T2.State = 'Texas' ORDER BY T1.Profit DESC LIMIT 1 | 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... |
university | Show the name of the university with the lowest number of students in 2015. | lowest number of students refers to MIN(num_students); in 2015 refers to year = 2015; name of university refers to university_name; | SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students ASC LIMIT 1 | 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
... |
language_corpus | What is the word id of the catalan language that was repeated no more than 10 times in the said language? | word id refers to wid; repeated no more than 10 times refers to occurrences < = 10 | SELECT wid FROM langs_words WHERE occurrences <= 10 | CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0);
CREATE TABLE sqlite_s... |
donor | How many Rock Hill City School projects have teacher donors? | Rock Hill City School refers to school_city = 'Rock Hill'; teacher donors refers to is_teacher_acct = 't' | SELECT COUNT(DISTINCT T1.teacher_acctid) FROM projects AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T1.school_city = 'Rock Hill' AND is_teacher_acct = 't' | 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 ... |
legislator | Which current legislator is older, Sherrod Brown or Maria Cantwell? | older refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name | SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1 | 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 ... |
retails | What is the region with the most customers? | region refers to r_name; the most customers refers to max(count(c_custkey)) | SELECT T.r_name FROM ( SELECT T3.r_name, COUNT(T2.c_custkey) AS num 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 GROUP BY T3.r_name ) AS T ORDER BY T.num 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`),... |
cars | Calculate the difference between the number of cars that has a horsepower of 130 with the model year 1970 and model year 1976 | a horsepower of 130 refers to horsepower = 130; difference = subtract(count(ID where model_year = 1970), count(ID where model_year = 1976)) where horsepower = 130 | SELECT SUM(CASE WHEN T2.model_year = 1970 THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.model_year = 1976 THEN 1 ELSE 0 END) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID WHERE T1.horsepower = 130 | 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... |
hockey | Which year recorded the most number of goals by a player and how old was the player at the time the most number of goals was achieved by him? | most number of goals refers to max(G); how old refers to age = subtract(year(max(G)), birthYear) | SELECT T1.year, T1.year - T2.birthYear FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID GROUP BY T1.year, T1.year - T2.birthYear ORDER BY SUM(T1.G) 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 ... |
address | Provide the zip codes and area codes of the postal points with the community post office type at the elevation above 6000. | community post office type refers to type = 'Community Post Office'; elevation above 6000 refers to elevation > 6000; | SELECT T1.zip_code, T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Community Post Office ' AND T2.elevation > 6000 | 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 | How many field goals did George Mikan make overall between 1951 and 1953? | between 1951 and 1953 refers to season_id; field goal refers to fg_made | SELECT COUNT(fg_made) FROM player_allstar WHERE first_name = 'George' AND last_name = 'Mikan' AND season_id BETWEEN 1951 AND 1953 | 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... |
hockey | Please list the names of all the teams that have played against the Buffalo Sabres. | teams that have played against refer to oppID; Buffalo Sabres is the name of team; | SELECT DISTINCT T3.name FROM TeamVsTeam AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.oppID = T2.tmID INNER JOIN Teams AS T3 ON T1.year = T3.year AND T1.tmID = T3.tmID WHERE T2.name = 'Buffalo Sabres' | 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 ... |
language_corpus | Which Wikipedia page number has the highest number of words in the Catalan language? | Wikipedia page number refers to page; the highest number of words in the Catalan language refers to MAX(lid = 1); | SELECT page FROM pages WHERE words = ( SELECT MAX(words) FROM pages ) | CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT,
lang TEXT UNIQUE,
locale TEXT UNIQUE,
pages INTEGER DEFAULT 0, -- total pages in this language
words INTEGER DEFAULT 0);
CREATE TABLE sqlite_s... |
retail_world | What are the highest salary earn by the the employee and what is his/her position in the company? | highest salary refers to max(salary); position refers to Title | SELECT Salary, Title FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees ) | 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,
... |
superstore | How many orders of O'Sullivan Plantations 2-Door Library in Landvery Oak in central superstore were shipped through the shipping mode with the fastest delivery speed? | 'O'Sullivan Cherrywood Estates Traditional Bookcase' is the "Product Name"; shipping mode with the fastest delivery speed refers to "Ship Mode" = 'First Class' | SELECT COUNT(DISTINCT T1.`Order ID`) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'O''Sullivan Plantations 2-Door Library in Landvery Oak' AND T2.Region = 'Central' AND T1.`Ship Mode` = 'First Class' | 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... |
retails | How many customers are in debt? | customers are in debt refer to c_custkey where c_acctbal < 0; | SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 | 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`),... |
public_review_platform | What is the attribute value of an active business with a high review count and 3 stars which is located at Mesa, AZ? | active business refers to active = 'true'; located at Mesa, AZ refers to city = 'Mesa', state = 'AZ' | SELECT T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.state LIKE 'AZ' AND T1.review_count LIKE 'High' AND T1.active LIKE 'TRUE' AND T1.city LIKE 'Mesa' AND T1.stars = 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 ... |
talkingdata | Among all the users who use a vivo device, what is the age of the youngest user? | vivo device refers to phone_brand = 'vivo'; youngest refers to MIN(age); | SELECT T1.age FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'vivo' ORDER BY T1.age 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... |
chicago_crime | How many aldermen have "James" as their first name? | SELECT COUNT(*) FROM Ward WHERE alderman_first_name = 'James' | 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 ... | |
shooting | From the cases where the subject are male, list the case number and the location and subject status. | male refers to gender = 'M' | SELECT T1.case_number, T1.location, T1.subject_statuses FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'M' | 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... |
public_review_platform | How many of the busineses are in Casa Grande? | in Casa Grande refers to city = 'Casa Grande' | SELECT COUNT(city) FROM Business WHERE city LIKE 'Casa Grande' | 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 ... |
european_football_1 | How many Eredivisie teams have played in 2008? | Eredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam; | SELECT COUNT(DISTINCT T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 2008 | 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... |
donor | Which school county in the state of New York has a high number of low poverty levels? | New York refer to school_state = NY; highest number of low poverty level refer to MAX(poverty level = ’low poverty’) | SELECT school_county FROM projects WHERE poverty_level = 'low poverty' AND school_state = 'NY' GROUP BY school_state ORDER BY COUNT(poverty_level) 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 ... |
olympics | What is the average height of male athletes playing basketball sport? | AVG(height) where sport_name = 'Basketball' and event_name = 'Basketball Men''s'; | SELECT AVG(T5.height) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id INNER JOIN competitor_event AS T3 ON T2.id = T3.event_id INNER JOIN games_competitor AS T4 ON T3.competitor_id = T4.id INNER JOIN person AS T5 ON T4.person_id = T5.id WHERE T1.sport_name = 'Basketball' AND T5.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... |
car_retails | Which product did Cruz & Sons Co. ask for the biggest amount in a single order? | Cruz & Sons Co. is name of customer; the biggest amount refers to MAX(quantityOrdered). | SELECT t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' ORDER BY t1.priceEach * t1.quantityOrdered D... | CREATE TABLE offices
(
officeCode TEXT not null
primary key,
city TEXT not null,
phone TEXT not null,
addressLine1 TEXT not null,
addressLine2 TEXT,
state TEXT,
country TEXT not null,
postalCode TEXT not null,
territory TEXT not null
);
CREATE... |
books | What are the city addresses of the customers located in the United States of America? | "United States of America" is the country_name | SELECT DISTINCT T2.city FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'United States of America' | 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... |
retail_world | What is the full name of the employee who is in charge of the territory of Denver? | full name refers to FirstName, LastName; Denver is a TerritoryDescription | SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Denver' | 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,
... |
works_cycles | What is the forename and birthdate of person number 18? | person number 18 refers to BusinessEntityID = 18; forename refers to FirstName | SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18 | 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
... |
book_publishing_company | List all employees who are at the maximum level in their job designation. | maximum level in their job designation refers to job_lvl = MAX(max_lvl) | SELECT T1.fname, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl = T2.max_lvl | CREATE TABLE authors
(
au_id TEXT
primary key,
au_lname TEXT not null,
au_fname TEXT not null,
phone TEXT not null,
address TEXT,
city TEXT,
state TEXT,
zip TEXT,
contract TEXT not null
);
CREATE TABLE jobs
(
job_id INTEGER
primary key,... |
bike_share_1 | How many stations in San Francico can hold more than 20 bikes? | San Francico is the name of the city; can hold more than 20 bikes implies dock's capacity and refers to dock_count≥20; | SELECT SUM(CASE WHEN city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station | 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... |
ice_hockey_draft | Among all the teams that made the playoffs in the 2007-2008 season, identify the percentage that played over 20 games. | playoffs refers to GAMETYPE = 'Playoffs'; percentage = MULTIPLY(DIVIDE(SUM(GP > 20), COUNT(ELITEID)), 100); played over 20 games refers to GP > 20; 2007-2008 season refers to SEASON = '2007-2008'; | SELECT CAST(COUNT(CASE WHEN GP > 20 THEN TEAM ELSE NULL END) AS REAL) * 100 / COUNT(TEAM) FROM SeasonStatus WHERE SEASON = '2007-2008' AND GAMETYPE = 'Playoffs' | 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... |
mondial_geo | Please provide a list of every volcano mountain in the province of Ecuador. | SELECT T1.Name FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province WHERE T3.Name = 'Ecuador' AND T1.Type = 'volcano' | 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 | Which city does the customer who finished transaction no.103545 live in? | transaction no. refers to TransactionID; TransactionID = 103545; | SELECT T1.City FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = 103545 | 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 | List by their id all businesses that are open on Sunday. | day_of_week = 'Sunday'; open on Sunday refers to day_id = 1 | SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.day_id = 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 ... |
superstore | How many orders purchased by Aaron Bergman have been delivered with the slowest shipping speed? | slowest shipping speed refers to "Ship Mode" = 'Standard Class' | SELECT COUNT(*) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aaron Bergman' AND T2.`Ship Mode` = 'Standard Class' | 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... |
shakespeare | What are the titles and genres of the one-act works of Shakespeare? | one-act works refers to count(Act) = 1; genre refers to GenreType
| SELECT DISTINCT T1.Title, T1.GenreType FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Act = 1 | 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... |
professional_basketball | What's the name of the player in 1996 who had the most steals that didn't play in the playoffs? | name of the player refers to first_name, middle_name, last_name; in 1996 refers to year = 1996; the most steals refers to max(steals); didn't play in the playoffs refers to playoff = null | SELECT T1.playerID FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1996 AND T2.PostGP = 0 ORDER BY T2.steals 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_3 | What is Diane Collins' email address? | SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS' | 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... | |
professional_basketball | How many players received Most Valuable Player award from 1969 to 1975? | Most Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975 | SELECT COUNT(DISTINCT playerID) FROM awards_players WHERE year BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player' | 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... |
talkingdata | How many women have apps from the game-Finding fault category installed on their device? | women refers to gender = 'F'; installed refers to is_installed = 1; | SELECT COUNT(T1.device_id) 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 T1.age < 23 AND T1.gender = 'F' AND T3.is_active = 0 AND T3.is_installed = 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... |
legislator | Among all the current legislators who have served for more than 4 terms, what is the percentage of them being female? | have served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F' | SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3 | 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 ... |
university | In 2014, what is the name of the university which was considered a leader in the publications rank? | In 2014 refers to year = 2014; leader refers to MAX(score); in the publications rank refers to criteria_name = 'Publications Rank'; name of university refers to university_name; | SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Publications Rank' AND T2.year = 2014 AND T1.id = 17 ORDER BY T2.score DESC LIMIT 1 | 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
... |
superstore | Name 10 products that were shipped first class from the East region. | shipped first class refers to "Ship Mode" = 'First Class'; Region = 'East' | SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'First Class' AND T2.Region = 'East' LIMIT 10 | 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... |
simpson_episodes | Name the title of the episode where Pamela Hayden voiced the character 'Ruthie.' | "Pamela Hayden" is the person; voice the character 'Ruthie' refers to role = 'Ruthie' | SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Pamela Hayden' AND T2.role = 'Ruthie'; | 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,
... |
works_cycles | How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities? | SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore')) | SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode | 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
... |
olympics | Please list the names of all the Olympic games that John Aalberg has taken part in. | name of the Olympic 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 = 'John Aalberg' | 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... |
talkingdata | How many female users belong to the age group of 27 to 28? | female refers to gender = 'F'; age group of 27 to 28 refers to `group` = 'F27-28'; | SELECT COUNT(device_id) FROM gender_age WHERE `group` = 'F27-28' AND gender = 'F' | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.