db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
synthea
Please list all the medication that are prescribed to Elly Koss.
medication that are prescribed refers to DESCRIPTION from medications;
SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss'
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 ...
movie_platform
When was the first movie released and who directed it?
first movie refers to oldest movie_release_year;
SELECT movie_release_year, director_name FROM movies WHERE movie_release_year IS NOT NULL ORDER BY movie_release_year ASC 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...
menu
For how many times had the dish "Chicken gumbo" appeared on a menu page?
Chicken gumbo is a name of dish;
SELECT SUM(CASE WHEN T1.name = 'Chicken gumbo' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id
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 ...
movie_platform
When was the movie Cops released?
Cops' is movie_title; released refers to movie_release_year;
SELECT movie_release_year FROM movies WHERE movie_title = 'Cops'
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...
food_inspection_2
Who is responsible for most of the inspections? Give the full name.
full name refers to first_name, last_name; most of the inspections refers to max(count(employee_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.employee_id, T2.first_name, T2.last_name, COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id GROUP BY T2.employee_id, T2.first_name, T2.last_name ORDER BY COUNT(T1.inspection_id) DESC LIMIT 1 ) AS T
CREATE TABLE employee ( employee_id INTEGER primary key, first_name TEXT, last_name TEXT, address TEXT, city TEXT, state TEXT, zip INTEGER, phone TEXT, title TEXT, salary INTEGER, supervisor INTEGER, foreign key (s...
movie_3
Which film titles have the most expensive rental rate?
the most expensive rental rate refers to max(rental_rate)
SELECT title FROM film WHERE rental_rate = ( SELECT MAX(rental_rate) FROM film )
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...
airline
How many cancelled flights are there?
cancelled flights refers to CANCELLED = 1;
SELECT COUNT(*) FROM Airlines WHERE CANCELLED = 1
CREATE TABLE IF NOT EXISTS "Air Carriers" ( Code INTEGER primary key, Description TEXT ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT ); CREATE TABLE Airlines ( FL_DATE TEXT, OP_CARRIER_AIRLINE_ID INTEGER, TAIL_NUM ...
mondial_geo
What is the infant mortality rate for Ethiopia?
Ethiopia is one of country names
SELECT T2.Infant_Mortality FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Ethiopia'
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...
movielens
List the top 10 USA movies, by descending order, from the highest to the lowest, the user rating.
USA is a country
SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' GROUP BY T1.movieid ORDER BY AVG(T1.rating) DESC LIMIT 10
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...
world
Calculate the percentage of the surface area of all countries that uses Chinese as one of their languages.
percentage = DIVIDE(MULTIPLY(SUM(SurfaceArea WHERE Language = 'Chinese'), SUM(SurfaceArea)), 1.0); Chinese as one of the languages refers to Language = 'Chinese';
SELECT CAST(SUM(IIF(T2.Language = 'Chinese', T1.SurfaceArea, 0)) AS REAL) * 100 / SUM(T1.SurfaceArea) 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...
movies_4
List the film with the highest budget in each genre.
highest budget refers to max(budget); each genre refers to genre_name; film also means movie; list the film refers to title of movie
SELECT T3.genre_name, MAX(T1.budget) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id GROUP BY T3.genre_name
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 ( ...
coinmarketcap
List the names of the coins above the average price on April 28, 2013.
average price = divide(sum(price), count(name)); on April 28, 2013 refers to date = '2013-04-28'
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2018-04-28' AND T2.price > ( SELECT AVG(price) FROM historical WHERE date = '2018-04-28' )
CREATE TABLE coins ( id INTEGER not null primary key, name TEXT, slug TEXT, symbol TEXT, status TEXT, category TEXT, description TEXT, subreddit TEXT, notice TEXT, tags TEXT, tag_names TEXT, ...
mondial_geo
What is the area of Egypt as a percentage of Asia?
SELECT T1.Area * 100 / T3.Area FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt'
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...
olympics
Give the id of the event "Shooting Mixed Skeet".
"Shooting Mixed Skeet" refers to event_name = 'Shooting Mixed Skeet';
SELECT id FROM event WHERE event_name = 'Shooting Mixed Skeet'
CREATE TABLE city ( id INTEGER not null primary key, city_name TEXT default NULL ); CREATE TABLE games ( id INTEGER not null primary key, games_year INTEGER default NULL, games_name TEXT default NULL, season TEXT default NULL ); CREATE TABLE ga...
world
What is the average life expentancy of countries that speak Arabic?
average life expectancy = AVG(LifeExpectancy); speak Arabic refers to `Language` = 'Arabic';
SELECT AVG(T1.LifeExpectancy) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'Arabic'
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...
food_inspection_2
What is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?
7211 S Hermitage Ave refers to address = '7211 S Hermitage Ave'; Chicago refers to city = 'Chicago'; IL refers to state = 'IL'
SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL'
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...
language_corpus
Name the longest Catalan language Wikipedia page title and state the number of different words in this page.
longest title refers to max(length(title))
SELECT title, words FROM pages WHERE title = ( SELECT MAX(LENGTH(title)) FROM pages )
CREATE TABLE langs(lid INTEGER PRIMARY KEY AUTOINCREMENT, lang TEXT UNIQUE, locale TEXT UNIQUE, pages INTEGER DEFAULT 0, -- total pages in this language words INTEGER DEFAULT 0); CREATE TABLE sqlite_s...
soccer_2016
Count the matches with a total of two innings.
total of two innings refers to innings_no = 2;
SELECT COUNT(Match_Id) FROM Wicket_Taken WHERE innings_no = 2
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...
shakespeare
How many paragraphs contain the character Lord Abergavenny?
Lord Abergavenny refers to CharName = 'Lord Abergavenny'
SELECT SUM(T1.ParagraphNum) FROM paragraphs AS T1 INNER JOIN characters AS T2 ON T1.character_id = T2.id WHERE T2.CharName = 'Lord Abergavenny'
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...
retails
Among the orders made by customers in the household segment, how many of them are urgent?
orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; the order is urgent if o_orderpriority = '1-URGENT' ;
SELECT COUNT(T1.o_orderpriority) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD' AND T1.o_orderpriority = '1-URGENT'
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
superstore
Who is the customer from the West region that received the highest discount?
received the highest discount refers to MAX(discount); customer refers to "Customer Name"
SELECT T2.`Customer Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' ORDER BY T1.Discount DESC LIMIT 1
CREATE TABLE people ( "Customer ID" TEXT, "Customer Name" TEXT, Segment TEXT, Country TEXT, City TEXT, State TEXT, "Postal Code" INTEGER, Region TEXT, primary key ("Customer ID", Region) ); CREATE TABLE product ( "Product ID" TE...
mondial_geo
Calculate the service of GDP for Brazil.
The service of GDP can be computed by service * GDP
SELECT T2.Service * T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Brazil'
CREATE TABLE IF NOT EXISTS "borders" ( Country1 TEXT default '' not null constraint borders_ibfk_1 references country, Country2 TEXT default '' not null constraint borders_ibfk_2 references country, Length REAL, primary key (Country1, Country2) ); CREATE TABLE I...
sales_in_weather
How many more units of item no.16 were sold on the day with the highest max temperature in 2012 in store no.5 than in store no.10?
store no. 5 refers to store_nbr = 5; store no. 10 refers to store_nbr = 10; item no.16 refers to item_nbr = 16; in 2012 refers to SUBSTR(date, 1, 4) = '2012'; highest max temperature refers to Max(tmax); more units sold refers to Subtract ( Sum(units where store_nbr = 5), Sum(units where store_nbr = 10))
SELECT ( SELECT SUM(units) 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.item_nbr = 16 AND T1.`date` LIKE '%2012%' AND T1.store_nbr = 5 GROUP BY tmax ORDER BY T3.tmax DESC LIMIT 1 ) - ( SELECT SUM(units) FROM sal...
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...
movie
List down the movie ID of movie with a budget of 15000000 and a rating between 7 to 8.
a budget of 15000000 refers to Budget = 15000000; rating between 7 to 8 refers to Rating BETWEEN 7 and 8
SELECT MovieID FROM movie WHERE Rating BETWEEN 7 AND 8 AND Budget = 15000000
CREATE TABLE actor ( ActorID INTEGER constraint actor_pk primary key, Name TEXT, "Date of Birth" DATE, "Birth City" TEXT, "Birth Country" TEXT, "Height (Inches)" INTEGER, Biography TEXT, Gender TEXT, Ethnicity ...
books
Indicate the full name of all customers whose last name begins with the letter K.
full name refers to first_name, last_name; last name begin with the letter 'K' refers to last_name LIKE 'K%'
SELECT first_name, last_name FROM customer WHERE last_name LIKE 'K%'
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...
retails
Calculate the total price of orders by Customer#000000013.
Customer#000000013 is the name of the customer which refers to c_name;
SELECT SUM(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_name = 'Customer#000000013'
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
retail_world
What is the name of the contact person of the Pavlova supplier company?
contact person refers to ContactName; Pavlova is the name of the product;
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Pavlova'
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, ...
app_store
What is the average rating of Apps falling under the racing genre and what is the percentage ratio of positive sentiment reviews?
average rating = AVG(Rating); percentage = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (COUNT(*)), 100));
SELECT AVG(T1.Rating), CAST(COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Racing'
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...
legislator
List the full name of all current female senators.
full name refers to official_full_name; female refers to gender_bio = 'F'; senators refers to type = 'sen'
SELECT T2.first_name, T2.last_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.type = 'sen' AND T2.gender_bio = 'F' GROUP BY T2.ballotpedia_id
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 ...
book_publishing_company
State the publisher name for publisher ID 877? Calculate its average year to date sales.
publisher id refers to pub_id; publisher name refers to pub_name; average year to date sales = AVG(ytd_sales)
SELECT T2.pub_name, AVG(T1.ytd_sales) FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.pub_id = '0877' GROUP BY T2.pub_name
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,...
chicago_crime
How many domestic violence cases were reported in May 2018?
domestic violence refers to domestic = 'TRUE'; in May 2018 refers to date LIKE '5/%/2018%'
SELECT COUNT(*) FROM Crime WHERE date LIKE '5/%/2018%' AND domestic = 'TRUE'
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 ...
app_store
List apps whose rating is 3.9 and state the translated review of each app.
lowest rating refers to Rating = 1;
SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Rating = 3.9
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...
student_loan
Does disable students join organization. If yes, please indicate the organization joined by the students.
organization refers to organ
SELECT DISTINCT T2.organ FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name`
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update c...
works_cycles
What is the class of the product with the most reviews?
most review refers to MAX(count(comments)); high class refers to Class = 'H'; medium class refers to Class = 'M'; low class refers to Class = 'L'
SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) 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 ...
movie_platform
Provide list titles created by user who are eligible for trial when he created the list.
eligible for trial refers to user_eligible_for_trial = 1
SELECT DISTINCT T2.list_title FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_eligible_for_trial = 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...
ice_hockey_draft
Who is the tallest player in team USA U20?
tallest refers to MAX(height_in_cm); player refers to PlayerName; team USA U20 refers to TEAM = 'USA U20';
SELECT T.PlayerName FROM ( SELECT T1.PlayerName, T3.height_in_cm FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' ORDER BY T3.height_in_cm DESC ) AS T WHERE T.height_in_cm = ( SELECT MAX(T3.height_in_cm) FRO...
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...
world
How many percent of countries in North America use English?
percentage = MULTIPLY(DIVIDE(COUNT(Language = 'English' WHERE Continent = 'North America'), COUNT(Language WHERE Continent = 'North America')), 1.0); North America refers to Continent = 'North America'; use English refers to Language = 'English';
SELECT CAST(SUM(IIF(T2.Language = 'English', 1, 0)) AS REAL) * 100 / COUNT(T1.Code) 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...
professional_basketball
What's the full name of the team that won the most games in 2001 but didn't make the playoffs?
full name of the team refers to teams.name; in 2001 refers to year = 2001; didn't make the playoffs refers to PostGP = 0; won the most games refers to max(won)
SELECT T2.tmID FROM players_teams AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.PostGP = 0 ORDER BY T2.won 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...
sales_in_weather
For the weather station which recorded the highest temperature above the 30-year normal, how many stores does it have?
highest temperature above the 30-year normal refers to Max(depart)
SELECT store_nbr FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY depart DESC LIMIT 1 )
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...
chicago_crime
How many severe crime incidents were reported at coordinate 41.64820151, -87.54430496?
coordinates refers to latitude, longitude; severe crime refers to index_code = 'I'
SELECT SUM(CASE WHEN T1.longitude = '-87.54430496' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.report_no = T2.iucr_no WHERE T2.index_code = 'I' AND T1.latitude = '41.64820251'
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 ...
soccer_2016
Which is the country of the city named "Rajkot"?
city named "Rajkot" refers to city_name = 'Rajkot';
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN city AS T2 ON T1.Country_Id = T2.Country_Id WHERE city_name = 'Rajkot'
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...
bike_share_1
What is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?
Powell Street refers to start_station_name; bike 496 refers to bike_id = '496'; start_date = '8/29/2013';
SELECT T2.max_humidity FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date LIKE '8/29/2013%' AND T1.bike_id = 496 AND T1.start_station_name = 'Powell Street BART'
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...
sales_in_weather
How many items weren't sold in store 2 on 1/1/2012?
store no.2 refers to store_nbr = 2; item weren't sold refers to units = 0; on 1/1/2012 refers to date = '2012-01-01'
SELECT COUNT(item_nbr) FROM sales_in_weather WHERE store_nbr = 2 AND units = 0 AND `date` = '2012-01-01'
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...
books
What is the second-least common method of shipping?
method of shipping refers to method_name; least method refers to Min(Count(method_id))
SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) ASC LIMIT 1, 1
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...
olympics
How many gold medals does Henk Jan Zwolle have?
gold medals refer to medal_name = 'Gold';
SELECT COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Henk Jan Zwolle' AND T4.medal_name = 'Gold'
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...
human_resources
How much higher is James Johnson's salary from the minimum salary of his title?
James Johnson is the fullname of an employee; full name = firstname, lastname; minimum salary refers to minsalary; calculation = SUBTRACT(salary, minsalary)
SELECT CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James'
CREATE TABLE location ( locationID INTEGER constraint location_pk primary key, locationcity TEXT, address TEXT, state TEXT, zipcode INTEGER, officephone TEXT ); CREATE TABLE position ( positionID INTEGER constraint position_pk ...
disney
What genre of movie has Taran as the main character?
Taran is the main character of the movie which refers to hero = 'Taran';
SELECT T1.genre FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T2.hero = 'Taran'
CREATE TABLE characters ( movie_title TEXT primary key, release_date TEXT, hero TEXT, villian TEXT, song TEXT, foreign key (hero) references "voice-actors"(character) ); CREATE TABLE director ( name TEXT primary key, director TEXT, fo...
retails
Among the orders made by customers in Germany, which one of them has the highest priority in delivery? Please give its order key.
orders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY'; earlier orderdate have higher priority in delivery therefore MIN(o_orderdate);
SELECT T3.o_orderkey FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY' ORDER BY T3.o_orderdate LIMIT 1
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
authors
List the names of authors affiliated with the University of Oxford in alphabetical order.
affiliated with the University of Oxford refers to Affiliation = 'University of Oxford'
SELECT Name FROM Author WHERE Affiliation = 'University of Oxford' ORDER BY Name ASC
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...
address
Which city and state has the bad alias of Lawrenceville?
"Lawrenceville" is the bad_alias
SELECT T2.city, T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Lawrenceville' GROUP BY T2.city, T2.state
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 ...
retail_world
Indicate the category name of the product name with the highest units on order.
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.UnitsOnOrder = ( SELECT MAX(T1.UnitsOnOrder) FROM Products )
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
talkingdata
How many female users over the age of 50 are there?
female refers to gender = 'F'; over the age of 50 refers to age > 50;
SELECT COUNT(gender) FROM gender_age WHERE age > 50 AND gender = 'F'
CREATE TABLE `app_all` ( `app_id` INTEGER NOT NULL, PRIMARY KEY (`app_id`) ); CREATE TABLE `app_events` ( `event_id` INTEGER NOT NULL, `app_id` INTEGER NOT NULL, `is_installed` INTEGER NOT NULL, `is_active` INTEGER NOT NULL, PRIMARY KEY (`event_id`,`app_id`), FOREIGN KEY (`event_id`) REFERENCES `eve...
bike_share_1
What is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?
trips refer to id; DIVIDE(SUM(duration where start_station_name = 'Adobe on Almaden', end_station_name = 'Ryland Park'), COUNT(id));
SELECT AVG(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park'
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...
student_loan
What is the school and organization enrolled by student211?
organization refers to organ; student211 is a name of student;
SELECT T2.school, T1.organ FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T1.name = 'student211'
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...
cookbook
Please list the titles of all the recipes that are salt/sodium-free.
salt/sodium-free refers to sodium < 5
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.sodium < 5
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...
european_football_1
How many times did the team Werder Bremen win as the away team in matches of the Bundesliga division?
Bundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' AND T1.FTR = 'A'
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...
menu
Provide the page IDs and name of the menu which had the highest page count.
page IDs refers to page_number; highest page count refers to MAX(page_count);
SELECT T1.page_number, T2.name FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id ORDER BY T2.page_count DESC LIMIT 1
CREATE TABLE Dish ( id INTEGER primary key, name TEXT, description TEXT, menus_appeared INTEGER, times_appeared INTEGER, first_appeared INTEGER, last_appeared INTEGER, lowest_price REAL, highest_price REAL ); CREATE TABLE Menu ( id ...
mondial_geo
List all the cities and provinces located at the rivers that flows to Atlantic Ocean.
Atlantic Ocean is the second-largest ocean on Earth, after the Pacific Ocean; Ocean and sea share the same meaning
SELECT T1.Name, T1.Province FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Sea = 'Atlantic Ocean'
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 sales associates are located in Sao Paulo, Brazil?
sales associates refer to ContactTitle; Sao Paulo is the name of the city in the country Brazil;
SELECT COUNT(CustomerID) FROM Customers WHERE City = 'Sao Paulo' AND Country = 'Brazil' AND ContactTitle = 'Sales Associate'
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
retails
Among the parts supplied by Supplier#000000018, provide parts names which had supply costs above 900.
Supplier#000000018 is the name of supplier which refers to s_name; supply costs above 900 refer to ps_supplycost > 900;
SELECT T2.p_name FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey INNER JOIN supplier AS T3 ON T1.ps_suppkey = T3.s_suppkey WHERE T1.ps_supplycost > 900 AND T3.s_name = 'Supplier#000000018'
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`),...
bike_share_1
In 2006, how many trips ended at stations in Mountain View?
in 2006 refers to start_date LIKE'%2006%'; ended at station refers to end_station_name; Mountain View refers to city = 'Mountain View';
SELECT COUNT(T2.city) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T2.city = 'Mountain View' AND T1.start_date LIKE '%2006%'
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...
mondial_geo
What provinces encompass the world's biggest desert in terms of overall area?
SELECT Province FROM geo_desert WHERE Desert = ( SELECT Name FROM desert ORDER BY Area DESC LIMIT 1 )
CREATE TABLE IF NOT EXISTS "borders" ( Country1 TEXT default '' not null constraint borders_ibfk_1 references country, Country2 TEXT default '' not null constraint borders_ibfk_2 references country, Length REAL, primary key (Country1, Country2) ); CREATE TABLE I...
restaurant
What are the restaurants that are located at "19th St. Oakland"?
restaurant refers to label; "19th St. Oakland" refers to street_name = '19th St' AND city = 'Oakland'
SELECT T1.id_restaurant FROM generalinfo AS T1 INNER JOIN location AS T2 ON T1.id_restaurant = T2.id_restaurant WHERE T1.city = 'Oakland' AND T2.street_name = '19th St'
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...
movie
What is the average rating of all the movies starring Tom Cruise?
starring Tom Cruise refers to name = 'Tom Cruise'; average rating = divide(sum(rating where name = 'Tom Cruise'), count(movieid where name = 'Tom Cruise'))
SELECT AVG(T1.Rating) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise'
CREATE TABLE actor ( ActorID INTEGER constraint actor_pk primary key, Name TEXT, "Date of Birth" DATE, "Birth City" TEXT, "Birth Country" TEXT, "Height (Inches)" INTEGER, Biography TEXT, Gender TEXT, Ethnicity ...
hockey
Which was the dominant hand for the goaltender who played 32 games for QUN in 1973? Give the full name.
the dominant hand refers to shootCatch; year = 1973; tmID = 'QUN'; played 32 games refers to GP = 32;
SELECT T2.shootCatch, T2.firstName, T2.lastName FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID AND T1.year = 1973 WHERE T1.tmID = 'QUN' AND T1.GP = 32
CREATE TABLE AwardsMisc ( name TEXT not null primary key, ID TEXT, award TEXT, year INTEGER, lgID TEXT, note TEXT ); CREATE TABLE HOF ( year INTEGER, hofID TEXT not null primary key, name TEXT, category TEXT ); CREATE TABLE Teams ( year ...
works_cycles
What is the most common first name among the vendor contact?
vendor contact refers to PersonType = 'VC';
SELECT FirstName FROM Person WHERE PersonType = 'VC' GROUP BY FirstName ORDER BY COUNT(*) 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 ...
works_cycles
List all active vendors who offer a purchasing web service.
active vendors refers to ActiveFlag = 1; vendor who offer a purchasing web service refers to PurchasingWebServiceURL NOT null;
SELECT Name FROM Vendor WHERE ActiveFlag = 1
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Culture ...
simpson_episodes
What are the episodes that have the average rating with more than 20 of 2-star votes?
2-star refers to stars = 2; average rating refers to 5 < rating < = 7; more than 20 of 2-star votes refers to votes > 20
SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2 AND T2.votes > 20 AND T1.rating > 5.0 AND T1.rating <= 7.0;
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, ...
sales_in_weather
Among the stations with 3 stores, how many stations have a station pressure of no more than 30 on February 18, 2014?
station with 3 stores refers to station_nbr where Count(store_nbr) = 3; station pressure of no more than 30 refers to stnpressure < 30; On February 18, 2014 refers to date = '2014-02-18'
SELECT COUNT(station_nbr) FROM weather WHERE `date` = '2014-02-18' AND stnpressure < 30 AND station_nbr IN ( SELECT station_nbr FROM relation GROUP BY station_nbr HAVING COUNT(store_nbr) = 3 )
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...
sales_in_weather
Give the station pressure status recorded by the weather station which contained no.12 store on 2012/5/15.
no.12 store refers to store_nbr = 12; on 2012/5/15 refers to date = '2012-05-15'; station pressure status refers to stnpressure
SELECT T1.stnpressure FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2012-05-15' AND T2.store_nbr = 12
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...
social_media
Among all the tweets posted on Mondays, how many of them are reshared?
"Monday" is the Weekday; reshare refers to IsReshare = 'TRUE'
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE Weekday = 'Monday' AND IsReshare = 'TRUE'
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 ( ...
mondial_geo
How much more space does Asia have than Europe?
Asia and Europe are two continents.
SELECT MAX(Area) - MIN(Area) FROM continent WHERE Name = 'Asia' OR Name = 'Europe'
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...
olympics
Please list all competitors' names who participated in 1936 Summer.
competitors' names refer to full_name; in 1936 Summer refers to games_name = '1936 Summer';
SELECT T3.full_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1936 Summer'
CREATE TABLE city ( id INTEGER not null primary key, city_name TEXT default NULL ); CREATE TABLE games ( id INTEGER not null primary key, games_year INTEGER default NULL, games_name TEXT default NULL, season TEXT default NULL ); CREATE TABLE ga...
simpson_episodes
How old was the awardee when he/she won the first-ever award for Outstanding Voice-Over Performance in Primetime Emmy Awards?
"Outstanding Voice-Over Performance" is the award; 'Primetime Emmy Awards' is the organization; awardee refers to result = 'Winner'; first ever award refers to Min(year); age at the time of awarded refers to Subtract(year, SUBSTR(birthdate, 0, 5))
SELECT T2.year - CAST(SUBSTR(T1.birthdate, 1, 4) AS int) AS age FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.organization = 'Primetime Emmy Awards' AND T2.result = 'Winner';
CREATE TABLE IF NOT EXISTS "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, ...
social_media
Please list the texts of all the tweets in French posted by male users.
"French" is the language and refers to Lang = 'fr'; male user refers to Gender = 'Male'
SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Lang = 'fr'
CREATE TABLE location ( LocationID INTEGER constraint location_pk primary key, Country TEXT, State TEXT, StateCode TEXT, City TEXT ); CREATE TABLE user ( UserID TEXT constraint user_pk primary key, Gender TEXT ); CREATE TABLE twitter ( ...
talkingdata
How many users belong to the same behavior category as comics?
behavior category refers to category; category = 'comics';
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T1.label_id = T2.label_id WHERE T1.category = 'comics'
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...
food_inspection_2
What is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?
establishment's name refers to dba_name; employee name refers to first_name, last_name; inspection ID 44256 refers to inspection_id = 44256; on May 5, 2010 refers to inspection_date = '2010-05-05'
SELECT T1.dba_name, T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2010-05-05' AND T2.inspection_id = 44256
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...
book_publishing_company
Name the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.
name the publisher refers to pub_name
SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075'
CREATE TABLE authors ( au_id TEXT primary key, au_lname TEXT not null, au_fname TEXT not null, phone TEXT not null, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT not null ); CREATE TABLE jobs ( job_id INTEGER primary key,...
bike_share_1
What is the longest trip duration that started and ended August 29, 2013?
started and ended August 29, 2013 refers to start_date = '8/29/2013' and end_date = '8/29/2013';
SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
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...
professional_basketball
List the team name and the total wins of the team in year 2005 which has greater winning from the previous year.
2005 refers to year = 2005 ; previous year refers to year = 2004; team with greater winning than previous year refers to Won where year = 2005 > Won where year = 2004; team name refers to tmID
SELECT T1.name, T1.won FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE year = 2004 ) AS T2 on T1.tmID = T2.tmID WHERE T1.year = 2005 and T1.won > T2.won
CREATE TABLE awards_players ( playerID TEXT not null, award TEXT not null, year INTEGER not null, lgID TEXT null, note TEXT null, pos TEXT null, primary key (playerID, year, award), foreign key (playerID) references players (playerID) on update ca...
world
Which country has the smallest surface area?
smallest surface area refers to MIN(smallest surface area);
SELECT Name FROM Country ORDER BY SurfaceArea 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...
disney
Which movie's song title has the highest total gross?
The highest total gross refers to MAX(total_gross);
SELECT T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1
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...
authors
In papers with journal IDs from 200 to 300 and with its short name starts with A, what is the percentage of papers with conference ID of 0?
journal ID of 200 to 300 refers to JournalId BETWEEN 200 AND 300; short name starts with A refers to ShortName LIKE 'A%'; Percentage = Divide (Count(ConferenceId = 0), Count(ConferenceId)) * 100
SELECT CAST(SUM(CASE WHEN T1.ConferenceId = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.ConferenceId) FROM Paper AS T1 INNER JOIN Journal AS T2 ON T1.JournalId = T2.Id WHERE T1.JournalId BETWEEN 200 AND 300 AND T2.ShortName LIKE 'A%'
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...
soccer_2016
What are the names of players in team 1?
in team 1 refers to Team_Id = 1; name of player refers to Player_Name;
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Team AS T3 ON T2.Team_Id = T3.Team_Id WHERE T3.Team_Id = 1 GROUP BY T1.Player_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...
cookbook
Which recipe has the highest calories?
the highest calories refers to MAX(calories)
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.calories DESC LIMIT 1
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...
public_review_platform
Among the review votes of funny and cool hit uber with long review length, describe the business ID, active status, user ID and user year of joining Yelp.
review votes of funny refers to review_votes_funny = 'Uber'; cool hit uber refers to review_votes_cool = 'Uber'; user year of joining Yelp refers to user_yelping_since_year
SELECT T1.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'
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 ...
student_loan
State name of female students who filed for bankruptcy.
female students refers to filed_for_bankrupcy.name who are NOT in male.name;
SELECT T1.name FROM person AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T3.name IS NULL
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...
world
List the countries and their official languages in Antarctica.
official language refers to IsOfficial = 'T'; Antarctica refers to Continent = 'Antarctica';
SELECT T1.Name, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Antarctica' 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...
ice_hockey_draft
How many players who were born in 1980 weigh 185 in pounds?
born in 1980 refers to birthyear = 1980; weigh 185 in pounds refers to weight_in_lbs = 185;
SELECT COUNT(T2.ELITEID) FROM weight_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.weight_id = T2.weight WHERE T1.weight_in_lbs = 185 AND strftime('%Y', T2.birthdate) = '1980'
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...
movie_3
Please list the top ten movies with the most price per day in descending order of price per day.
movies with the most price per day refers to MAX(rental_rate)
SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 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...
address
Provide the city where zip code 19019 is located and the alias of that city.
SELECT T2.city, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 19019
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 ...
cs_semester
What is the percentage of students who get a "B" in the course "Computer Network"?
DIVIDE(COUNT(student_id(grade = 'B' and name = 'Computer Network')), COUNT(student_id where name = ' Computer Network')) as percentage;
SELECT CAST(SUM(CASE WHEN T1.grade = 'B' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Computer Network'
CREATE TABLE IF NOT EXISTS "course" ( course_id INTEGER constraint course_pk primary key, name TEXT, credit INTEGER, diff INTEGER ); CREATE TABLE prof ( prof_id INTEGER constraint prof_pk primary key, gender TEXT, first_na...
mondial_geo
Please list the name of the countries with over 5 ethnic groups.
SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name HAVING COUNT(T1.Name) > 5
CREATE TABLE IF NOT EXISTS "borders" ( Country1 TEXT default '' not null constraint borders_ibfk_1 references country, Country2 TEXT default '' not null constraint borders_ibfk_2 references country, Length REAL, primary key (Country1, Country2) ); CREATE TABLE I...
soccer_2016
List the name of England players.
England players refers to Country_Name = 'England'
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE T2.Country_Name = 'England'
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...
hockey
How many coaches who have taught the Buffalo Sabres have died?
have died means deathYear is not NULL; Buffalo Sabres is the name of team;
SELECT COUNT(DISTINCT T3.coachID) FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.year = T2.year AND T1.tmID = T2.tmID INNER JOIN Master AS T3 ON T1.coachID = T3.coachID WHERE T2.name = 'Buffalo Sabres' AND T3.deathYear IS NOT NULL
CREATE TABLE AwardsMisc ( name TEXT not null primary key, ID TEXT, award TEXT, year INTEGER, lgID TEXT, note TEXT ); CREATE TABLE HOF ( year INTEGER, hofID TEXT not null primary key, name TEXT, category TEXT ); CREATE TABLE Teams ( year ...
shipping
Identify the full name of the driver who delivered a shipment to the city of New York in February 2016.
"New York" is the city_name; in February 2016 refers to ship_date LIKE '2016-02%'; full name refers to first_name, last_name
SELECT T3.first_name, T3.last_name FROM shipment AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN driver AS T3 ON T3.driver_id = T1.driver_id WHERE T2.city_name = 'New York' AND T1.ship_date LIKE '2016-02%'
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...
works_cycles
Among the employees in Adventure Works, calculate the percentage of them working as sales representatives.
percentage of sales representatives = divide(count(JobTitle = 'Sales Representative'), count(JobTitle))*100%
SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee
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
Provide the list of product IDs and names under the meat/poultry category.
meat/poultry category refers to CategoryName = 'Meat/Poultry';
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products )
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
retails
How many customers in the building segments have orders with a total price of no less than 50,000?
building segment refers to c_mktsegment = 'BUILDING'; a total price of no less than 50,000 refers to o_totalprice > 50000
SELECT COUNT(T2.c_name) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'BUILDING' AND T1.o_totalprice > 50000
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
retail_complains
Among the reviews from midwest region, what are the products that received 1 star?
1 star refers to Stars = 1
SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1
CREATE TABLE state ( StateCode TEXT constraint state_pk primary key, State TEXT, Region TEXT ); CREATE TABLE callcenterlogs ( "Date received" DATE, "Complaint ID" TEXT, "rand client" TEXT, phonefinal TEXT, "vru+line" TEXT, call_id INTEG...