db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
movie_platform
How many users gave "Pavee Lackeen: The Traveller Girl" movie a rating score of 4?
FALSE;
SELECT COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'Pavee Lackeen: The Traveller Girl' AND T2.rating_score = 4
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...
software_company
How many customers have never married?
MARITAL_STATUS = 'Never-married';
SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married'
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, ...
works_cycles
List all product only MOQ of 1,000 and with standard cost more than 17.
MOQ refers to minimum order quantity; MOQ of 1 refers to MinOrderQty = 1; standard cost more than 48 refers to StandardCost > 48;
SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaxOrderQty = 1000 AND T2.StandardCost > 17
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Culture ...
student_loan
How many students has the longest absense from school for 5 months?
absense from school for 5 month refers to month = 5
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 5
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...
sales_in_weather
How many units of item no.5 were sold in store no.3 on average on the days when the max temperature exceeded 90?
item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3;  when the maximum temperature exceed 90 refers to tmax > 90; average = Divide (Sum(units), Count(date))
SELECT CAST(SUM(T1.units) AS REAL) / COUNT(T1.`date`) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T1.store_nbr = 3 AND T1.item_nbr = 5 AND T3.tmax > 90
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...
video_games
In games that can be played on Wii, what is the percentage of games released in 2007?
Wii refers to platform_name = 'Wii'; percentage = MULTIPLY(DIVIDE(SUM(release_year = 2007), COUNT(release_year)), 100.0); released in 2007 refers to release_year = 2007;
SELECT CAST(COUNT(CASE WHEN T2.release_year = 2007 THEN T3.game_id ELSE NULL END) AS REAL) * 100 / COUNT(T3.game_id) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN game_publisher AS T3 ON T2.game_publisher_id = T3.id WHERE T1.platform_name = 'Wii'
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...
software_company
List down the customer's reference ID with true response.
reference ID refers to REFID;
SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true'
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, ...
restaurant
What does the one and only 24-hour diner's name?
24-hour diner refers to food_type = '24 hour diner'; diner name refers to label
SELECT label FROM generalinfo WHERE food_type = '24 hour diner'
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...
movielens
Please list the genre of the movies that are directed by the directors with the highest level of average revenue.
SELECT T2.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.avg_revenue = 4
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...
works_cycles
Please list the credit card IDs of the employees who work as store contact.
store contact refers to PersonType = 'SC';
SELECT T2.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
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
Among the players who were born in July and August, how many of them got in the Hall of Fame?
born in July and August refers to birthMon IN('7','8')
SELECT COUNT(T1.playerID) FROM Master AS T1 INNER JOIN HOF AS T2 ON T1.hofID = T2.hofID WHERE T1.birthMon IN (7, 8)
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 ...
hockey
What is the total number of game played for players from USA?
game played refers to GP; from USA refers to birthCountry = 'USA';
SELECT COUNT(T2.GP) FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'USA'
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 ...
movie_3
Find the full name and email address of inactive customers whose record was created in 2006.
full name refers to first_name, last_name; record created in 2006 refers to create_date = 2006; inactive customers refers to active = 0
SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND active = 0
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...
simpson_episodes
Name of the crew that were born in California, USA between 1958 and 1969.
born in California refers to birth_place = 'California'; USA refers to birth_country = 'USA'; between 1958 and 1969 refers to birthdate BETWEEN '1958-01-01' and '1958-12-31'
SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1958' AND birth_place = 'California' AND birth_country = 'USA';
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, ...
chicago_crime
Please list any three community areas with a population of more than 50,000.
population of more than 50000 refers to Population > 50000; community area refers to community_area_name
SELECT community_area_name FROM Community_Area WHERE population > 50000 LIMIT 3
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 ...
sales
Calculate the revenue produced through sales of HL Road Frame - Red, 56.
revenue = MULTIPLY(SUM(Quantity, Price)); 'HL Road Frame - Red, 56' is name of product;
SELECT SUM(T2.Quantity * T1.Price) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Road Frame - Red, 56'
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...
talkingdata
How many events have happened on device no.29182687948017100 in 2016?
device no. refers to device_id; device_id = 29182687948017100; in 2016 refers to `timestamp` LIKE '2016%';
SELECT COUNT(event_id) FROM `events` WHERE SUBSTR(`timestamp`, 1, 4) = '2016' AND device_id = 29182687948017100
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...
image_and_language
Provide the x-coordinate and y-coordinate of the image with an attribute class of ''horse" and an object class of "fur".
attribute class of "horse" refers to ATT_CLASS = 'horse'; object class of "fur" refers to OBJ_CLASS = 'fur';
SELECT T3.X, T3.Y FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.ATT_CLASS = 'horse' AND T4.OBJ_CLASS = 'fur'
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...
movies_4
How many production companies made more than 150 movies?
more than 150 movies refers to COUNT(company_name) > 150
SELECT COUNT(*) FROM ( SELECT T1.company_name AS CNAME FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(T1.company_name) > 150 )
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 ( ...
chicago_crime
How many incidents are considered "severe" in the IUCR classification?
severe refers to index_code = 'I'; incidents refers to iucr_no
SELECT COUNT(*) FROM IUCR WHERE index_code = 'I'
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 ...
disney
Who is the director of the adventure movie which was released on 2007/3/30?
released on 2007/3/30 refers to release_date = 'Mar 30, 2007'; adventure movie refers to genre = 'Adventure' ;
SELECT T1.director FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.name WHERE T2.genre = 'Adventure' AND T2.release_date = 'Mar 30, 2007'
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...
software_company
List the level of education and income of customers ages from 30 to 55 with a true response.
ages from 30 to 55 refer to age BETWEEN 30 AND 55; RESPONSE = 'true'; income refers to INCOME_K; education level refers to EDUCATIONNUM;
SELECT T1.EDUCATIONNUM, T3.INCOME_K FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.age >= 30 AND T1.age <= 55 AND T2.RESPONSE = 'true'
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, ...
mondial_geo
Please list the deserts in the countries whose population is over 100000 and covers an area of under 500000.
SELECT T2.Desert FROM country AS T1 INNER JOIN geo_desert AS T2 ON T1.Code = T2.Country WHERE T1.Area > 100000 AND T1.Population < 500000
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...
movie_3
List down all of the customers' first name who were attended by staff with ID 1.
SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.staff_id = 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...
books
In books authored by Abraham Lincoln, what is the percentage of the books published in 1992?
"Abraham Lincoln" is the author_name; published in 1992 refers to publication_date LIKE '1992%'; percentage = Divide (Sum(publication_date LIKE '1992%'), Count(publication_date)) * 100
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.publication_date) = '1992' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Abraham Lincoln'
CREATE TABLE address_status ( status_id INTEGER primary key, address_status TEXT ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT ); CREATE TABLE book_language ( language_id INTEGER primary key, language_code TEXT, language...
public_review_platform
How long was the review for business number 2 that user number 612 wrote?
how long was the review refers to review_length; business number refers to business_id; user number refers to user_id;
SELECT review_length FROM Reviews WHERE user_id = 612 AND review_stars = 5 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 ...
video_games
Mention the genre of the 2Xtreme.
genre refers to genre_name; the 2Xtreme game refers to game_name = '2Xtreme'
SELECT T2.id FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2Xtreme'
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...
public_review_platform
List out the state of businesses which have opening time at 1AM.
state refers to city
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.opening_time = '1AM'
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id ...
works_cycles
What is the salary rate per hour that the company paid to the first 5 employees that they hired?
salary rate per hour refers to Rate; first 5 employees that were hired refers to 5 oldest HireDate;
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID ORDER BY T2.HireDate ASC LIMIT 0, 5
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Culture ...
chicago_crime
What is the first name of the aldermen of wards with more than 50,000 inhabitants?
more than 50000 inhabitants refers to Population > 50000; first name of alderman refers to alderman_first_name
SELECT alderman_first_name FROM Ward WHERE Population > 50000
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 ...
works_cycles
Please list the job titles of the employees who has a document that has been approved.
document has been approved refers to Status = 2
SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2
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
Who was taking charge of orders from Morristown?
Morristown refers to TerritoryDescription = 'Morristown'
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Morristown'
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
olympics
Which city was the host of 1936 Winter Olympic Games?
Which city refers to city_name; 1936 Winter Olympic refers to games_name = '1936 Winter';
SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1936 Winter'
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...
mondial_geo
When did Equatorial Guinea become independent?
Equatorial Guinea is a country
SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Equatorial Guinea'
CREATE TABLE IF NOT EXISTS "borders" ( Country1 TEXT default '' not null constraint borders_ibfk_1 references country, Country2 TEXT default '' not null constraint borders_ibfk_2 references country, Length REAL, primary key (Country1, Country2) ); CREATE TABLE I...
works_cycles
What is the bussiness id for Mr. Hung-Fu Ting?
business id refers to BusinessEntityID;
SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'
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
How many patients on average receive combined chemotherapy and radiation therapy procedures each year?
average = DIVIDE(COUNT(procedures.PATIENT), COUNT(substr(procedures.DATE, 1, 4))); combined chemotherapy and radiation therapy refers to procedures.DESCRIPTION = 'Combined chemotherapy and radiation therapy (procedure)';
SELECT CAST(COUNT(PATIENT) AS REAL) / COUNT(DISTINCT strftime('%Y', DATE)) FROM procedures WHERE DESCRIPTION = 'Combined chemotherapy and radiation therapy (procedure)'
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 ...
retail_world
Please list the IDs of the orders with a product whose production is not continuous.
IDs of the orders refers to OrderID; production is not continuous refers to Discontinued = 1;
SELECT T2.OrderID FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
cookbook
List the names of alcohol free recipes.
alcohol free refers to alcohol = 0
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0
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...
social_media
How many tweets have a klout of over 50?
klout of over 50 refers to Klout > 50
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Klout > 50
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 ( ...
retails
What is the comment of the product "burlywood plum powder puff mint"?
comment refers to p_comment; product "burlywood plum powder puff mint" refers to p_name = 'burlywood plum powder puff mint'
SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'
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`),...
soccer_2016
How many seasons did Pune Warriors participate in?
Pune Warriors refers to Team_Name = 'Pune Warriors'
SELECT COUNT(T.Season_Year) FROM ( SELECT T4.Season_Year FROM Team AS T1 INNER JOIN Match AS T2 ON T1.team_id = T2.match_winner INNER JOIN Player_Match AS T3 ON T1.Team_Id = T3.Team_Id INNER JOIN Season AS T4 ON T2.Season_Id = T4.Season_Id WHERE T1.Team_Name = 'Pune Warriors' GROUP BY T4.Season_Year ) T
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...
image_and_language
To which predicted relation class does the self-relation of the object sample in image no.5 belong?
predicted relation class refers to PRED_CLASS; self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 5 AND T2.OBJ1_SAMPLE_ID = T2.OBJ2_SAMPLE_ID
CREATE TABLE ATT_CLASSES ( ATT_CLASS_ID INTEGER default 0 not null primary key, ATT_CLASS TEXT not null ); CREATE TABLE OBJ_CLASSES ( OBJ_CLASS_ID INTEGER default 0 not null primary key, OBJ_CLASS TEXT not null ); CREATE TABLE IMG_OBJ ( IMG_ID INTEGER default 0...
superstore
Please list the names of all the products ordered in order CA-2011-112326 in superstores in the center.
names of all the products refers to "Product Name"; order CA-2011-112326 refers to "Order ID" = 'CA-2011-112326'; in the center refers to Region = 'Central';
SELECT DISTINCT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order ID` = 'CA-2011-112326'
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...
address
What is the highest gender ratio of the residential areas in Arecibo county?
"ARECIBO" is the county; highest gender ration refers to Max(Divide (male_population, female_population))
SELECT CAST(T1.male_population AS REAL) / T1.female_population FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' AND T1.female_population <> 0 ORDER BY 1 DESC LIMIT 1
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 ...
world
List down the official language of the countries which declared independence after 1990,
official lanaguage refers to IsOfficial = 'T'; declared independence after 1990 refers to IndepYear > 1990;
SELECT T1.Name, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.IndepYear > 1990 AND T2.IsOfficial = 'T'
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE `City` ( `ID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `Name` TEXT NOT NULL DEFAULT '', `CountryCode` TEXT NOT NULL DEFAULT '', `District` TEXT NOT NULL DEFAULT '', `Population` INTEGER NOT NULL DEFAULT 0, FOREIGN KEY (`CountryCode`) REFERENCES `Countr...
shakespeare
List the paragraph number and paragraphs said by the character named "Sir Andrew Aguecheek".
paragraph number refers to ParagraphNum; character named "Sir Andrew Aguecheek" refers to CharName = 'Sir Andrew Aguecheek'
SELECT T2.ParagraphNum, T2.id FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Sir Andrew Aguecheek'
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...
works_cycles
Among the Production Technicians who are single, how many of them are vendor contact?
Production Technicians refer to the  JobTitle = 'Production Technician%'; single refers to MaritalStatus = 'S'; Vendor contact refers to PersonType = 'VC'
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T1.MaritalStatus = 'S' AND T2.PersonType = 'VC'
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
What is the percentage of 5 star ratings River City brand root beer get?
percentage = MULTIPLY(DIVIDE(SUM(BrandID WHERE StarRating = 5), COUNT(BrandID) WHERE BrandName = 'River City'), 1.0); 5 star ratings refers to StarRating = 5; River City refers to BrandName = 'River City';
SELECT CAST(COUNT(CASE WHEN T2.StarRating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.StarRating) FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'River City'
CREATE TABLE customers ( CustomerID INTEGER primary key, First TEXT, Last TEXT, StreetAddress TEXT, City TEXT, State TEXT, ZipCode INTEGER, Email TEXT, Phone...
regional_sales
How many products sold by Adam Hernandez?
products sold by Adam Hernandez refer to SUM(Order Quantity where Sales Team = 'Adam Hernandez');
SELECT SUM(CASE WHEN T2.`Sales Team` = 'Adam Hernandez' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
public_review_platform
Tell the number of "hair removal" Yelp businesses.
hair removal refers to category_name = 'Hair Removal';
SELECT COUNT(T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Hair Removal'
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id ...
soccer_2016
Who is the oldest player?
name of the player refers to Player_Name; the oldest refers to min(DOB)
SELECT Player_Name FROM Player ORDER BY DOB ASC LIMIT 1
CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT ); CREATE TABLE Bowling_Style ( Bowling_Id INTEGER primary key, Bowling_skill TEXT ); CREATE TABLE City ( City_Id INTEGER primary key, City_Name TEXT, Country_id INTEGE...
synthea
Describe the care plans of patient Major D'Amore's plan of care.
SELECT DISTINCT T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Major' AND T1.last = 'D''Amore'
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 ...
law_episode
How many credits have been displayed from episode 1 until 10?
credit displayed refers to credited = 'true'; from episode 1 until 10 refers to episode > = 1 AND episode < = 10
SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.credited = 'true' AND T2.episode BETWEEN 1 AND 10
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 ...
world_development_indicators
What's the long name of the country that got 3000000 on the indicator Arms exports in 1960?
long name refers to CountryName; got 3000000 on the indicator Arms exports refers to value where IndicatorName = 'Arms exports (SIPRI trend indicator values)' = 3000000; in 1960 refers to Year = 1960
SELECT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Arms exports (SIPRI trend indicator values)' AND T2.Year = 1960 AND T2.Value = 3000000
CREATE TABLE IF NOT EXISTS "Country" ( CountryCode TEXT not null primary key, ShortName TEXT, TableName TEXT, LongName TEXT, Alpha2Code ...
professional_basketball
What is the name of the coach during whose period of coaching, a team has the most numbers of games won in the post-season games?
the most number of game won in post season refers to Max(post_wins); coach refers to coachID
SELECT coachID FROM coaches ORDER BY post_wins 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...
works_cycles
Who is the oldest married male? State his job title.
Male refers to Gender = 'M'; married refers to MaritalStatus = 'M'; oldest refers to Min(BirthDate);
SELECT T2.FirstName, T2.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T1.MaritalStatus = 'M' ORDER BY T1.BirthDate 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 ...
public_review_platform
How many "cool" compliments did user number 33 receive?
cool compliments refers to compliment_type = 'cool'; user number refers to user_id;
SELECT COUNT(T2.compliment_type) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.user_id = 33 AND T2.compliment_type LIKE 'cool'
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 ...
address
Give the name of the country and state of the city with elevation of 1039.
elevation of 1039 refers to elevation = 1039
SELECT DISTINCT T1.name, T2.state 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 T3.elevation = 1039
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 ...
image_and_language
List all the object classes of the images that have a (5,5) coordinate.
object classes refer to OBJ_CLASS; (5,5) coordinates refer to X and Y coordinates of the bounding box where X = 5 and Y = 5;
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.X = 5 AND T1.Y = 5
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...
works_cycles
List all products with minimum order quantity of 100 and order them by product name in descending order.
miinimum order quantity refers to MinOrderQty = 100
SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC
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 ...
food_inspection_2
Among the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.
failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7)
SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee )
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
Provide the name, located country, and life expectancy of the most populated city
most populated city refers to MAX(Population);
SELECT T2.Name, T1.Code, T1.LifeExpectancy FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.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...
movielens
How many separate 35 year-old uesers have rated the movie from UK?
UK is a country
SELECT COUNT(DISTINCT T2.userid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T2.userid = T3.userid WHERE T1.country = 'UK' AND T3.age = 35
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...
works_cycles
List all the products with lower than average cost.
cost refers to StandardCost; lower than average cost = StandardCost<(AVG(StandardCost));
SELECT DISTINCT T2.ProductID FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost < ( SELECT SUM(StandardCost) / COUNT(ProductID) FROM Product )
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Culture ...
olympics
How many athletes in the database are from Guatemala?
from Guatemala refers to region_name = 'Guatemala';
SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Guatemala'
CREATE TABLE city ( id INTEGER not null primary key, city_name TEXT default NULL ); CREATE TABLE games ( id INTEGER not null primary key, games_year INTEGER default NULL, games_name TEXT default NULL, season TEXT default NULL ); CREATE TABLE ga...
video_games
How many FIFA games are there across all platforms?
FIFA games refers to game_name LIKE '%FIFA%';
SELECT COUNT(*) FROM ( SELECT T.game_name FROM game AS T WHERE T.game_name LIKE '%FIFA%' )
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...
legislator
How many of the legislators are male?
male refers to gender_bio = 'M';
SELECT COUNT(*) FROM current WHERE gender_bio = 'M'
CREATE TABLE current ( ballotpedia_id TEXT, bioguide_id TEXT, birthday_bio DATE, cspan_id REAL, fec_id TEXT, first_name TEXT, gender_bio TEXT, google_entity_id_id TEXT, govtrack_id INTEGER, house_history_id ...
movie_platform
How many critics of the movie "Imitation of Life" got more than 1 like?
Imitation of Life refers to movie_title; critics got more than 1 like refers to critic_likes >1;
SELECT COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Imitation of Life' AND T1.critic_likes > 1
CREATE TABLE IF NOT EXISTS "lists" ( user_id INTEGER references lists_users (user_id), list_id INTEGER not null primary key, list_title TEXT, list_movie_number INTEGER, list_update_timestamp_utc TEXT, list_creat...
beer_factory
What is the full name of the customer that had made the most transactions in August, 2014?
full name = First, Last; made the most transactions refers to MAX(COUNT(TransactionID)); in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y-%m', T2.TransactionDate) = '2014-08' GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1
CREATE TABLE customers ( CustomerID INTEGER primary key, First TEXT, Last TEXT, StreetAddress TEXT, City TEXT, State TEXT, ZipCode INTEGER, Email TEXT, Phone...
works_cycles
What is the person's business ID with a vista credit card number "11113366963373"?
business id refers to BusinessEntityID
SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373
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 ...
movie_3
List at least 10 films that the customers can rent for more than 5 days.
film refers to title; rent for more than 5 days refers to rental_duration > 5
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10
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...
books
In books published by Ace Book, what is the percentage of English books published?
"Ace Book" is the publisher_name; English book refers to language_name = 'English'; percentage = Divide (Count(book_id where language_name = 'English'), Count(book_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T3.publisher_name = 'Ace Book'
CREATE TABLE address_status ( status_id INTEGER primary key, address_status TEXT ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT ); CREATE TABLE book_language ( language_id INTEGER primary key, language_code TEXT, language...
mental_health_survey
Please list the IDs of the users who answered "Yes" to the question "Do you think that discussing a physical health issue with your employer would have negative consequences?" in 2014's survey.
2014 refer to SurveyID; Question refer to questiontext; yes refer to AnswerText = 'Yes'
SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND T2.AnswerText LIKE 'Yes' AND T2.SurveyID = 2014
CREATE TABLE Question ( questiontext TEXT, questionid INTEGER constraint Question_pk primary key ); CREATE TABLE Survey ( SurveyID INTEGER constraint Survey_pk primary key, Description TEXT ); CREATE TABLE IF NOT EXISTS "Answer" ( AnswerText TEXT, Sur...
public_review_platform
Find the location of businesses that has business hours from 7 am to 7 pm every Wednesday.
location of business refers to city; business hours from 7am to 7pm refers to opening_time = '7AM' AND closing_time = '7PM'; Wednesday refers to day_of_week = 'Wednesday'
SELECT DISTINCT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '7AM' AND T2.closing_time = '7PM' AND T3.day_of_week = 'Wednesday'
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 ...
university
In which country does the most populated university in 2014 located ?
the most populated university refers to max(num_students); in 2014 refers to year = 2014
SELECT T2.country_id FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2014 ORDER BY T1.num_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 ...
beer_factory
List the brands of root beer produced by Dr Pepper Snapple Group and calculate their percentage of purchases between 2014 to 2016.
brand of root beer refers to BrandName; produced by Dr Pepper Snapple Group refers to BreweryName = 'Dr Pepper Snapple Group'; percentage of purchases = MULTIPLY(DIVIDE(SUM(BrandID WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2016-12-31'), COUNT(BrandID) WHERE BreweryName = 'Dr Pepper Snapple Group'), 1.0)...
SELECT T1.BrandName , CAST(SUM(CASE WHEN T2.PurchaseDate >= '2014-01-01' AND T2.PurchaseDate <= '2016-12-31' THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.BrandID) AS purchase FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BreweryName = 'Dr Pepper Snapple Group' GROUP BY T2.BrandID
CREATE TABLE customers ( CustomerID INTEGER primary key, First TEXT, Last TEXT, StreetAddress TEXT, City TEXT, State TEXT, ZipCode INTEGER, Email TEXT, Phone...
public_review_platform
What is the average rating for the all Yelp businesses that open 24 hours?
open 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'; rating refers to stars; average rating = AVG(stars);
SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.business_id) AS "avg" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Open 24 Hours' AND T2.attribute_value 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 ...
soccer_2016
List down names of teams that have played as second team against Pune Warriors.
names of teams refers to Team_Name; second team refers to Team_2; Pune Warriors refers to Team_Name = 'Pune Warriors'
SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_2 WHERE T1.Team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Pune Warriors' ) GROUP BY T2.Team_Name
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...
retail_world
Please list any three order numbers that have been shipped using Speedy Express.
Speedy Express is the name of the shipping company; three order numbers refer to OrderID LIMIT 3;
SELECT T1.OrderID FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' LIMIT 3
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
Please list the countries that got the footnote "Data are classified as official aid." on the series code DC.DAC.AUSL.CD in 2002.
countries are the Countrycode; footnote refers to Description = 'Data are classified as official aid'
SELECT T1.SHORTNAME FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Data are classified as official aid.' AND T2.Seriescode = 'DC.DAC.AUSL.CD' AND T2.Year LIKE '%2002%'
CREATE TABLE IF NOT EXISTS "Country" ( CountryCode TEXT not null primary key, ShortName TEXT, TableName TEXT, LongName TEXT, Alpha2Code ...
restaurant
What is the full address of Albert's Café?
full address = street_num, street_name, city; Albert's Café refers to label = 'Albert's Café'
SELECT T2.street_num, T2.street_name, T1.city FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.label = 'Albert''s Café'
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...
cars
What is the price of a Chevrolet Bel Air?
Chevrolet Bel Air refers to car_name = 'chevrolet bel air'
SELECT T2.price FROM data AS T1 INNER JOIN price AS T2 ON T1.ID = T2.ID WHERE T1.car_name = 'chevrolet bel air'
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...
books
List every book that Ursola Purdy has ordered.
book refers to title
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy'
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...
codebase_comments
List 5 github address that the solutions can be implemented without the need of compilation.
github address refers to Url; solution can be implemented without the need of compliation refers to WasCompiled = 1;
SELECT T1.Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T2.WasCompiled = 1 LIMIT 5
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...
bike_share_1
Which trip had the shortest duration and started at the station that can hold 15 bikes?
shortest duration refers to MIN(duration); started at the station refers to start_station_name; can hold 15 bikes refers to dock_count = 15;
SELECT T1.id FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.dock_count = 15 AND T1.duration = ( SELECT MIN(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.dock_count = 15 )
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...
bike_share_1
Name the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.
when the station was first installed refers to installation_date;
SELECT T2.city, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842
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...
bike_share_1
Among all the trips, which day had the most bikes borrowed? What was the average coldest temperature on that day?
which day had the most bikes borrowed refers to MAX(start_date); the average coldest temperature can be computed as DIVIDE(SUM(min_temperature_f), COUNT(min_temperature_f));
SELECT T2.date, AVG(T2.min_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code GROUP BY T2.date ORDER BY COUNT(T1.start_date) DESC LIMIT 1
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...
movie_platform
Which 1988 movie got the most ratings?
1988 movie refers to movie_release_year = '1998'; most ratings refers to MAX(rating_score)
SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year = 1988 ORDER BY T1.rating_score DESC LIMIT 1
CREATE TABLE IF NOT EXISTS "lists" ( user_id INTEGER references lists_users (user_id), list_id INTEGER not null primary key, list_title TEXT, list_movie_number INTEGER, list_update_timestamp_utc TEXT, list_creat...
cars
Which year did Europe produce the most cars?
year refers to model_year; Europe refers to country = 'Europe'; the most cars refers to max(model_year)
SELECT T1.model_year FROM production AS T1 INNER JOIN country AS T2 ON T1.country = T2.origin WHERE T2.country = 'Europe' GROUP BY T1.model_year ORDER BY COUNT(T1.model_year) DESC LIMIT 1
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...
mental_health_survey
What is the average result of the question "What is your age?" in 2014's survey?
average result refers to avg(AnswerText(SurveyID = 2014& QuestionID = 1))
SELECT CAST(SUM(T2.AnswerText) AS REAL) / COUNT(T2.UserID) AS "avg" FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2014 AND T1.questiontext LIKE 'What is your age?'
CREATE TABLE Question ( questiontext TEXT, questionid INTEGER constraint Question_pk primary key ); CREATE TABLE Survey ( SurveyID INTEGER constraint Survey_pk primary key, Description TEXT ); CREATE TABLE IF NOT EXISTS "Answer" ( AnswerText TEXT, Sur...
retail_world
In total, how many orders were shipped via United Package?
via United Package refers to CompanyName = 'United Package'
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package'
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
software_company
List the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?
age greater than the 80% of average age refers to age > (AVG(age) * 0.8); income refers to INCOME_K; number of inhabitants refers to INHABITANTS_K;
SELECT T2.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID GROUP BY T2.INCOME_K, T2.INHABITANTS_K HAVING T1.age > 0.8 * AVG(T1.age)
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, ...
authors
Give the title and author's name of the papers published between 2000 and 2005 that include the topic optical properties.
published between 2000 and 2005 refers to Year BETWEEN 2000 AND 2005; include the topic optical properties refers to Keyword LIKE '%optical properties%'
SELECT T1.Title, T2.Name FROM Paper AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.PaperId WHERE T1.Keyword LIKE '%optical properties%' AND T1.Year BETWEEN 2000 AND 2005 AND T1.Title <> ''
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...
works_cycles
What is the postal code of the street address of the account that is latest updated?
account latest updated refers to year(ModifiedDate) = 2022 and month(ModifiedDate) = 10
SELECT PostalCode FROM Address ORDER BY ModifiedDate 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 ...
language_corpus
What is the title of Catalan language wikipedia page with revision page id '16203226'?
revision page id '16203226' refers to revision = 16203226
SELECT title FROM pages WHERE revision = 16203226
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT, lang TEXT UNIQUE, locale TEXT UNIQUE, pages INTEGER DEFAULT 0, -- total pages in this language words INTEGER DEFAULT 0); CREATE TABLE sqlite_s...
food_inspection_2
What is the percentage of restaurants that paid a fine of 250 among all establishments?
a fine of 250 refers to fine = 250; percentage = divide(sum(license_no where fine = 250), count(license_no)) * 100%
SELECT CAST(COUNT(CASE WHEN T3.fine = 250 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Restaurant'
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...
public_review_platform
How many cities have businesses with active life category? Find the percentage of the city where the review count that is low in total review count.
category refers to category_name; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Active Life'), SUM(review_count = 'LOW')), 1.0);
SELECT SUM(CASE WHEN T2.category_name LIKE 'Active Life' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(T3.review_count) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON ...
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id ...
world
List the languages used in Turkmenistan.
Turkmenistan is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Turkmenistan'
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...
sales_in_weather
What is the difference between the units sold for item 1 when the sunset was the earliest and the latest?
item 1 refers to item_nbr = 1; when the sunset earliest refers to Min(sunset); latest sunset refers to Max(sunset); difference unit sold refers to Subtract(Sum(units where Min(sunset)), Sum(units where Max(sunset)))
SELECT ( SELECT SUM(T2.units) AS sumunit FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 5 AND sunset IS NOT NULL GROUP BY T1.sunset ORDER BY T1.sunset LIMIT 1 ) - ( SELECT SUM(T2.units) AS sumunit FROM weather AS...
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...
authors
How many of the papers are preprinted?
year = 0 means this paper is preprint; papers refers to Paper.Id
SELECT COUNT(Id) FROM Paper WHERE ConferenceId = 0 AND JournalId = 0
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...