db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
soccer_2016
Count the total venues located in Pune City.
Pune City refers to City_Name = 'Pune'
SELECT SUM(T1.Venue_Name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Pune'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
List the infant mortality of country with the least Amerindian.
null
SELECT T1.Infant_Mortality FROM population AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country WHERE T2.Name = 'Amerindian' ORDER BY T2.Percentage ASC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
How many grocery stores paid $250 fine upon their inspection?
grocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250
SELECT COUNT(DISTINCT 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 = 'Grocery Store' AND T3.fine = 250
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
shakespeare
What is the description of the chapter with the longest number of paragraphs?
chapter with the longest number of paragraphs refers to max(ParagraphNum)
SELECT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id ORDER BY T1.ParagraphNum DESC LIMIT 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Calculate the average runs scored during the first half of all first innings.
first half refers to 1 < Over_Id and Over_Id < 25; average = divide(sum(Over_Id) when 1 < Over_Id and Over_Id < 25, sum(Runs_Scored)) as percentage; first innings refers to Innings_No = 1
SELECT CAST(SUM(CASE WHEN 1 < Over_Id AND Over_Id < 25 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(Runs_Scored) FROM Batsman_Scored WHERE Innings_No = 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
What is the full name of the country with 100% Africans?
Percentage = 100 means 100% of the population
SELECT T1.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Percentage = 100 AND T1.Name = 'African'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
What is the inspection ID where the employee named "David Hodges" is currently employed in the "Kamayan Express" establishment?
the "Kamayan Express" establishment refers to dba_name = 'KAMAYAN EXPRESS'
SELECT T2.inspection_id 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 T3.first_name = 'David' AND T3.last_name = 'Hodges' AND T1.dba_name = 'KAMAYAN EXPRESS'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
What year were the first game released?
year the first game was released refers to MIN(release_year);
SELECT T.release_year FROM game_platform AS T ORDER BY T.release_year ASC LIMIT 1
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
List the name of the players born between 1970 and 1990 in descending order of age.
name of the players refers to Player_Name; born between 1970 and 1990 refers to DOB between '1970-01-01' and '1990-12-31'
SELECT Player_Name FROM Player WHERE DOB BETWEEN '1970-01-01' AND '1990-12-31' ORDER BY DOB DESC
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Provide the country with its full name which has the most ethnic group? List them all ethnic group together with its percentage.
null
SELECT T1.Name, T2.Name, T2.Percentage FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Name = ( SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1 ) GROUP BY T1.Name, T2.Name, T2.Percentage
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
List down the inspection ID with the inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" and inspection category of Perso...
inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" refers to inspector_comment = 'A certified food service manager must ...
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Personnel' AND T2.inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAG...
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
olympics
State the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old.
the 1984 Summer Olympic Games refer to games_name = '1984 Summer'; athletes more than 50 years old refer to person_id where age > 50;
SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1984 Summer' AND T2.age > 50
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NUL...
video_games
Who is the publisher of the game 2002 FIFA World Cup?
who is the publisher refers to publisher_name; 2002 FIFA World Cup refers to game_name = '2002 FIFA World Cup';
SELECT T2.publisher_name FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN game AS T3 ON T1.game_id = T3.id WHERE T3.game_name = '2002 FIFA World Cup'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What is the long title of the work with the highest number of scenes in act 1?
highest number of scenes refers to max(count(Scene))
SELECT T2.LongTitle FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Act = 1 ORDER BY T1.Scene DESC LIMIT 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
Which is the majority of the ethnic group in country with great than 10,000,000 population
null
SELECT T2.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Population > 10000000 GROUP BY T2.Name, T2.Percentage ORDER BY T2.Percentage DESC LIMIT 2
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
Name the taverns that failed the inspection in January 2010.
tavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'
SELECT DISTINCT T1.dba_name 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 strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
olympics
How many kinds of events does athletics have?
kinds of events refer to event_name; athletics refer to sport_name = 'Athletics';
SELECT COUNT(T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Athletics'
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NUL...
video_games
Which region has the highest number of games sold on all platforms?
which region refers to region_name; highest number of games sold on all platforms refers to MAX(SUM(num_sales));
SELECT T.region_name FROM ( SELECT T2.region_name, SUM(T1.num_sales) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id INNER JOIN game_platform AS T3 ON T1.game_platform_id = T3.id INNER JOIN platform AS T4 ON T3.platform_id = T4.id GROUP BY T4.platform_name ORDER BY SUM(T1.num_sales) DESC LIMIT 1...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
mondial_geo
State the country and its population with population growth greater than 2% but infant mortality rate less than 5%.
null
SELECT T1.Name, T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth > 2 AND T2.Infant_Mortality < 5
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
mondial_geo
Find the GPD for Bosnia and Herzegovina and the type of government it belongs to.
null
SELECT T1.GDP, T2.Government FROM economy AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Bosnia and Herzegovina'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
What is the difference in the number of restaurants that passed and failed the canvass inspection type?
canvass inspection type refers to inspection_type = 'Canvass'; restaurant refers to facility_type = 'Restaurant'; difference = subtract(count(inspection_id where results = 'Pass'), count(inspection_id where results = 'Fail'))
SELECT COUNT(CASE WHEN T2.results = 'Pass' THEN T1.license_no END) - COUNT(CASE WHEN T2.results = 'Fail' THEN T1.license_no END) AS diff FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_type = 'Canvass' AND T1.facility_type = 'Restaurant'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
What are the three largest numbers of games sold?
3 largest numbers of games sold refers to game_name where MAX(num_sales) LIMIT 3;
SELECT T.game_platform_id, SUM(T.num_sales) * 100000 FROM region_sales AS T GROUP BY game_platform_id ORDER BY SUM(T.num_sales) * 100000 DESC LIMIT 3
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
From 1593 onwards, what is the difference between the number of comedy works and history works?
From 1593 onwards refers to Date > 1593; comedy works and history works refers to GenreType = 'comedy' and GenreType = 'History'
SELECT SUM(IIF(GenreType = 'Comedy', 1, 0)) - SUM(IIF(GenreType = 'History', 1, 0)) FROM works WHERE Date > 1593
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Among the players, what percentage are both captain and keeper?
captain and keeper refers to Role_Desc = 'CaptainKeeper'; percentage = divide(count(Player_Id) when Role_Desc = 'CaptainKeeper', count(Player_Id)) as percentage
SELECT CAST(SUM(CASE WHEN T2.Role_Desc = 'CaptainKeeper' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Rolee AS T2 ON T1.Role_Id = T2.Role_Id
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Calculate the percentage of country which gained independence as republic after 1970.
null
SELECT CAST(SUM(CASE WHEN Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
What is the category of the inspection of the establishment named "J & J FOOD"?
the establishment named "J & J FOOD" refers to dba_name = 'J & J FOOD'
SELECT DISTINCT T4.category 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 INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T1.dba_name = 'J & J FOOD'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
What are the names of games that were released in 2007?
names of games refers to game_name; released in 2007 refers to release_year = 2007;
SELECT T3.game_name FROM game_platform AS T1 INNER JOIN game_publisher AS T2 ON T1.game_publisher_id = T2.id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.release_year = 2007
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
How many "all" character names have the "all" abbreviation?
character names refers to CharName;"all" abbreviation refers to Abbrev = 'all'
SELECT COUNT(id) FROM characters WHERE Abbrev = 'All'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Among the matches, what percentage have a winning margin above 100?
winning margin above 100 refers to Win_Margin > 100; percentage = divide(count(Match_Id) when Win_Margin > 100, count(Match_Id)) as percentage
SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match`
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
State the different ethnic group and percentage of the language in Singapore.
null
SELECT T1.Name, T1.Percentage FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Singapore' GROUP BY T1.Name, T1.Percentage
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
What is the establishment's name with an inspection category of No Smoking Regulations?
establishment's name refers to dba_name; an inspection category of No Smoking Regulations refers to category = 'No Smoking Regulations'
SELECT DISTINCT T1.dba_name 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 INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'No Smoking Regulations'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
soccer_2016
From which country does the most umpires are from? How many of them are from the mentioned country?
which country refers to Country_Id; most umpires refers to max(count(Umpire_Id))
SELECT T2.Country_Id, COUNT(T1.Umpire_Id) FROM Umpire AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Umpire_Country GROUP BY T2.Country_Id ORDER BY COUNT(T1.Umpire_Id) DESC LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Which countries have more than 90% of African? List the name of the country in full.
Percentage = 90 means 90% of the population
SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'African' AND T1.Percentage > 90
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
video_games
What genre is the game 2010 FIFA World Cup South Africa?
genre refers to genre_name; 2010 FIFA World Cup South Africa refers to game_name = '2010 FIFA World Cup South Africa';
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2010 FIFA World Cup South Africa'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Please name any three comedic works.
comedic works refers to GenreType = 'comedy'
SELECT Title FROM works WHERE GenreType = 'comedy' LIMIT 3
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
In which country does Polish found least in?
null
SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Polish' GROUP BY T2.Name, T1.Percentage ORDER BY T1.Percentage ASC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
food_inspection_2
Among the establishments that paid a 500 fine, what is the percentage of restaurants?
a 500 fine refers to fine = 500; restaurant refers to facility_type = 'Restaurant'; percentage = divide(count(license_no where facility_type = 'Restaurant'), count(license_no)) * 100% where fine = 500
SELECT CAST(COUNT(CASE WHEN T1.facility_type = 'Restaurant' THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.facility_type) 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 T3.fine = 500
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
How many games were sold on PS3 platform in Japan?
how many games = MULTIPLY(SUM(num_sales), 100000); PS3 refers to platform_name = 'PS3'; Japan refers to region_name = 'Japan';
SELECT SUM(T1.num_sales * 100000) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id INNER JOIN game_platform AS T3 ON T1.game_platform_id = T3.id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T2.region_name = 'Japan' AND T4.platform_name = 'PS3'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
On average, how many players from each country bat with their right hand?
bat with their right hand refers to Batting_hand = 'Right-hand bat'; average = divide(count(Player_Id) when Batting_hand = 'Right-hand bat', count(Country_Name))
SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Country_Name) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_id = T2.Batting_hand
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What was the average temperature differences during May 2012 for store number 6 and 7?
during May 2012 refers to SUBSTR(date, 1, 7) = '2012-05'; store number 6 refers to store_nbr = 6; store number 7 refers to store_nbr = 7; average temperature difference = Subtract (Divide (Sum(tavg), Count (date) where the store_nbr = 6), Divide (Sum(tavg), Count(date) where store_nbr = 7))
SELECT ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr AND T1.`date` LIKE '%2012-05%' AND T2.store_nbr = 6 ) - ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr...
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
food_inspection_2
How many of the inspections with serious point levels have no fines?
serious point level refers to point_level = 'Serious'; no fines refers to fine = 0
SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
Indicate the release year of the game with more than 200000 sales in Japan.
more than 200000 sales refers to SUM(num_sales) > 2; Japan refers to region_name = 'Japan';
SELECT DISTINCT T3.release_year FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id INNER JOIN game_platform AS T3 ON T2.game_platform_id = T3.id WHERE T2.num_sales * 100000 > 200000 AND T1.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
Of the wickets taken in the third overs, how many are without the involvement of fielders?
third overs refers to Over_Id = 3; without the involvement of fielders refers to Fielders = ''
SELECT SUM(CASE WHEN Fielders = '' THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Over_Id = 3
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What was the total unit sold for item 10 when the average temperature was below the median temperature?
item 10 refers to item_nbr = 10; average temperature below median temperature refers to tavg < avg(tavg); total units refers to Sum(units)
SELECT SUM(T5.units) FROM weather AS T4 INNER JOIN sales_in_weather AS T5 ON T4.`date` = T5.`date` INNER JOIN relation AS T6 ON T5.store_nbr = T6.store_nbr WHERE T5.item_nbr = 10 AND T4.tavg < ( SELECT AVG(T1.tavg) FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 O...
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
List the price for Zetacoin on 13/11/1 and the next 7 consecutive days. What is the average price for these 7 days?
on 1/11/13 and the next 7 consecutive days refers to DATE BETWEEN '2013-11-01' AND '2013-11-07'; average price refers to AVG(price); Zetacoin refers to name = 'Zetacoin'
SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07' UNION ALL SELECT AVG(T2.PRICE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AN...
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
Indicate the name of all adventure games.
name of games refers to game_name; adventure games refers to game_name WHERE genre_name = 'Adventure';
SELECT T2.game_name FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T1.genre_name = 'Adventure'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Calculate average scene per act in Antony and Cleopatra.
Antony and Cleopatra refers to Title = 'Antony and Cleopatra'; average scene per act = divide(sum(Scene), count(act))
SELECT CAST(SUM(T2.Scene) AS REAL) / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Antony and Cleopatra'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
In the players, how many were out by hit wicket?
out by hit wicket refers to Out_Name = 'hit wicket'
SELECT Player_Out FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T1.Kind_Out = T2.Out_Id WHERE Out_Name = 'hit wicket'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
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 ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
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 inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
olympics
How many games has Prithipal Singh participated in?
games refer to games_id;
SELECT COUNT(T2.games_id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Prithipal Singh'
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NUL...
video_games
How many shooter games are there?
shooter games refers to game_name WHERE genre_name = 'shooter';
SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Shooter'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Calculate the percentage of paragraphs in all chapters of "All's Well That Ends Well".
"All's Well That Ends Well" refers to Title = 'All's Well That Ends Well'; percentage = divide(sum(paragraphs.id) when Title = 'All's Well That Ends Well', count(paragraphs.id)) as percentage
SELECT CAST(SUM(IIF(T1.Title = 'All''s Well That Ends Well', 1, 0)) AS REAL) * 100 / COUNT(T3.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
In the matches where the winning margin is less than fifty, how many teams won by wicket?
winning margin is less than fifty refers to Win_Margin < 50; won by wicket refers to Win_Type = 'wickets'
SELECT COUNT(T2.Win_Id) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T2.Win_Type = 'wickets' AND T1.Win_Margin < 50
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
How many units are being sold for item 1 when the average temperature is 83?
item 1 refers to item_nbr = 1; when the average temperature is 83 refers to tavg = 83
SELECT SUM(units) 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 = 1 AND T1.tavg = 83
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
What is the total value of Argentum coined traded in the past 24 hours on 2016/10/11.
total value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10'
SELECT T2.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11'
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
How many games were published by Activision?
Activision refers to publisher_name = 'Activision';
SELECT COUNT(DISTINCT T3.id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN game AS T3 ON T1.game_id = T3.id WHERE T2.publisher_name = 'Activision'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Please name the latest historical work.
name refers to LongTitle; latest historical work refers to GenreType = 'History' and max(Date)
SELECT LongTitle FROM works WHERE GenreType = 'History' ORDER BY Date DESC LIMIT 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Calculate the win rate of the team "Chennai Super Kings".
team "Chennai Super Kings" refers to Team_Name = 'Chennai Super Kings'; win rate = divide(count(Match_Id where Match_Winner = 3), count(Match_Id)) * 100%
SELECT CAST(SUM(CASE WHEN T1.Match_Winner = 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T2.Team_Name = 'Chennai Super Kings' OR T3.Team_Name = 'Chennai Super Kings'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What was the average temperature difference between store number 18 and 19 on 16 September 2022?
store number 18 refers to store_nbr = 18; store number 19 refers to store_nbr = 19; on 16 September 2022 refers to date = '2022-09-16'; average temperature difference = Subtract(tavg where store_nbr = 18, tavg where store_nbr = 19)
SELECT SUM(CASE WHEN T1.store_nbr = 18 THEN T2.tavg ELSE 0 END) - SUM(CASE WHEN T1.store_nbr = 19 THEN T2.tavg ELSE 0 END) FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.`date` = '2012-09-16'
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
shakespeare
Describe the scene number, act, and title of work which had the description of "The house of ANTIPHOLUS of Ephesus" in chapter.
null
SELECT T2.Act, T2.Scene, T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'The house of ANTIPHOLUS of Ephesus.'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Give the name of the venue where the most number of matches are held.
name of the venue refers to Venue_Name; most number of matches refers to max(count(Venue_Id))
SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id GROUP BY T2.Venue_Name ORDER BY COUNT(T2.Venue_Id) DESC LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What was the difference of number of units sold in station number 1 and number 2 on year 2012?
station 1 refers to station_nbr = 1; station 2 refers to station_nbr = 2; on year 2012 refers to substring (date, 1, 4) = '2012'; difference = Subtract (Sum(units where station_nbr = 1), Sum(units where station_nbr = 2))
SELECT SUM(CASE WHEN T1.station_nbr = 1 THEN units ELSE 0 END) - SUM(CASE WHEN T1.station_nbr = 2 THEN units ELSE 0 END) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.`date` LIKE '%2012%'
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
State the transaction date whereby DigixDAO was transacted at the hightest price.
the highest price refers to max(price); DigixDAO refers to name = 'DigixDAO'
SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
Indicate the publisher who has published the most games of all time.
publisher refers to publisher_name; publisher who has published the most games of all time refers to MAX(COUNT(publisher_name));
SELECT T.publisher_name FROM ( SELECT T2.publisher_name, COUNT(DISTINCT T1.game_id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id GROUP BY T2.publisher_name ORDER BY COUNT(DISTINCT T1.game_id) DESC LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
What percentage of players have Legbreak skill?
Legbreak skill refers to Bowling_skill = 'Legbreak' ; percentage = divide(sum(Player_Id) when Bowling_skill = 'Legbreak', count(Player_Id)) as percentage
SELECT CAST(SUM(CASE WHEN T2.Bowling_skill = ' Legbreak' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What is the ratio of the highest and lowest temperature in store 11?
store 11 refers to store_nbr = 11; highest temperature refers to Max(tmax); lowest temperature refers to Min(tmin); ration = Divide (Max(tmax), Min(tmin))
SELECT CAST((MAX(T1.tmax) - MIN(T1.tmin)) AS REAL) / MIN(T1.tmin) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 11
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
Name the coin that has the highest market capitalization for all transactions in 2018.
highest market capitalization refers to max(market_cap); in 2018 refers to year(date) = 2018
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date LIKE '2018%' AND T2.market_cap = ( SELECT MAX(market_cap) FROM historical WHERE STRFTIME('%Y', date) = '2018' )
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
List the games from the publisher "Activision".
games refers to game_name; "Activision" refers to publisher_name = 'Activision';
SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = 'Activision'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Provide the character name, paragraph number, and plain text of "cousin to the king" description.
character name refers to CharName; paragraph number refers to ParagraphNum
SELECT T1.CharName, T2.ParagraphNum, T2.PlainText FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.Description = 'cousin to the king'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Which player became the man of the series in the year 2012? Give the name and country of this player.
year 2012 refers to Season_Year = 2012; name of player refers to Player_Name.; country of this player refers to Country_Name
SELECT T2.Player_Name, T3.Country_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Season_Year = 2012
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
Which items from store 1 have the highest units sold during rainy day?
store 1 refers to store_nbr = 1; highest unit sold refers to Max(units); during rainy day refers to codesum like '%'||'RA'||'%'; item refers to item_nbr
SELECT T2.item_nbr 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 AND T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 1 AND T1.codesum LIKE '%' OR 'RA' OR '%' GROUP BY T2.item_nbr ORDER BY T2.units DESC LIMIT 1
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
List all the inactive coins and state the last date of its transaction?
the last date refers to max(date); inactive coins refers to status = 'inactive'
SELECT T1.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
How much are the sales of the games in region ID 4?
how much are the sales = SUM(num_sales);
SELECT SUM(T.num_sales) * 100000 FROM region_sales AS T WHERE T.region_id = 4
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
List the scenes and descriptions in Act 1 of " Pericles, Prince of Tyre".
" Pericles, Prince of Tyre" refers to LongTitle = 'Pericles, Prince of Tyre'
SELECT T2.Scene, T2.Description FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Pericles, Prince of Tyre' AND T2.Act = 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Write the name of the player who was the man of the series more than one time.
name of the player refers to Player_Name; man of the series more than one time refers to count(Man_of_the_Series) > 1
SELECT T2.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Man_of_the_Series > 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What is the sea level and average speed for store number 3 and store number 4?
store number 3 refers to store_nbr = 3; average speed refers to avgspeed; store number 4 refers to store_nbr = 4
SELECT T1.sealevel, T1.avgspeed FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 3 OR T2.store_nbr = 4
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
For all transactions for WRAP in August 2016, list the time to achieve highest price and the time to achieve the lowest price.
in May 2013 refers to month(date) = 5 AND year(date) = 2013; time to achieve the highest price refers to time_high; time to achieve the lowest price refers to time_low; WRAP refers to name = 'WARP'
SELECT T2.time_high, T2.time_low, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'WARP' AND STRFTIME('%Y-%m', T2.date) = '2016-08'
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
In 2010, how many PS3 games were released?
in 2010 refers to release_year = 2010; PS3 refers to platform_name = 'PS3';
SELECT 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 = 'PS3' AND T2.release_year = 2010
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
In how many venues did team 2 win the toss and lose the match?
team 2 win the toss refers to Toss_Winner = Team_2 ; lose the match refers to Match_Winner = Team_1
SELECT SUM(CASE WHEN T1.Team_2 = T1.Match_Winner THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Team_1 = T1.Toss_Winner
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
List out dates when haze is recorded in store 35.
store 35 refers to store_nbr = 35; haze is recorded refers to codesum like '%'||'HZ'||'%'
SELECT T1.`date` FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 35 AND T1.codesum LIKE '%' OR 'HZ' OR '%'
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
What is the average monthly circulating supply for Frozen in 2014.
average monthly circulating supply = AVG(circulating_supply); in 2017 refers to date BETWEEN '2017-01-01' AND '2017-12-31'
SELECT CAST(SUM(T2.circulating_supply) AS REAL) / 12 FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Frozen' AND STRFTIME('%Y', T2.date) = '2014'
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
shakespeare
Describe the full title which had the character named Servant to Montague.
full title refers to LongTitle; character named Servant to Montague refers to characters.Description = 'Servant to Montague'
SELECT DISTINCT T1.LongTitle FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.Description = 'Servant to Montague'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
sales_in_weather
List out stations number and items sold by store 17.
station number refers to station_nbr; store 17 refers to store_nbr = 17
SELECT T1.station_nbr, T2.item_nbr FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.store_nbr = 17 GROUP BY T1.station_nbr, T2.item_nbr
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
video_games
Calculate the difference between sales of games from region ID 2 and region ID 3.
difference = SUBTRACT(SUM(num_sales WHERE region_id = 2), SUM(num_sales WHERE region_id = 3));
SELECT SUM(CASE WHEN T.region_id = 2 THEN T.num_sales ELSE 0 END) - SUM(CASE WHEN T.region_id = 3 THEN T.num_sales ELSE 0 END) FROM region_sales t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
Which city hosted the least number of no-result matches?
city refers to City_Name; no-result matches refers to Win_type = 'NoResult'; least number refers to min(count(Win_type = 'NoResult'))
SELECT T4.City_Name FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Venue AS T3 ON T1.Venue_Id = T3.Venue_Id INNER JOIN City AS T4 ON T3.City_Id = T4.City_Id WHERE T2.Win_Type = 'NO Result' GROUP BY T4.City_Id ORDER BY COUNT(T2.Win_Type) ASC LIMIT 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
How many items were sold by store 9 during a snowy day?
store 9 refers to store_nbr = 9; snowy day refers to snowfall < > 0 and snowfall is not null; item refers to item_nbr
SELECT COUNT(DISTINCT item_nbr) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T3.store_nbr = 9 AND T1.snowfall <> 0 AND T1.snowfall IS NOT NULL
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
video_games
What is the percentage of games that were released on PS4 in 2014 among all platforms?
percentage - MULTIPLY(DIVIDE(SUM(platform_name = 'PS4'), COUNT(game_id)), 100); in 2014 refers to release_year = 2014;
SELECT CAST(COUNT(CASE WHEN T2.platform_name = 'PS4' THEN T3.game_id ELSE NULL END) AS REAL) * 100 / COUNT(T3.game_id) FROM game_platform AS T1 INNER JOIN platform AS T2 ON T1.platform_id = T2.id INNER JOIN game_publisher AS T3 ON T1.game_publisher_id = T3.id WHERE T1.release_year = 2014
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Gives the average number of chapters in Shakespeare's 1599 work.
1599 work refers to Date = '1599'; average number refers to divide(count(chapters.id), count(works.id))
SELECT CAST(COUNT(T1.id) AS REAL) / COUNT(DISTINCT T2.id) FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.Date = '1599'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
sales_in_weather
How many units of item 7 have been sold by store 7 when the snow is less than 5 inches?
item 7 refers to item_nbr = 7; store 7 refers to store_nbr = 7; snow is less than 5 inches refers to snowfall < 5
SELECT SUM(units) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.store_nbr = 7 AND T3.item_nbr = 7 AND T1.snowfall < 5
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
food_inspection_2
Where in Chicago does the restaurant named "Old Timers Rest & Lounge" located?
in Chicago refers to city = 'CHICAGO'; restaurant refers to facility_type = 'Restaurant'; "Old Timers Rest & Lounge" refers to dba_name = 'OLD TIMERS REST & LOUNGE'; location refers to address
SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant'
CREATE TABLE inspection ( followup_to INTEGER, -- foreign key (employee_id) references employee(employee_id), employee_id INTEGER, -- license_no INTEGER, -- foreign key (followup_to) references inspection(inspection_id), foreign key (license_no) references establishment(license_no), inspection_id INTEGER p...
video_games
List down the game platform IDs of games with a region ID of 1.
null
SELECT T.game_platform_id FROM region_sales AS T WHERE T.region_id = 1
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What is the title which has character named "Froth"?
character named "Froth" refers to CharName = 'Froth'
SELECT DISTINCT T1.title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.CharName = 'Froth'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Of the matches that were won by runs by team 1, what percentage have team 1 won the toss and decided to field?
won by runs refers to Win_Type = 'runs'; won the toss and decided to field refers to Toss_Winner and Toss_Name = 'field'; percentage = divide(count(Team_1) when Match_Winner = Team_1 and Toss_Winner = Team_1, count(Team_1)) as percentage
SELECT CAST(COUNT(CASE WHEN T1.Team_1 = T1.Match_Winner = T1.Toss_Winner THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Team_1) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Toss_Decision AS T3 ON T1.Toss_Decide = T3.Toss_Id WHERE T3.Toss_Name = 'field' AND T2.Win_Type = 'runs'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
What is the lowest minimum temperature recorded in store 16 on January 2012?
lowest minimum temperature refers to Min(tmin); store 16 refers to store_nbr = 16; on January 2012 refers to Substring (date, 1, 7) = '2012-01'
SELECT MIN(tmin) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 16 AND T1.`date` LIKE '%2012-01%'
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...
coinmarketcap
State the transaction date and the price when Bitcoin was bottomed?
was bottomed refers to min(price)
SELECT T2.date, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.price LIMIT 1
CREATE TABLE historical ( total_supply REAL, -- high REAL, -- percent_change_7d REAL, -- open REAL, -- close REAL, -- percent_change_1h REAL, -- percent_change_24h REAL, -- num_market_pairs INTEGER, -- time_low TEXT, -- coin_id INTEGER, -- date DATE, -- time_high TEXT, -- market_cap...
video_games
State the game publisher IDs of the games with a platform ID of 16.
null
SELECT T.game_publisher_id FROM game_platform AS T WHERE T.platform_id = 16
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
How many scenes are there in work id 7, act 1?
null
SELECT COUNT(id) FROM chapters WHERE work_id = 7 AND Act = 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Among the players who were born in 1977, provide names and birthdates of the players from England.
born in 1977 refers to DOB LIKE '1977%'; name refers to Player_Name; birthdate refers to DOB; England refers to Country_Name = 'England'
SELECT T2.Player_Name, T2.DOB FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.DOB LIKE '1977%' AND T1.Country_Name = 'England'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
sales_in_weather
How many stations were able to sell item 5 on January 2014?
item 5 refers to item_nbr = 5; on January 2014 refers to Substring (date, 1, 7) = '2014-01'
SELECT COUNT(DISTINCT T2.station_nbr) AS number FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE SUBSTR(`date`, 1, 7) = '2014-01' AND item_nbr = 5
CREATE TABLE sales_in_weather ( primary key (store_nbr, date, item_nbr), store_nbr INTEGER, -- units INTEGER, -- item_nbr INTEGER, -- date DATE, -- ); CREATE TABLE relation ( store_nbr INTEGER primary key, station_nbr INTEGER, -- foreign key (store_nbr) references sales_in_weather(store_nbr), foreig...