db_id stringlengths 4 28 | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 | schema stringlengths 352 37.3k |
|---|---|---|---|---|
codebase_comments | List all the ids of repositories for solutions with "ro" methods. | ids of repositories refers to RepoId; ro refers to lang = 'ro'; | SELECT DISTINCT T1.RepoId FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Lang = 'ro' | 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... |
college_completion | List the race of institutions in Alabama with number of students greater than the 90% of average number of students of all institutions? | Alabama refers to state = 'Alabama'; number of students greater than the 90% of average = MULTIPLY(AVG(student_count), 90%) < student_count; | SELECT DISTINCT T2.race FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.student_count > ( SELECT AVG(T1.student_count) * 0.9 FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' ) AND T1.state = 'Alabama... | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
olympics | How many 24 years old competitors competed in Men's Basketball? | 24 years old competitors refer to id where age = 24; Men's Basketball refers to event_name = 'Basketball Men''s Basketball'; | SELECT COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball' AND T2.age = 24 | 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... |
ice_hockey_draft | Among the USA players, who has the lightest weight? | USA refers to nation = 'USA' ; players refers to PlayerName; lightest weight refers to MIN(weight_in_lbs);
| SELECT T2.PlayerName FROM weight_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.weight_id = T2.weight WHERE T2.nation = 'USA' ORDER BY T1.weight_in_lbs ASC LIMIT 1 | CREATE TABLE height_info
(
height_id INTEGER
primary key,
height_in_cm INTEGER,
height_in_inch TEXT
);
CREATE TABLE weight_info
(
weight_id INTEGER
primary key,
weight_in_kg INTEGER,
weight_in_lbs INTEGER
);
CREATE TABLE PlayerInfo
(
ELITEID INTE... |
university | In years 2011 to 2013, what is the total number of female students in university ID 40? | total number of female students refers to SUM(DIVIDE(MULTIPLY(pct_female_students, num_students), 100)); In years 2011 to 2013 refers to year BETWEEN 2011 AND 2013 | SELECT SUM(CAST(num_students * pct_female_students AS REAL) / 100) FROM university_year WHERE year BETWEEN 2011 AND 2013 AND university_id = 40 | 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
... |
movie_platform | Between 1970 to 1980, how many movies with a popularity of more than 11,000 were released? | Between 1970 to 1980 refers to movie_release_year between 1970 and 1980; popularity of more than 11,000 refers movie_popularity >11000 | SELECT COUNT(movie_id) FROM movies WHERE movie_release_year BETWEEN '1970' AND '1980' AND movie_popularity > 11000 | 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... |
movielens | How many movies from the USA which user rating is less than 3? | SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' AND T1.rating < 3 | 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... | |
simpson_episodes | How many keywords does the episode that was aired on 2008/10/19 have? | aired on 2008/10/19 refers to air_date = '2008-10-19' | SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2008-10-19'; | 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 | Write down the name of the largest population country. | largest population refers to MAX(Population); | SELECT Name FROM Country ORDER BY 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... |
legislator | List the full name of legislators whose born in 1960. | full name refers to official_full_name; born in 1960 refers to birthday_bio like '1960%'; | SELECT official_full_name FROM current WHERE birthday_bio LIKE '1960%' | 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 ... |
talkingdata | How many female users use ZenFone 5 devices? | female refers to gender = 'F'; ZenFone 5 refers to device_model = 'ZenFone 5'; | SELECT COUNT(T1.gender) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'F' AND T2.device_model = 'ZenFone 5' | 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 | What are the addresses for the stores? | SELECT T2.address FROM store AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id | 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 | Identify the full name of the customer, who has the following email address: SHEILA.WELLS@sakilacustomer.org. | full name refers to first_name, last_name | SELECT first_name, last_name FROM customer WHERE email = 'SHEILA.WELLS@sakilacustomer.org' | 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... |
european_football_1 | What was the difference in home team and away team win percentages across all divisions in 2010? | 2010 refers to season = 2010; SUBTRACT(DIVIDE(COUNT(Div where FTR = 'H', season = 2010), COUNT(Div where season = 2010)), COUNT(Div where FTR = 'A', season = 2010), COUNT(Div where season = 2010)) as percentage; | SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) - CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) DIFFERENCE FROM matchs WHERE season = 2010 | CREATE TABLE divisions
(
division TEXT not null
primary key,
name TEXT,
country TEXT
);
CREATE TABLE matchs
(
Div TEXT,
Date DATE,
HomeTeam TEXT,
AwayTeam TEXT,
FTHG INTEGER,
FTAG INTEGER,
FTR TEXT,
season INTEGER,
foreign key (Div) re... |
retails | List by order number the 3 items with the lowest price after applying the discount. | order number refers to l_orderkey; the lowest price after applying the discount refers to MIN(MULTIPLY(l_extendedprice), SUBTRACT(1, l_discount)); | SELECT l_orderkey FROM lineitem ORDER BY l_extendedprice * (1 - l_discount) LIMIT 3 | CREATE TABLE `customer` (
`c_custkey` INTEGER NOT NULL,
`c_mktsegment` TEXT DEFAULT NULL,
`c_nationkey` INTEGER DEFAULT NULL,
`c_name` TEXT DEFAULT NULL,
`c_address` TEXT DEFAULT NULL,
`c_phone` TEXT DEFAULT NULL,
`c_acctbal` REAL DEFAULT NULL,
`c_comment` TEXT DEFAULT NULL,
PRIMARY KEY (`c_custkey`),... |
works_cycles | Among the companies to which Adventure Works Cycles purchases parts or other goods, what is the profit on net obtained from the vendor who has an above average credit rating? Kindly indicate each names of the vendor and the corresponding net profits. | above average credit rating refers to CreditRating = 3; profit on net = subtract(LastReceiptCost, StandardPrice); | SELECT T2.Name, T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CreditRating = 3 | 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 | In which city is the brewery AJ Stephans Beverages located? | AJ Stephans refers to BreweryName = 'AJ Stephans Beverages'; | SELECT City FROM rootbeerbrand WHERE BreweryName = 'AJ Stephans Beverages' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
authors | Provide the average number of papers that are published in the journal named 'Information Sciences' annually. | 'Information Sciences' is the FullName of journal; average = DIVIDE(COUNT(JournalId = 48), COUNT(Years)) | SELECT CAST(COUNT(T2.JournalId) AS REAL) / COUNT(DISTINCT T2.Year) FROM Journal AS T1 INNER JOIN Paper AS T2 ON T1.Id = T2.JournalId WHERE T1.FullName = 'Information Sciences' | 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... |
university | How many universities got less than 50 scores under ranking criteria ID 6 in 2011? | in 2011 refers to year 2011; less than 50 scores refers to score < 50; | SELECT COUNT(*) FROM university_ranking_year WHERE ranking_criteria_id = 6 AND year = 2011 AND score < 50 | 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
... |
movie_3 | Among all the active customers, how many of them live in Arlington? | active refers to active = 1; Arlington refers to city = 'Arlington' | SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington' | 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... |
hockey | How many years were there after Don Waddell retired and became a coach in NHL? | after retired and became a coach refers to max(subtract(year, lastNHL)) | SELECT MAX(T2.year) - MIN(T2.year) FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T1.firstName = 'Don' AND T1.lastName = 'Waddell' | CREATE TABLE AwardsMisc
(
name TEXT not null
primary key,
ID TEXT,
award TEXT,
year INTEGER,
lgID TEXT,
note TEXT
);
CREATE TABLE HOF
(
year INTEGER,
hofID TEXT not null
primary key,
name TEXT,
category TEXT
);
CREATE TABLE Teams
(
year ... |
computer_student | List the course IDs and levels of person IDs from 40 to 50. | course IDs and levels refers to course.course_id and courseLevel; person IDs from 40 to 50 refers to taughtBy.p_id between 40 and 50 | SELECT T1.course_id, T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id BETWEEN 40 AND 50 | 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 ... |
menu | Among the menus in which the dish "Clear green turtle" had appeared, how many of them did not support taking out or booking in advance? | Clear green turtle is a name of dish; not support taking out or booking in advance refers to call_number is null; | SELECT SUM(CASE WHEN T4.name = 'Clear green turtle' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.call_number IS NULL | 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 ... |
software_company | What is the total number of customers with an age below 30? | age below 30 refers to age < 30; | SELECT COUNT(ID) FROM Customers WHERE age < 30 | CREATE TABLE Demog
(
GEOID INTEGER
constraint Demog_pk
primary key,
INHABITANTS_K REAL,
INCOME_K REAL,
A_VAR1 REAL,
A_VAR2 REAL,
A_VAR3 REAL,
A_VAR4 REAL,
A_VAR5 REAL,
A_VAR6 REAL,
A_VAR7 REAL,
... |
world | Among the cities with a population between 140000 and 150000, list the country that has life expectancy greater than 80% life expectancy of all countries. | life expectancy greater than 80% life expectancy of all countries refers to LifeExpectancy < (MULTIPLY(AVG(LifeExpectancy), 0.8)); | SELECT T2.Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.Code WHERE T1.Population BETWEEN 140000 AND 150000 GROUP BY T2.Name, LifeExpectancy HAVING LifeExpectancy < ( SELECT AVG(LifeExpectancy) FROM Country ) * 0.8 | 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... |
professional_basketball | Among the players born in Whitestone, how many of them have won the MVP? | "Whitestone" is the birthCity of the player; won the MVP refers to award = 'Most Valuable Player' | SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'Houston' | 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... |
student_loan | What is the average of absence for an employed students? | average refers to DIVIDE(SUM(month), COUNT(name)) | SELECT AVG(month) FROM longest_absense_from_school WHERE name NOT IN ( SELECT name FROM unemployed ) | 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... |
retail_world | Calculate the average payment per product under confections category. | under confections category refers to CategoryName = 'Confections'; | SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) / COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Categories AS T3 ON T1.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Confections' | 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 | Describe the award title, person and character name of the award ID 326. | SELECT DISTINCT T1.award, T1.person, T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award_id = 326; | 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 | Which employee has been in the Engineering Department the longest? Please give his or her firstname and lastname. | length of stay in a department = SUBTRACT(EndDate, StartDate); | SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T3.Name = 'Engineering' ORDER BY T2.EndDate - T2.StartDate 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
... |
retail_world | What is the description of the category that tofu belongs to? | tofu is the name of the product; | SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu' | 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,
... |
shipping | What is the truck's model year used to ship the ship ID 1245? | SELECT T1.model_year FROM truck AS T1 INNER JOIN shipment AS T2 ON T1.truck_id = T2.truck_id WHERE T2.ship_id = '1245' | 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... | |
simpson_episodes | How many of the crew members who are taller than 1.70m were born in Canada? | taller than 1.70m refers to height_meters > 1.70; born in Canada refers to birth_country = 'Canada' | SELECT COUNT(name) FROM Person WHERE height_meters > 1.70 AND birth_country = 'Canada'; | 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 | What are the footnote description of Finland in year 2000? | Finland is the short name of the country; year 2000 refers to Year = 'YR2000'; | SELECT DISTINCT T2.Description FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.TableName = 'Finland' AND T2.Year = 'YR2000' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
bike_share_1 | List the name of stations that were installed from 8/5/2013 to 12/31/2013. Indicate their installation date and city name. | from 8/5/2013 to 12/31/2013 refers to installation_date between '8/5/2013' and '12/31/2013'; | SELECT name, installation_date, city FROM station WHERE (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) = '5' AND SUBSTR(CAST(installation_date AS TEXT), INSTR(installation_date, '/') + 1, -6) >= '8' AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR (SUBSTR(CAST(installation_da... | 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... |
public_review_platform | Please list all business IDs in Mesa city that review stars of over 3. | stars > 3; | SELECT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Mesa' AND T2.review_stars > 3 GROUP BY T1.business_id | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
social_media | Please give the user ID of the user who has posted the most tweets. | users with the most tweet refers to UserID where Max(Count (TweetID)) | SELECT UserID FROM twitter GROUP BY UserID ORDER BY COUNT(DISTINCT TweetID) DESC LIMIT 1 | CREATE TABLE location
(
LocationID INTEGER
constraint location_pk
primary key,
Country TEXT,
State TEXT,
StateCode TEXT,
City TEXT
);
CREATE TABLE user
(
UserID TEXT
constraint user_pk
primary key,
Gender TEXT
);
CREATE TABLE twitter
(
... |
legislator | Provide the full name and birth date of the legislator with a contact form of http://www.brown.senate.gov/contact/. | full name refers to official_full_name; birth date refers to birthday_bio; | SELECT T1.official_full_name, T1.birthday_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.contact_form = 'http://www.brown.senate.gov/contact/' | CREATE TABLE current
(
ballotpedia_id TEXT,
bioguide_id TEXT,
birthday_bio DATE,
cspan_id REAL,
fec_id TEXT,
first_name TEXT,
gender_bio TEXT,
google_entity_id_id TEXT,
govtrack_id INTEGER,
house_history_id ... |
menu | Name the dishes that were on the menu page ID 174. | FALSE; | SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 174 | 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 ... |
retail_world | How many products were supplied by Pavlova, Ltd.? | Pavlova, Ltd. refers to CompanyName = 'Pavlova, Ltd.' | SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Pavlova, Ltd.' | 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,
... |
soccer_2016 | List the IDs and names of the umpires from New Zealand. | New Zealand refers to Country_Name = 'New Zealand'; ID of the umpire refers to Umpire_Id; name of the umpire refers to Umpire_Name | SELECT T1.Umpire_Id, T1.Umpire_Name FROM Umpire AS T1 INNER JOIN Country AS T2 ON T1.Umpire_Country = T2.Country_Id WHERE T2.Country_Name = 'New Zealand' | 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... |
food_inspection | What is the average score of the establishments owned by the owner with the highest number of establishments? | average score refers avg(score); owner with the highest number of establishments refers to owner_name where MAX(COUNT(business_id)); | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T2.business_id) DESC LIMIT 1 | 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... |
computer_student | Find the ID of advisor of student ID 80 and state the level of courses taught by him/her. | ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel | SELECT T1.p_id_dummy, T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id = 80 | 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 ... |
movielens | Action movies are mostly directed by directors of which country? | SELECT T3.country FROM movies2directors AS T1 INNER JOIN directors AS T2 ON T1.directorid = T2.directorid INNER JOIN movies AS T3 ON T1.movieid = T3.movieid WHERE T1.genre = 'Action' GROUP BY T3.country ORDER BY COUNT(T3.country) DESC LIMIT 1 | CREATE TABLE users
(
userid INTEGER default 0 not null
primary key,
age TEXT not null,
u_gender TEXT not null,
occupation TEXT not null
);
CREATE TABLE IF NOT EXISTS "directors"
(
directorid INTEGER not null
primary key,
d_quality INTEGER not null,
avg... | |
shipping | What is the full name of the driver who delivered the most shipments to the least populated city? | least populated city refers to Min(population); fullname refers to first_name, last_name; most shipment refers to driver_id where Max(Count (ship_id)) | SELECT T1.first_name, T1.last_name FROM driver AS T1 INNER JOIN shipment AS T2 ON T1.driver_id = T2.driver_id INNER JOIN city AS T3 ON T3.city_id = T2.city_id GROUP BY T1.first_name, T1.last_name, T3.population HAVING T3.population = MAX(T3.population) ORDER BY COUNT(*) DESC LIMIT 1 | 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... |
university | Provide the ID of the university with the highest percentage of female students in 2012. | in 2012 refers to year = 2012; highest percentage of female students refers to MAX(pct_female_students); ID of the university refers to university_id | SELECT university_id FROM university_year WHERE year = 2012 ORDER BY pct_female_students 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
... |
disney | Among all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing. | DIVIDE(COUNT(movie_title where director = 'Gary Trousdale' and total_gross > 100000000), COUNT(movie_title where director = 'Gary Trousdale')) as percentage; | SELECT CAST(COUNT(CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale' | 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... |
legislator | What is the official Twitter handle of Jason Lewis? | official Twitter handle refers to twitter; | SELECT T2.twitter FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Jason Lewis' | CREATE TABLE current
(
ballotpedia_id TEXT,
bioguide_id TEXT,
birthday_bio DATE,
cspan_id REAL,
fec_id TEXT,
first_name TEXT,
gender_bio TEXT,
google_entity_id_id TEXT,
govtrack_id INTEGER,
house_history_id ... |
works_cycles | What is the total profit all transactions with product ID 827? | Profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity)) | SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827 | 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
... |
movies_4 | What is the name of the director of photography of the movie "Pirates of the Caribbean: At World's End"? | name of the director of photography refers to person_name where job = 'Director of Photography'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End' | 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 LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Director of Photography' | CREATE TABLE country
(
country_id INTEGER not null
primary key,
country_iso_code TEXT default NULL,
country_name TEXT default NULL
);
CREATE TABLE department
(
department_id INTEGER not null
primary key,
department_name TEXT default NULL
);
CREATE TABLE gender
(
... |
olympics | How many times was Larysa Semenivna Latynina (Diriy-) declared as champion in Gymnastics Women's Individual All-Around? | Gymnastics Women's Individual All-Around refers to event_name = 'Gymnastics Women''s Individual All-Around'; declared as champion refers to medal_name = 'Gold' or medal_id = 1; | SELECT COUNT(T1.id) FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person AS T4 ON T3.person_id = T4.id WHERE T4.full_name = 'Larysa Semenivna Latynina (Diriy-)' AND T1.event_name LIKE 'Gymnastics Women%s Individual All-... | 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... |
works_cycles | What is the PreferredVendorStatus for the company which has the rowguid of "684F328D-C185-43B9-AF9A-37ACC680D2AF"? | PreferredVendorStatus = 1 means 'Do not use if another vendor is available'; CreditRating = 2 means 'Preferred over other vendors supplying the same product' | SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF' | 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
... |
restaurant | What is the rating of each restaurant reviews on Atlantic Ave? | Atlantic Ave refers to street_name = 'atlantic ave'; rating refers to review | SELECT T1.review FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T2.street_name = 'atlantic 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... |
superstore | What is the ship date of the order by the customer named Ann Chong in the central region? | Ann Chong' is the "Customer Name"; Region = 'Central' | SELECT T2.`Ship Date` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Ann Chong' AND T1.Region = 'Central' | 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... |
world | How many languages are used in Cyprus? | Cyprus is a name of Country; | SELECT SUM(CASE WHEN T1.Name = 'Cyprus' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode | 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... |
cs_semester | Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name; | SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert' | 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... |
software_company | In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response? | DIVIDE(COUNT(OCCUPATION = 'Handlers-cleaners', SEX = 'Male' and RESPONSE = 'true'), COUNT(OCCUPATION = 'Handlers-cleaners' and SEX = 'Male')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.RESPONSE = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.REFID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.OCCUPATION = 'Handlers-cleaners' AND T1.SEX = 'Male' | 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,
... |
world_development_indicators | Which nation completed its external debt reporting in 1980 and had a Land under cereal production value of 3018500? | completed its external debt reporting refers to ExternalDebtReportingStatus = 'Actual'; in 1980 refers to year = 1980; Land under cereal production value of 3018500 refers to value = 3018500 | SELECT T2.CountryCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName LIKE 'Land under cereal production%' AND T1.Value = 3018500 AND T1.Year = 1980 AND T2.ExternalDebtReportingStatus = 'Actual' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
cars | What is the percentage of Japanese cars in the database? | Japanese car refers to country = 'Japan'; percentage = divide(count(ID where country = 'Japan'), count(ID)) * 100% | SELECT CAST(SUM(CASE WHEN T2.country = 'Japan' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin | 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 | Write down the ID, active status and city of the business which are in CA state. | the ID refers to business_id; active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is closed or not running now | SELECT business_id, active, city FROM Business WHERE state = 'CA' AND active = '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 ... |
video_games | What is the name of the publisher that released the most video games in 2007? | name of the publisher refers to publisher_name; publisher that released the most video games in 2007 refers to MAX(COUNT(publisher_name)) WHERE release_year = 2007; | SELECT T3.publisher_name FROM game_platform AS T1 INNER JOIN game_publisher AS T2 ON T1.game_publisher_id = T2.id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id WHERE T1.release_year = 2007 GROUP BY T3.publisher_name ORDER BY COUNT(DISTINCT T2.game_id) DESC LIMIT 1 | CREATE TABLE genre
(
id INTEGER not null
primary key,
genre_name TEXT default NULL
);
CREATE TABLE game
(
id INTEGER not null
primary key,
genre_id INTEGER default NULL,
game_name TEXT default NULL,
foreign key (genre_id) references genre(id)
);
C... |
mondial_geo | Which of the top 3 economies by GDP has the lowest proportion of the economy devoted to agriculture? | Economies refers to countries | SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC, T2.Agriculture 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... |
retail_world | How many suppliers are there in the United States of America? | United States of America refers to Country = 'USA' | SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'USA' | 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 | List out the country name of lower earning countries | lower earning countries refer to IncomeGroup = 'Low income'; | SELECT DISTINCT T2.CountryName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IncomeGroup = 'Low income' | CREATE TABLE IF NOT EXISTS "Country"
(
CountryCode TEXT not null
primary key,
ShortName TEXT,
TableName TEXT,
LongName TEXT,
Alpha2Code ... |
university | How many times did the Yale University achieve a score of no less than 10 in the Quality of Education Rank? | Yale University refers to university_name = 'Yale University'; a score of no less than 10 refers to score > = 10; in the Quality of Education Rank refers to criteria_name = 'Quality of Education Rank' | SELECT COUNT(*) 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 T3.university_name = 'Yale University' AND T2.score >= 10 AND T1.criteria_name = 'Quality of Education Rank' | 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
... |
authors | Please list the titles of any two papers that Jundu has written. | papers that Jundu has written refers to Name LIKE '%Jun du%' | SELECT T1.Title FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T2.Name LIKE 'Jun du%' LIMIT 2 | 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... |
ice_hockey_draft | Name the player who has the most NHL points in draft year. | name of the player refers to PlayerName; most NHL points in draft year refers to MAX(P); | SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.P = ( SELECT MAX(P) FROM SeasonStatus ) | CREATE TABLE height_info
(
height_id INTEGER
primary key,
height_in_cm INTEGER,
height_in_inch TEXT
);
CREATE TABLE weight_info
(
weight_id INTEGER
primary key,
weight_in_kg INTEGER,
weight_in_lbs INTEGER
);
CREATE TABLE PlayerInfo
(
ELITEID INTE... |
simpson_episodes | What are the keywords of the episodes which have the air date in 2008? | have air date in 2008 refers to air_date LIKE '2008%' | SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008'; | 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,
... |
retail_world | What is the stock value of every condiments? | "Condiments" is the CategoryName; Stock value = MULTIPLY( UnitPrice, UnitInStock) | SELECT T1.UnitPrice * T1.UnitsInStock FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID | 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,
... |
professional_basketball | Among the players who went to high school in Chicago, how many of them belongs to the west conference? | high school in Chicago refers to hsCity = 'Chicago'; belong to the west conference refers to divID = 'WE' | SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.hsCity = 'Chicago' AND T2.conference = 'West' | 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... |
app_store | What is the rating for "Garden Coloring Book"? List all of its reviews. | Golfshot Plus: Golf GPS refers to App = 'Golfshot Plus: Golf GPS'; review refers to Translated_Review; | SELECT T1.Rating, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Garden Coloring Book' | 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... |
image_and_language | Provide the number of predicted classes. | predicted classes refers to PRED_CLASS | SELECT COUNT(PRED_CLASS_ID) FROM PRED_CLASSES | 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... |
university | Among the universities with over 20000 students in 2011, how many of them have an international students percentage of over 25% in the same year? | in 2011 refers to year 2011; with over 20000 students refers to num_students > 20000; international students percentage of over 25% refers to pct_international_students > 25; | SELECT COUNT(*) FROM university_year WHERE year = 2011 AND pct_international_students > 25 AND num_students > 20000 | 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
... |
cars | What is the average price of model 70 cars? | model 70 refers to model = 70; average price = avg(price) where model = 70 | SELECT AVG(T2.price) FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.model = 70 | 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... |
european_football_1 | Please provide the names of any three away teams that competed in the Italian divisions. | Italian means belong to country = 'Italy"; | SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.country = 'Italy' LIMIT 3 | 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... |
food_inspection | In 2016, which city has the highest number of establishments with the highest health and safety hazards? | the highest health and safety hazards refer to risk_category = 'High Risk'; year(date) = 2016; establishments has the same meaning as businesses; | SELECT T2.city FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T1.risk_category = 'High Risk' GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1 | 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... |
works_cycles | What is the cost and the product number of product with the id "888"? | cost refers to StandardCost; | SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888 | CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE CountryRegion
(
CountryRegionCode TEXT not null
primary key,
Name TEXT not null
unique,
ModifiedDate DATETIME default current_timestamp not null
);
CREATE TABLE Culture
... |
synthea | What is the prevalence rate of the patients' diseases started on 9th May 2014? | diseases started on 9th May 2014 refer to DESCRIPTION from conditions where START = '5/9/2014'; | SELECT T2."PREVALENCE RATE" FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T1.DESCRIPTION) = lower(T2.ITEM) WHERE T1.START = '2014-05-09' | 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
... |
student_loan | How many students enlist in the air force organization? | organization refers to organ; organ = 'air_force'; | SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' | CREATE TABLE bool
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE person
(
"name" TEXT default '' not null
primary key
);
CREATE TABLE disabled
(
"name" TEXT default '' not null
primary key,
foreign key ("name") references person ("name")
on update c... |
book_publishing_company | Which employee has the lowest job level. State the first name, last name and when he /she was hired. | lowest job level refers to MIN(job_lvl) | SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl LIMIT 1 | 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,... |
beer_factory | What are the full names of the first top 10 customers? | full name = First Last; first top 10 customers refers to MIN(FirstPurchaseDate) LIMIT 10; | SELECT First, Last FROM customers ORDER BY FirstPurchaseDate LIMIT 10 | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
donor | What is the percentage of payment methods of donations made in March 2013? | made in March 2013 refers to substr(donation_timestamp,1,7) = '2013-03'; percentage refers to DIVIDE(SUM(payment_method made in March 2013), SUM(payment_method))*100 | SELECT payment_method , CAST(COUNT(donationid) AS REAL) * 100 / 51090 FROM donations WHERE donation_timestamp LIKE '2013-03%' GROUP BY payment_method | 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 ... |
beer_factory | What is the full name of the customer who gave a 5-star rating and commented "The quintessential dessert root beer. No ice cream required" on his review? | full name = First, Last; 5-star rating refers to StarRating = 5; commented "The quintessential dessert root beer. No ice cream required" refers to Review = 'The quintessential dessert root beer. No ice cream required.'; | SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.Review = 'The quintessential dessert root beer. No ice cream required.' | CREATE TABLE customers
(
CustomerID INTEGER
primary key,
First TEXT,
Last TEXT,
StreetAddress TEXT,
City TEXT,
State TEXT,
ZipCode INTEGER,
Email TEXT,
Phone... |
world | What city in Russia has the least population? | Russia is a name of country; least population refers to MIN(Population); | SELECT T2.Name FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Russian Federation' ORDER BY T2.Population ASC 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... |
public_review_platform | Among the users whose fan is medium, how many users received high compliments from other users. | is medium refers to user_fans = 'Medium'; high compliments refers to number_of_compliments = 'High' | SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_fans = 'Medium' | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
image_and_language | List the object classes of image ID 36 with coordinates (0,0). | object classes of image ID 36 refers to OBJ_CLASS where IMG_ID = 36; coordinates (0,0) refer to X and Y coordinates of the bounding box where X = 0 and Y = 0; | SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 36 AND T1.X = 0 AND T1.Y = 0 | CREATE TABLE ATT_CLASSES
(
ATT_CLASS_ID INTEGER default 0 not null
primary key,
ATT_CLASS TEXT not null
);
CREATE TABLE OBJ_CLASSES
(
OBJ_CLASS_ID INTEGER default 0 not null
primary key,
OBJ_CLASS TEXT not null
);
CREATE TABLE IMG_OBJ
(
IMG_ID INTEGER default 0... |
restaurant | Which chicken restaurant has the highest review? | chicken restaurant refers to food_type = 'chicken'; the highest review refers to max(review) | SELECT label FROM generalinfo WHERE food_type = 'chicken' ORDER BY review DESC LIMIT 1 | CREATE TABLE geographic
(
city TEXT not null
primary key,
county TEXT null,
region TEXT null
);
CREATE TABLE generalinfo
(
id_restaurant INTEGER not null
primary key,
label TEXT null,
food_type TEXT null,
city TEXT null,
review REA... |
movies_4 | For the movie "Reign of Fire", which department was Marcia Ross in? | movie "Reign of Fire" refers to title = 'Reign of Fire'; which department refers to department_name | SELECT T4.department_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 INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T3.person_name = 'Marcia Ross' AND T1.title = 'Reign of Fire' | 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
(
... |
car_retails | How many sales representatives who have office code is 1? | sales representative refers to jobTitle = 'Sales Rep'; | SELECT COUNT(officeCode) FROM employees WHERE jobTitle = 'Sales Rep' AND officeCode = 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... |
movielens | Please list the genre of the movies that are the newest and is in English. | Year contains relative value, higher year value refers to newer date; Year = 4 refers to newest date, Year = 1 refer to oldest date; In English means isEnglish = T | SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 4 AND T1.isEnglish = 'T' | 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... |
college_completion | List all the public institutes from the state with the least number of graduate cohort in 2013. | public refers to control = 'Public'; institutes refers to chronname; least number of graduate cohort refers to MIN(grad_cohort); in 2013 refers to year = 2013; | SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T1.state = T2.state WHERE T2.year = 2013 AND T1.control = 'Public' ORDER BY T2.grad_cohort LIMIT 1 | CREATE TABLE institution_details
(
unitid INTEGER
constraint institution_details_pk
primary key,
chronname TEXT,
city TEXT,
state TEXT,
level ... |
airline | Among the flights with air carrier "Southwest Airlines Co.: WN", provide the tail number of flights with an actual elapsed time lower than the 80% of the average actual elapsed time of listed flights. | Southwest Airlines Co.: WN refers to Description = 'Southwest Airlines Co.: WN'; tail number refers to TAIL_NUM; actual elapsed time lower than the 80% of the average actual elapsed time refers to ACTUAL_ELAPSED_TIME < (MULTIPLY AVG(ACTUAL_ELAPSED_TIME), 0.8); | SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southwest Airlines Co.: WN' AND T2.ACTUAL_ELAPSED_TIME < ( SELECT AVG(ACTUAL_ELAPSED_TIME) * 0.8 FROM Airlines ) | CREATE TABLE IF NOT EXISTS "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
);
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
);
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM ... |
address | State the male population for all zip code which were under the Berlin, NH CBSA. | "Berlin, NH" is the CBSA_name | SELECT T2.male_population FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Berlin, NH' GROUP BY T2.male_population | 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 ... |
law_episode | Please list any three episodes that were most enjoyed by the viewers. | episode refers to title; most enjoyed by the viewers refers to stars = 10 | SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 LIMIT 3 | 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 ... |
airline | Give the air carrier description of the flights that have an earlier arrival and departure. | earlier arrival and departure refers to ARR_DELAY < 0 AND DEP_DELAY < 0; | SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_DELAY < 0 AND T2.DEP_DELAY < 0 GROUP BY T1.Description | CREATE TABLE IF NOT EXISTS "Air Carriers"
(
Code INTEGER
primary key,
Description TEXT
);
CREATE TABLE Airports
(
Code TEXT
primary key,
Description TEXT
);
CREATE TABLE Airlines
(
FL_DATE TEXT,
OP_CARRIER_AIRLINE_ID INTEGER,
TAIL_NUM ... |
chicago_crime | In the most populated ward, how many incidents of domestic violence were reported in a bar or tavern? | the most populated refers to max(population); domestic violence refers to domestic = 'TRUE'; in a bar or tavern refers to location_description = 'BAR OR TAVERN' | SELECT COUNT(T2.report_no) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.domestic = 'TRUE' AND T2.location_description = 'BAR OR TAVERN' ORDER BY T1.Population 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 ... |
public_review_platform | In which year did the user who has given the most number of "short" tips join the Yelp? | year the user join the Yelp refers to user_yelping_since_year; most number of short tips refers to MAX(COUNT(tip_length = 'Short')); | SELECT T2.user_yelping_since_year FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.tip_length LIKE 'short' GROUP BY T2.user_yelping_since_year ORDER BY COUNT(T1.tip_length) DESC LIMIT 1 | CREATE TABLE Attributes
(
attribute_id INTEGER
constraint Attributes_pk
primary key,
attribute_name TEXT
);
CREATE TABLE Categories
(
category_id INTEGER
constraint Categories_pk
primary key,
category_name TEXT
);
CREATE TABLE Compliments
(
compliment_id ... |
car_retails | List down the customer names with a disputed order status. | SELECT t1.customerName FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerNumber = t2.customerNumber WHERE t2.status = 'Disputed' | 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 | For the older production technician who was hired in 2008/12/7, what's his/her birthday? | Oldest production technician refers to MIN(BirthDate) where JobTitle = 'Production Technician' | SELECT BirthDate FROM Employee WHERE HireDate = '2008-12-07' | 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
... |
works_cycles | What is the primary type of all single female employees hired between 1/1/2008 to 12/31/2008? | primary type refers to PersonType; single refers to MaritalStatus = 'S"; female refers to Gender = 'F'; HireDate BETWEEN '2010-1-1'AND '2010-12-31'; | SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'F' AND T1.MaritalStatus = 'S' AND STRFTIME('%Y-%m-%d', T1.HireDate) BETWEEN '2008-1-1' AND '2008-12-31' GROUP BY T2.PersonType ORDER BY COUNT(T2.PersonType) 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
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.