db_id stringclasses 69
values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringclasses 69
values |
|---|---|---|---|---|
sales | How many types of "HL Touring Frames" are there? | types of HL Touring Frames refers to Name like '%HL Touring Frame%'; | SELECT COUNT(ProductID) FROM Products WHERE Name LIKE '%HL Touring Frame%' | 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... |
authors | How many authors does the paper "Equation Solving in Geometrical Theories" have? | "Equation Solving in Geometrical Theories" is the title of paper | SELECT COUNT(T1.AuthorId) FROM PaperAuthor AS T1 INNER JOIN Paper AS T2 ON T1.PaperId = T2.Id WHERE T2.Title = 'Equation Solving in Geometrical Theories' | 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... |
law_episode | Who is the stunt coordinator in episode 3? | who refers to name; stunt coordinator refers to role = 'stunt coordinator' | SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 3 AND T2.role = 'stunt coordinator' | 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 ... |
works_cycles | What is the product cost end date with the highest weight in grams? | in grams refers to WeightUnitMeasureCode = 'G' | SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
law_episode | Among the American casts, how many were uncredited on episode ID tt0629228? | American refers to birth_country = 'USA'; cast refers to category = 'Cast'; uncredited refers to credited = '' | SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629228' AND T1.category = 'Cast' AND T1.credited = 'false' AND T2.birth_country = 'USA' | 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 ... |
soccer_2016 | How many players were born in the 90s? | born in the 90s refers to DOB > = '1990-01-01' AND DOB < = '1999-12-31' | SELECT COUNT(Player_Id) AS cnt FROM Player WHERE DOB BETWEEN '1990-01-01' AND '1999-12-31' | 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... |
cs_semester | What is the full name of the professor who graduated from an Ivy League School? | Ivy League school is assembled by 8 universities: Brown University, Columbia University, Cornell University, Dartmouth College, Harvard University, Princeton University, University of Pennsylvania and Yale University; | SELECT first_name, last_name FROM prof WHERE graduate_from IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) | 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... |
retails | How many suppliers have their accounts in debt? | account in debt refers to s_acctbal < 0 | SELECT COUNT(s_suppkey) FROM supplier WHERE s_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`),... |
student_loan | What is the status of payment of student 124? | status of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student124 is a name of student; | SELECT `bool` FROM no_payment_due WHERE name = 'student124' | 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... |
food_inspection_2 | Which facilities were inspected by Sarah Lindsey on 20th November 2012? | facility name refers to dba_name; on 20th November 2012 refers to inspection_date = '2012-11-20' | SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2012-11-20' AND T3.first_name = 'Sarah' AND T3.last_name = 'Lindsey' | 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... |
movie_3 | Of the movies in which Reese Kilmer acted, what percentage are action movies? | 'Reese Kilmer' is a full name of an actor; 'action' is the name of the category; calculation = DIVIDE(COUNT('action'), COUNT(category_id)) * 100 | SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_na... | 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... |
authors | Write down the conference full name of "ICWE" and it's homepage address. | "ICWE" is the ShortName of conference | SELECT FullName, Homepage FROM Conference WHERE ShortName = 'ICWE' | 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... |
simpson_episodes | List down person's name who has nickname. | has nickname refers to nickname is NOT NULL | SELECT name FROM Person WHERE nickname IS NOT NULL; | 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,
... |
hockey | Name the goalies and season they played when Boston Bruins won number 1 in rank. | goalies refers to pos = 'G'; season refers to year
| SELECT T1.firstName, T1.lastName, T3.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.year = T3.year AND T2.tmID = T3.tmID WHERE T1.deathYear IS NOT NULL AND T3.name = 'Boston Bruins' AND T3.rank = 1 AND T1.pos = 'G' | 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 ... |
beer_factory | What is the precise location of zip code 95819? | precise location = Latitude, Longitude; | SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ZipCode = 95819 | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
books | List the author's name of the books published by Abrams. | "Abrams" is the publisher_name; author's name refers to author_name | SELECT T3.author_name 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 INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T4.publisher_name = 'Abrams' | 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... |
movie_3 | State the documentary film titles with longest length. | documentary film refers to name = 'documentary'; longest length refers to max(length) | SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.name = 'documentary' ORDER BY T1.length DESC LIMIT 1 | CREATE TABLE film_text
(
film_id INTEGER not null
primary key,
title TEXT not null,
description TEXT null
);
CREATE TABLE IF NOT EXISTS "actor"
(
actor_id INTEGER
primary key autoincrement,
first_name TEXT not null,
last_nam... |
public_review_platform | What is the total number of active business in AZ with a high review count? | active business refers to active = 'true'; 'AZ' is the state; high review count refers to review_count = 'High' | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' 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 ... |
mondial_geo | State the name of the lake in Albania province and in which city does it located at. | SELECT Lake, City FROM located WHERE Province = 'Albania' AND Lake 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... | |
food_inspection_2 | What is the point level of "Refrigeration and metal stem thermometers provided and conspicuous"? | "Refrigeration and metal stem thermometers provided and conspicuous" refers to Description = 'Refrigeration and metal stem thermometers provided and conspicuous ' | SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous ' | 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... |
donor | When did the project "Photojournalists Want to Exhibit Their Best Works" go live? | project "Photojournalists Want to Exhibit Their Best Works" refers to title = 'Photojournalists Want to Exhibit Their Best Works'; when project go live refers to datePosted | SELECT T1.date_posted FROM projects AS T1 INNER JOIN essays AS T2 ON T1.projectid = T2.projectid WHERE T2.title LIKE 'Photojournalists Want to Exhibit Their Best Works' | 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 | What is the profit for the product "792"? | profit = SUBTRACT(ListPrice, StandardCost); | SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
hockey | Which year was the goalie who had the most postseaon shots Against in 2008 born? | the most postseason shots Against refers to max(PostSA); year born refers to birthYear | SELECT T1.birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2008 ORDER BY T2.PostSA 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 ... |
books | What is the highest price at which a customer bought the book 'The Prophet'? | "The Prophet" is the title of the book; highest price refers to Max(price) | SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Prophet' | 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... |
university | Which country is Harvard University in? | Harvard University refers to university_name = 'Harvard University'; which country refers to country_name | SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.university_name = 'Harvard University' | 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
... |
works_cycles | Which vendor gives the best profit on net for product ID 342? | profit on net = subtract(LastReceiptCost, StandardPrice); best profit on net refers to max(subtract(LastReceiptCost, StandardPrice)) | SELECT T1.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.ProductID = 342 ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
simpson_episodes | What is the number of votes for 10-star for the episode that has the keyword "reference to the fantastic four"? | 10-star refers to stars = 10 | SELECT T2.votes FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 AND T1.keyword = 'reference to the fantastic four'; | 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,
... |
simpson_episodes | What is the title of episode nominated for WGA Award (TV) with votes greater than 1000? | nominated refers to result = 'Nominee'; WGA Award (TV) refers to award_category = 'WGA Award (TV)'; votes greater than 1000 refers to votes > 1000 | SELECT DISTINCT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 1000 AND T1.award_category = 'WGA Award (TV)' AND T1.result = 'Nominee'; | 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,
... |
shakespeare | List the number of acts in Two Gentlemen of Verona. | Two Gentlemen of Verona refers to LongTitle = 'Two Gentlemen of Verona' | SELECT DISTINCT T1.Act FROM chapters AS T1 INNER JOIN works AS T2 ON T1.id = T1.work_id WHERE T2.LongTitle = 'Two Gentlemen of Verona' | 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... |
mondial_geo | Where country does Baghdad belongs to? | Baghdad is one of provinces | SELECT Name FROM country WHERE Province = 'Baghdad' | 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... |
legislator | What is the party and state of the legislator that has an open secrets ID of N00003689 and thomas ID of 186? | SELECT T2.party, T2.state FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.opensecrets_id = 'N00003689' AND T1.thomas_id = 186 GROUP BY T2.party, T2.state | 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 ... | |
image_and_language | What is the percentage of "surface" object samples in image No.2654? | DIVIDE(SUM(OBJ_CLASS_ID where OBJ_CLASS = 'surface'), COUNT(OBJ_CLASS_ID)) as percentage where IMG_ID = 2654; | SELECT CAST(SUM(CASE WHEN T2.OBJ_CLASS = 'surface' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OBJ_CLASS_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 2654 | 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... |
donor | What are the coordinates of the school where project 'Look, Look, We Need a Nook!' Was donated to and what resource type is it? | Coordinates of the school refer to school_latitude, school_longitude); Look, Look, We Need a Nook! Refer to title; | SELECT T2.school_latitude, T2.school_longitude, T2.resource_type FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.title LIKE 'Look, Look, We Need a Nook!' | 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 | What's Lynn N Tsoflias's job title? | SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias' | 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
... | |
software_company | In geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20? | geographic identifier from 20 to 50 refers to GEOID BETWEEN 20 AND 50; number of inhabitants below 20 refers to INHABITANTS_K < 20; | SELECT COUNT(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50 | CREATE TABLE Demog
(
GEOID INTEGER
constraint Demog_pk
primary key,
INHABITANTS_K REAL,
INCOME_K REAL,
A_VAR1 REAL,
A_VAR2 REAL,
A_VAR3 REAL,
A_VAR4 REAL,
A_VAR5 REAL,
A_VAR6 REAL,
A_VAR7 REAL,
... |
beer_factory | How many canned A&W were purchased in 2016? | canned refers to ContainerType = 'Can'; A&W refers to BrandName = 'A&W'; in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31'; | SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.ContainerType = 'Can' AND T2.BrandName = 'A&W' AND T1.PurchaseDate LIKE '2016%' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
hockey | What is the average weight of players who have height greater than 72 inches. | average weight refers to AVG(weight); height greater than 72 inches refers to height>72 | SELECT AVG(weight) FROM Master WHERE height > 72 | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
food_inspection | Which business had the lowest score for the unscheduled routine inspection on 2016/9/26? Give the name of the business. | the lowest score for unscheduled routine inspection refers to type = 'Routine - Unscheduled' where MIN(score); date = '2016-09-26'; | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE score = ( SELECT MIN(score) FROM inspections WHERE `date` = '2016-09-26' AND type = 'Routine - Unscheduled' ) AND T1.`date` = '2016-09-26' AND T1.type = 'Routine - Unscheduled' | CREATE TABLE `businesses` (
`business_id` INTEGER NOT NULL,
`name` TEXT NOT NULL,
`address` TEXT DEFAULT NULL,
`city` TEXT DEFAULT NULL,
`postal_code` TEXT DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`phone_number` INTEGER DEFAULT NULL,
`tax_code` TEXT DEFAULT NULL,
`b... |
shipping | What is the brand of the truck that is used to ship by Zachery Hicks? | brand of truck refers to make | SELECT DISTINCT T1.make FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id INNER JOIN driver AS T3 ON T3.driver_id = T2.driver_id WHERE T3.first_name = 'Zachery' AND T3.last_name = 'Hicks' | 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... |
shakespeare | What are the descriptions of the short chapters? | short chapters refers to ParagraphNum < 150 | SELECT DISTINCT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T1.ParagraphNum < 150 | 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 | For the latest passing player who could play all the positions in the court, how many points did he have in his career? | the latest passing refers to max(season_id); play all the positions refers to pos like '%C%' or pos like '%F%' or pos like '%G%' | SELECT SUM(T2.points) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T1.pos = 'C-F-G' GROUP BY T2.playerID, T2.year ORDER BY T2.year 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 | List at least 3 cities under the country of Philippines. | SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'Philippines' | 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... | |
public_review_platform | List the active business ID and its stars of the businesses fall under the category of Fashion. | active business refers to active = 'true'; category of Fashion refers to category = 'Fashion' | SELECT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Fashion' | 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 ... |
music_platform_2 | Please list the titles of the podcasts for which the author whose ID is F7E5A318989779D has written a review. | author whose ID is F7E5A318989779D refers to author_id = 'F7E5A318989779D' | SELECT T2.title FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.author_id = 'F7E5A318989779D' | 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
... |
public_review_platform | What is the review length of user 35026 to business with business ID 2? | user 35026 refers to user_id = 35026 | SELECT review_length FROM Reviews WHERE user_id = 35026 AND business_id = 2 | 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 ... |
image_and_language | List all the attribute classes of the image ID "15". | attribute classes of the image ID "15" refer to ATT_CLASS where IMG_ID = 15; | SELECT T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 15 | 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... |
simpson_episodes | Please list the name of crew that were born before 1970. | born before 1970 refers to birthdate < '1970-01-01' | SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) < '1970'; | 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 | How many countries are there in the No.2 region? | No.2 region refers to n_regionkey = 2; | SELECT COUNT(n_nationkey) FROM nation WHERE n_regionkey = 2 | CREATE TABLE `customer` (
`c_custkey` INTEGER NOT NULL,
`c_mktsegment` TEXT DEFAULT NULL,
`c_nationkey` INTEGER DEFAULT NULL,
`c_name` TEXT DEFAULT NULL,
`c_address` TEXT DEFAULT NULL,
`c_phone` TEXT DEFAULT NULL,
`c_acctbal` REAL DEFAULT NULL,
`c_comment` TEXT DEFAULT NULL,
PRIMARY KEY (`c_custkey`),... |
student_loan | Among the unemployed students, how many of them have no payment due? | have no payment due refers to bool = 'neg';
| SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg' | 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... |
codebase_comments | How many path does the github address "https://github.com/jeffdik/tachy.git" have? | github address refers to Url; Url = 'https://github.com/jeffdik/tachy.git'; | SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/jeffdik/tachy.git' | 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... |
donor | For the all donations to the project 'Bringing Drama to Life', what is the percentage of the donation is paid by credit card? | Bringing Drama to Life' is the title; Percentage = Divide(Count(payment_method = 'creditcard'), Count(projectid))*100; | SELECT CAST(SUM(CASE WHEN T2.payment_method LIKE 'creditcard' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(donationid) FROM essays AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T1.title LIKE 'Bringing Drama to Life' | 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 ... |
human_resources | List the location cities in the Western states. | Western states refers to state = 'CO' OR state = 'UT' OR state = 'CA'; location cities refers to locationcity | SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA') | 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
... |
movies_4 | Who is the director for the movie 'Transformers?' | the director refers to person_name where job = 'Director'; movie 'Transformers' refers to title = 'Transformers' | SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Transformers' AND T2.job = 'Director' | 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
(
... |
works_cycles | Is the phone number "114-555-0100" a work number or a home number? | SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.PhoneNumber = '114-555-0100' | 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 | What is the name of the customer with the highest amount of debt? | customer with the highest amount of debt refers to c_name where MIN(c_acctbal); | SELECT c_name FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer ) | 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`),... |
retails | What is the total amount of tax charged for the order placed by customer 88931 on 7/13/994? | total amount of tax refers to sum(multiply(multiply(l_extendedprice, subtract(1, l_discount)), add(1, l_tax))); customer 88931 refers to o_custkey = 88931; on 7/13/1994 refers to o_orderdate = '1994-07-13' | SELECT SUM(T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax)) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = 88931 AND T1.o_orderdate = '1994-07-13' | 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`),... |
mondial_geo | How many organizations are founded in countries with a population of under 1000000? | SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000 | 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... | |
food_inspection | How many high risks violations did the Tiramisu Kitchen violate? | Tiramisu Kitchen is the name of the business; high risks violations refer to risk_category = 'High Risk'; | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'High Risk' | CREATE TABLE `businesses` (
`business_id` INTEGER NOT NULL,
`name` TEXT NOT NULL,
`address` TEXT DEFAULT NULL,
`city` TEXT DEFAULT NULL,
`postal_code` TEXT DEFAULT NULL,
`latitude` REAL DEFAULT NULL,
`longitude` REAL DEFAULT NULL,
`phone_number` INTEGER DEFAULT NULL,
`tax_code` TEXT DEFAULT NULL,
`b... |
movielens | What are the genres of all the English-language foreign films having a runtime of two hours or less? List each one. | isEnglish = 'T' means films in English; Film and movie share the same meaning | SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime <= 2 AND T1.isEnglish = 'T' AND T1.country = 'other' | CREATE TABLE users
(
userid INTEGER default 0 not null
primary key,
age TEXT not null,
u_gender TEXT not null,
occupation TEXT not null
);
CREATE TABLE IF NOT EXISTS "directors"
(
directorid INTEGER not null
primary key,
d_quality INTEGER not null,
avg... |
cs_semester | Give the number of research postgraduate students. | RPG is an abbreviated name of research postgraduate student in which type = 'RPG'; | SELECT COUNT(student_id) FROM student WHERE type = 'RPG' | 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... |
address | What is the difference in the number of cities with P.O. box only and cities with Post Office among the cities with area code 787? | SUBTRACT(COUNT(type = 'P.O. Box Only'), COUNT(type = 'Post Office')) where area_code = 787; | SELECT COUNT(CASE WHEN T2.type = 'P.O. Box Only' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.type = 'Post Office' THEN 1 ELSE NULL END) AS DIFFERENCE 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 ... |
disney | Indicate the release date of the film The Lion King directed by Roger Allers. | The Lion King refers to movie_title = 'The Lion King'; Roger Allers refers to director = 'Roger Allers'; | SELECT T1.release_date FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Roger Allers' AND T1.movie_title = 'The Lion King' | 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... |
hockey | For the coach who won Second Team All-Star in 1933, how many wins did he have that year? | the number of wins refers to count(w) | SELECT SUM(T1.W) FROM Coaches AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 1933 AND T2.award = 'Second Team All-Star' | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
food_inspection_2 | List the full names of the employees who were responsible for inspecting Taqueria La Paz. | full name refers to first_name, last_name; Taqueria La Paz refers to dba_name = 'TAQUERIA LA PAZ' | SELECT DISTINCT T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T1.dba_name = 'TAQUERIA LA PAZ' | 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... |
world | What is the life expectancy of residents in the most crowded city? | most crowded city refers to MAX(Population); | SELECT T2.LifeExpectancy FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code ORDER BY T1.Population DESC LIMIT 1 | 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... |
retail_world | What is the region where the customer who placed the order id 10276 located? | SELECT T1.Region FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10276 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE Categories
(
CategoryID INTEGER PRIMARY KEY AUTOINCREMENT,
CategoryName TEXT,
Description TEXT
);
CREATE TABLE Customers
(
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
CustomerName TEXT,
ContactName TEXT,
Address TEXT,
City TEXT,
... | |
cars | Please list the names of the top 3 most expensive cars. | name of the car refers to car_name; the most expensive refers to max(price) | SELECT T1.car_name FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID ORDER BY T2.price DESC LIMIT 3 | 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... |
public_review_platform | Within the user who joined Yelp in 2004, explore the user ID with average star of 5 and it's review length on the business. | user who joined Yelp in 2004 refers to user_id where user_yelping_since_year = 2014; user_average_stars = 5; | SELECT T2.user_id, T2.review_length FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_average_stars = 5 | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
movie | Show the birth city of the actor who played "Gabriel Martin". | "Gabriel Martin" refers to Character Name = 'Gabriel Martin' | SELECT T2.`Birth City` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Gabriel Martin' | CREATE TABLE actor
(
ActorID INTEGER
constraint actor_pk
primary key,
Name TEXT,
"Date of Birth" DATE,
"Birth City" TEXT,
"Birth Country" TEXT,
"Height (Inches)" INTEGER,
Biography TEXT,
Gender TEXT,
Ethnicity ... |
hockey | How many Haileybury Hockey Club goalies became a hall of famer? | hall of famers refers to hofID where playerID is not NULL; | SELECT COUNT(DISTINCT T1.playerID) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T1.tmID = T3.tmID AND T1.year = T3.year WHERE T3.name = 'Haileybury Hockey Club' AND T2.hofID IS NOT NULL | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
talkingdata | Among the devices with event no.2 happening, how many of them are vivo devices? | event no. refers to event_id; event_id = 2; vivo devices refers to phone_brand = 'vivo'; | SELECT COUNT(T1.device_id) FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' AND T2.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... |
movie_3 | In 2006, how many restricted films were released? | restricted refers to rating = 'R'; release refers to release_year; in 2006 refers to release_year = 2006; film refers to title | SELECT COUNT(film_id) FROM film WHERE rating = 'R' AND 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... |
movie_platform | What is the URL to the user profile image on Mubi of the user who gave the movie id of 1103 a 5 ratinng score on 4/19/2020? | URL to the user profile image on Mubi refers to user_avatar_image_url; 4/19/2020 refers to rating_date_utc | SELECT T2.user_avatar_image_url FROM ratings AS T1 INNER JOIN ratings_users AS T2 ON T1.user_id = T2.user_id WHERE T2.user_id = 1103 AND rating_score = 5 AND T2.rating_date_utc = '2020-04-19' | 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... |
synthea | Indicate the patient's full name with the lowest body mass index in kg/m2. | full name refers to first, last; the lowest body mass index in kg/m2 refers to DESCRIPTION = Body Mass Index from observations where MIN(VALUE) and UNITS = 'kg/m2'; | SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Body Mass Index' AND T2.UNITS = 'kg/m2' ORDER BY T2.VALUE LIMIT 1 | 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
... |
mondial_geo | For the countries have the population north of a billion, which one has the lowest GDP? Give the full name of the country. | billion = 1000000000 | SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population > 1000000000 ORDER BY T2.GDP ASC LIMIT 1 | 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... |
restaurant | What kind of restaurants can be found at "106 E 25th Ave"? | kind of restaurant refers to food_type; "106 E 25th Ave" refers to street_name = 'e 25th ave' | SELECT T1.food_type FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_num = 106 AND T2.street_name = 'e 25th ave' | 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... |
world | List down the cities that belong to the country with a life expectancy of 66.4. | SELECT T2.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.LifeExpectancy = 66.4 | 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... | |
chicago_crime | What is the name of the community that has the highest number of crimes related to prostitution? | name of the community refers to community_area_name; the highest number of crimes refers to max(case_number); prostitution refers to primary_description = 'PROSTITUTION' | SELECT T3.community_area_name FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T1.community_area_no = T3.community_area_no WHERE T2.primary_description = 'PROSTITUTION' GROUP BY T1.iucr_no ORDER BY T1.case_number DESC LIMIT 1 | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
movie_3 | What is the average rental payment in Horror movies? | 'Horror' is a name of a category; average rental payment refers to AVG(amount) | SELECT AVG(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.name = 'Horror' | 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_3 | Among the times Mary Smith had rented a movie, how many of them happened in June, 2005? | in June 2005 refers to year(payment_date) = 2005 and month(payment_date) = 6 | SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6' | 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... |
talkingdata | Identify by their id all the apps that belong to the game-stress reliever category. | id refers to device_id; | SELECT T2.app_id FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'game-stress reliever' | CREATE TABLE `app_all`
(
`app_id` INTEGER NOT NULL,
PRIMARY KEY (`app_id`)
);
CREATE TABLE `app_events` (
`event_id` INTEGER NOT NULL,
`app_id` INTEGER NOT NULL,
`is_installed` INTEGER NOT NULL,
`is_active` INTEGER NOT NULL,
PRIMARY KEY (`event_id`,`app_id`),
FOREIGN KEY (`event_id`) REFERENCES `eve... |
retail_world | Among the customers, list customers' company names and addresses who paid more than average in freight. | paid more than average in freight refers to Freight > divide(sum(Freight) , count(OrderID)) | SELECT DISTINCT T1.CompanyName, T1.Address FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Freight > ( SELECT AVG(Freight) FROM Orders ) | 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,
... |
authors | Provide any four valid Journal ID along with short name and full name of the papers which were made in 2013. | valid journal ID refers to JournalId! = 0 and JournalId! = -1; made in 2013 refers to Year = 2013 | SELECT DISTINCT T2.JournalId, T1.ShortName, T1.FullName FROM Journal AS T1 INNER JOIN Paper AS T2 ON T1.Id = T2.JournalId WHERE T2.Year = 2013 AND T2.JournalId != 0 AND T2.JournalId != -1 LIMIT 4 | 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... |
sales_in_weather | Tell the resultant wind speed of station no.9 on 2014/1/15. | station no.9 refers to station_nbr = 9; on 2014/1/15 refers to date = '2014/01/15'; result wind speed refers to resultspeed | SELECT resultspeed FROM weather WHERE `date` = '2014-01-15' AND station_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... |
computer_student | List down all the person IDs who taught course ID of 18. | person IDs refers to taughtBy.p_id; course ID of 18 refers to taughtBy.course_id = 18 | SELECT p_id FROM taughtBy WHERE course_id = 18 | 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 ... |
app_store | For the Akinator app, how many reviews have sentiment subjectivity of no more than 0.5 and what is its current version? | Sentiment_Subjectivity<0.5; current version refers to Current Ver; | SELECT COUNT(T2.Sentiment_Subjectivity), T1."Current Ver" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Akinator' AND T2.Sentiment_Subjectivity < 0.5 | CREATE TABLE IF NOT EXISTS "playstore"
(
App TEXT,
Category TEXT,
Rating REAL,
Reviews INTEGER,
Size TEXT,
Installs TEXT,
Type TEXT,
Price TEXT,
"Content Rating" TEXT,
Genres TEXT
);
CREA... |
address | List down the names of the cities belonging to Noble, Oklahoma. | the county of Noble is located in the state of Oklahoma; | SELECT T3.city FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T1.name = 'Oklahoma' AND T2.county = 'NOBLE' | 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 ... |
cookbook | How many times is the sodium content in Lasagne-Spinach Spirals to Beef and Spinach Pita Pockets? | sodium is a name of an ingredient; calculation = DIVIDE(SUM(title = 'Lasagne-Spinach Spirals' THEN sodium), SUM(title = 'Beef and Spinach Pita Pockets' THEN sodium)) | SELECT CAST(SUM(CASE WHEN T1.title = 'Lasagne-Spinach Spirals' THEN T2.sodium ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.title = 'Beef and Spinach Pita Pockets' THEN T2.sodium ELSE 0 END) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id | CREATE TABLE Ingredient
(
ingredient_id INTEGER
primary key,
category TEXT,
name TEXT,
plural TEXT
);
CREATE TABLE Recipe
(
recipe_id INTEGER
primary key,
title TEXT,
subtitle TEXT,
servings INTEGER,
yield_unit TEXT,
prep_min... |
mondial_geo | What year saw the greatest number of organizations created on the European continent? | SELECT STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) DESC LIMIT 1 | 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... | |
law_episode | What is the full place of birth of Rene Chenevert Balcer? | full place of birth refers to birth_place, birth_region; Rene Chenevert Balcer refers to birth_name = 'Rene Chenevert Balcer' | SELECT birth_place, birth_region FROM Person WHERE birth_name = 'Rene Chenevert Balcer' | 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 ... |
books | How many orders were delivered in December 2019? | delivered refers to status_value = 'Delivered'; in December 2019 refers to status_date LIKE '2019-12%' | SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019' | 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... |
genes | What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential? | SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential' | CREATE TABLE Classification
(
GeneID TEXT not null
primary key,
Localization TEXT not null
);
CREATE TABLE Genes
(
GeneID TEXT not null,
Essential TEXT not null,
Class TEXT not null,
Complex TEXT null,
Phenotype TEXT not null,
Motif TEXT n... | |
works_cycles | List all product names and its product line for all purchase order with order quantity of 5000 or more. | Purchase order with order quantity of 5000 or more refers to OrderQty> = 5000 | SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
chicago_crime | What is the general and specific description of incident 275? | incident 275 refers to iucr_no = 275; general description refers to primary_description; specific description refers to secondary_description | SELECT primary_description, secondary_description FROM IUCR WHERE iucr_no = 275 | CREATE TABLE Community_Area
(
community_area_no INTEGER
primary key,
community_area_name TEXT,
side TEXT,
population TEXT
);
CREATE TABLE District
(
district_no INTEGER
primary key,
district_name TEXT,
address TEXT,
zip_code ... |
public_review_platform | In users yelping since 2010 to 2012, how many of them has an low fans? | user yelping since 2010 to 2012 refers to user_yelping_since_year > = '2010' AND user_yelping_since_year < '2013'; low fans refers to user_fans = 'Low' | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2010 AND 2012 AND user_fans LIKE 'Low' | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
retail_world | In 1996, how many orders were from customers in the UK? | in 1996 refers to YEAR (OrderDate) = 1996; 'UK' is the Country; | SELECT COUNT(T1.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' AND T1.Country = 'UK' | 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,
... |
car_retails | How much did Petit Auto pay on 2004-08-09? | Petit Auto is name of customer; paymentDate = '2004-08-09'; | SELECT t1.amount FROM payments AS t1 INNER JOIN customers AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.customerName = 'Petit Auto' AND t1.paymentDate = '2004-08-09' | 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... |
works_cycles | How many discount are of the type "Excess Inventory"? | discount refers to DiscountPct; Excess Inventory is a type of special offer; | SELECT COUNT(SpecialOfferID) FROM SpecialOffer WHERE Type = 'Excess Inventory' | 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
... |
beer_factory | How many transactions were paid through MasterCard in 2014? | MasterCard refers to CreditCardType = 'MasterCard'; in 2014 refers to TransactionDate > = '2014-01-01' AND TransactionDate < = '2014-12-31'; | SELECT COUNT(TransactionID) FROM `transaction` WHERE CreditCardType = 'MasterCard' AND TransactionDate LIKE '2014%' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
movie_3 | List all the films that are rated as PG-13. | film refers to title; rated as PG-13 refers to rating = 'PG-13' | SELECT title FROM film WHERE rating = 'PG-13' | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.