db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
video_games
Give the genre of the games released from 2000 to 2002.
genre refers to genre_name; released from 2000 to 2002 refers to release_year BETWEEN 2000 AND 2002
SELECT DISTINCT T4.genre_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 INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T1.release_year BETWEEN 2000 AND 2002
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 country is the oldest player from?
country refers to Country_Name; the oldest refers to min(DOB)
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.Country_Name IS NOT NULL ORDER BY T2.DOB 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 ...
ice_hockey_draft
What is the percentage of players who were born in Denmark and weight above 154 lbs?
percentage = MULTIPLY(DIVIDE(SUM(weight_in_lbs > 154 and nation = 'Denmark'), COUNT(ELITEID)), 100); players refers to PlayerName; born in Denmark refers to nation = 'Denmark'; weight above 154 lbs refers to weight_in_lbs > 154;
SELECT CAST(COUNT(CASE WHEN T1.nation = 'Denmark' AND T2.weight_in_lbs > 154 THEN T1.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
What is the release year of the game that gained 350000 sales in North America?
gained 350000 sales refers to num_sales = 3.5; in North America refers to region_name = 'North America'
SELECT 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 = 350000 AND T1.region_name = 'North America'
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`, `...
ice_hockey_draft
Who has the heaviest weight?
who refers to PlayerName; heaviest weight refers to MAX(weight_in_kg);
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id ORDER BY T2.weight_in_kg DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
What is the actual departure time of JetBlue Airways with the plane's tail number N903JB to Fort Lauderdale-Hollywood International Airport on the 20th of August 2018?
actual departure time refers to DEP_TIME; JetBlue Airways refers to Description like '%JetBlue Airways%'; tail number refers to TAIL_NUM; TAIL_NUM = 'N903JB'; to refers to DEST; Fort Lauderdale-Hollywood International Airport refers to Description like '%Fort Lauderdale-Hollywood%'; on the 20th of August 2018 refers to...
SELECT T1.DEP_TIME FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code INNER JOIN Airports AS T3 ON T1.DEST = T3.Code WHERE T1.FL_DATE = '2018/8/20' AND T1.TAIL_NUM = 'N903JB' AND T2.Description LIKE '%JetBlue Airways%' AND T3.Description LIKE '%Fort Lauderdale-Hollywood%'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
How many role-playing games are there?
role-playing game refers to genre_name = 'Role-Playing'
SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Role-Playing'
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
Please list the names of the players who use the right hand as their batting hand and are from Australia.
name of player refers to Player_Name; right hand as batting hand refers to Batting_Hand = 'Right-hand bat'; Australia refers to Country_Name = 'Australia'
SELECT T2.Player_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_id INNER JOIN Batting_Style AS T3 ON T2.Batting_hand = T3.Batting_Id WHERE T1.Country_Name = 'Australia' AND T3.Batting_Hand = 'Right-hand bat'
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 ...
ice_hockey_draft
List out the name of players who weight 190 lbs.
name of players refers to PlayerName; weight 190 lbs refers to weight_in_lbs = 190;
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_lbs = 190
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
What is the total number of flights that flew on August 2, 2018 with air carrier described as Horizon Air?
on August 2, 2018 refers to FL_DATE = '2018/8/2'; Horizon Air refers to Description which includs 'Horizon Air';
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Horizon Air%' AND T2.FL_DATE = '2018/8/2'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
What is the title of the game that gained the most sales in Japan?
title of the game refers to game_name; gained the most sales refers to max(num_sales); in Japan refers to region_name = 'Japan'
SELECT T.game_name FROM ( SELECT T5.game_name 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 INNER JOIN game_publisher AS T4 ON T3.game_publisher_id = T4.id INNER JOIN game AS T5 ON T4.game_id = T5.id WHERE T1.region_name = 'Japan' O...
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`, `...
ice_hockey_draft
What is the weight in kg of Tony Martensson?
FALSE;
SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'Tony Martensson'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Which airport did Republic Airline fly the most from?
Republic Airline refers to Description = 'Republic Airline: YX'; fly the most from refers to MAX(COUNT(ORIGIN));
SELECT T2.DEST FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Republic Airline: YX' GROUP BY T2.DEST ORDER BY COUNT(T2.DEST) DESC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
Which company published the game with the most sales in North America?
company refers to publisher_name; the most sales refers to max(num_sales); in North America refers to region_name = 'North America'
SELECT T.publisher_name FROM ( SELECT T5.publisher_name, SUM(T2.num_sales) * 100000 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 INNER JOIN game_publisher AS T4 ON T3.game_publisher_id = T4.id INNER JOIN publisher AS T5 ON T4.publi...
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`, `...
ice_hockey_draft
What is the birthplace of Aaron Gagnon?
FALSE;
SELECT birthplace FROM PlayerInfo WHERE PlayerName = 'Aaron Gagnon'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
soccer_2016
What is the bowling skill used by most players?
bowling skill used by most players refers to max(count(Bowling_Skill))
SELECT T1.Bowling_Skill FROM Bowling_Style AS T1 INNER JOIN Player AS T2 ON T2.Bowling_skill = T1.Bowling_Id GROUP BY T1.Bowling_Skill ORDER BY COUNT(T1.Bowling_Skill) 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 ...
ice_hockey_draft
Among all penalty minutes picked up by Ak Bars Kazan in the 1999-2000 season, identify the percentage picked up by Yevgeni Muratov.
penalty minutes refers to PIM; Ak Bars Kazan refers to TEAM = 'Ak Bars Kazan'; percentage = MULTIPLY(DIVIDE(SUM(PIM WHERE PlayerName = 'Yevgeni Muratov'), SUM(PIM)), 100.0); 1999-2000 season refers to SEASON = '1999-2000';
SELECT CAST(SUM(CASE WHEN T2.PlayerName = 'Yevgeni Muratov' THEN T1.PIM ELSE 0 END) AS REAL) * 100 / SUM(T1.PIM) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1999-2000' AND T1.TEAM = 'Ak Bars Kazan'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Provide the destinations of flight number 1596.
destination refers to DEST; flight number refers to OP_CARRIER_FL_NUM; OP_CARRIER_FL_NUM = 1596;
SELECT DEST FROM Airlines WHERE OP_CARRIER_FL_NUM = 1596
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
Give the name of the publisher of the game ID 75.
name of publisher refers to publisher_name; the game ID 75 refers to game_id = 75
SELECT T2.publisher_name FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.game_id = 75
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`, `...
ice_hockey_draft
Among all goals scored by Calgary Hitmen in the 2007-2008 season, identify the percentage scored by Ian Schultz.
goals scored refers to G; Calgary Hitmen refers to TEAM = 'Calgary Hitmen'; percentage = MULTIPLY(DIVIDE(SUM(G WHERE PlayerName = 'Ian Schultz'), SUM(G)), 100); 2007-2008 season refers to SEASON = '2007-2008';
SELECT CAST(SUM(CASE WHEN T2.PlayerName = 'Ian Schultz' THEN T1.G ELSE 0 END) AS REAL) * 100 / SUM(T1.G) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2007-2008' AND T1.TEAM = 'Calgary Hitmen'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Which flight carrier operator flies from Atlantic City to Fort Lauderdale?
flight carrier operator refers to OP_CARRIER_AIRLINE_ID; from Atlantic City refers to ORIGIN = 'ACY'; to Fort Lauderdale refers to DEST = 'FLL';
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.ORIGIN = 'ACY' AND T1.DEST = 'FLL' GROUP BY T2.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
Among the games released in 2004, what is the percentage of games on PSP?
in 2004 refers to release_year = 2004; on PSP refers to platform_name = 'PSP'; percentage = divide(sum(platform_id where platform_name = 'PSP'), count(platform_id)) * 100% where release_year = 2004
SELECT CAST(COUNT(CASE WHEN T1.platform_name = 'PSP' THEN T3.game_id ELSE NULL END) AS REAL) * 100 / COUNT(T3.game_id) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN game_publisher AS T3 ON T2.game_publisher_id = T3.id WHERE T2.release_year = 2004
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
Among the players who use the right hand as their batting hand, how many of them were born after 1985?
right hand as batting hand refers to Batting_Hand = 'Right-hand bat'; born after 1985 refers to SUBSTR(DOB, 1, 4) > 1985
SELECT SUM(CASE WHEN SUBSTR(T1.DOB, 1, 4) > 1985 THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T2.Batting_Hand = 'Right-hand bat'
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 ...
ice_hockey_draft
How tall is the player from Yale University who picked up 28 penalty minutes in the 2005-2006 season?
how tall refers to height_in_cm; Yale University refers to TEAM = 'Yale Univ.'; 28 penalty minutes refers to PIM = '28'; 2005-2006 season refers to SEASON = '2005-2006';
SELECT T3.height_in_cm FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T2.height = T3.height_id WHERE T1.SEASON = '2005-2006' AND T1.TEAM = 'Yale Univ.' AND T1.PIM = 28
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Among the flights with air carrier named Republic Airline, how many of the flights have departure delay of 30 minutes and above?
Republic Airline refers to Description which contains 'Republic Airline'; departure delay of 30 minutes and above refers to DEP_DELAY > 30;
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Republic Airline%' AND T2.DEP_DELAY > 30
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
ice_hockey_draft
How many players who were drafted by the Toronto Maple Leafs have played over 300 games in their first 7 years of the NHL career?
drafted by the Toronto Maple Leafs refers to overallby = 'Toronto Maple Leafs'; played over 300 games in their first 7 years of the NHL career refers to sum_7yr_GP > 300;
SELECT COUNT(ELITEID) FROM PlayerInfo WHERE overallby = 'Toronto Maple Leafs' AND sum_7yr_GP > 300
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
In which platform does the game titled 15 Days available?
platform refers to platform_name; the game titled 15 Days refers to game_name = '15 Days'
SELECT T1.platform_name 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 INNER JOIN game AS T4 ON T3.game_id = T4.id WHERE T4.game_name = 'Counter Force'
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 is the role of SC Ganguly in the match on 2008/4/18?
role refers to of Role_Id; SC Ganguly refers to Player_Name = 'SC Ganguly'; on 2008/4/18 refers to Match_Date = '2008-04-18'
SELECT T2.Role_Id FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Match AS T4 ON T2.Match_Id = T4.Match_Id WHERE T1.Player_Name = 'SC Ganguly' AND T4.Match_Date = '2008-04-18'
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 ...
ice_hockey_draft
Name the player and his team who made the playoffs in the 2006-2007 season of SuperElit league with the highest points.
name of the player refers to PlayerName; playoffs refers to GAMETYPE = 'Playoffs'; highest points refers to MAX(P); 2006-2007 season refers to SEASON = '2006-2007'; SuperElit league refers to LEAGUE = 'SuperElit';
SELECT T2.PlayerName, T1.TEAM FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2006-2007' AND T1.GAMETYPE = 'Playoffs' AND T1.LEAGUE = 'SuperElit' ORDER BY T1.P DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
How many airports have a code starting with the letter C?
code starting with the letter C refers to Code like 'C%';
SELECT COUNT(*) FROM Airports WHERE Code LIKE 'C%'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
ice_hockey_draft
Among all players drafted by the Toronto Maple Leafs in 2008, identify the player with the highest prospects for the draft.
players refers to PlayerName; drafted by the Toronto Maple Leafs refers to overallby = 'Toronto Maple Leafs'; highest prospects for the draft refers to MAX(CSS_rank);
SELECT PlayerName FROM PlayerInfo WHERE overallby = 'Toronto Maple Leafs' AND draftyear = '2008' ORDER BY CSS_rank DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Provide the air carrier description of the flight with a tail number N922US from Phoenix.
tail number refers to TAIL_NUM; TAIL_NUM = 'N922US'; from Phoenix refers to ORIGIN = 'PHX';
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.TAIL_NUM = 'N922US' AND T1.ORIGIN = 'PHX' GROUP BY T2.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
Provide the game publisher's name of the game with sales greater than 90% of the average sales in Japan.
game publisher's name refers to publisher_name; sales greater than 90% of the average sales refers to num_sales > multiply(0.9, avg(num_sales)); in Japan refers to region_name = 'Japan'
SELECT DISTINCT T5.publisher_name 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 INNER JOIN game_publisher AS T4 ON T3.game_publisher_id = T4.id INNER JOIN publisher AS T5 ON T4.publisher_id = T5.id WHERE T2.num_sales * 10000000 > ( ...
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`, `...
ice_hockey_draft
Among all players drafted by the Toronto Maple Leafs, identify the percentage who are from Eastern Europe.
players refers to PlayerName; drafted by the Toronto Maple Leafs refers to overallby = 'Toronto Maple Leafs'; percentage = MULTIPLY(DIVIDE(SUM(nation = 'Eastern Europe'), COUNT(ELITEID) WHERE overallby = 'Toronto Maple Leafs'), 100); from Eastern Europe refers to nation in ('Belarus', 'Bulgaria', 'Czech Republic', 'Hun...
SELECT CAST(COUNT(CASE WHEN nation IN ('Belarus', 'Czech Rep.', 'Slovakia', 'Ukraine') THEN ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(ELITEID) FROM PlayerInfo WHERE overallby = 'Toronto Maple Leafs'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
What is the genre ID of the '2Xtreme' game?
the '2Xtreme' game refers to game_name = '2Xtreme'
SELECT T.genre_id FROM game AS T WHERE T.game_name = '2Xtreme'
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
Among the players whose bowling skill is "Legbreak", when was the oldest one of them born?
the oldest refers to min(DOB); date of birth refers to DOB
SELECT MIN(T1.DOB) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id WHERE T2.Bowling_Skill = 'Legbreak'
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 ...
ice_hockey_draft
Name the player who has the most NHL points in draft year.
name of the player refers to PlayerName; most NHL points in draft year refers to MAX(P);
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.P = ( SELECT MAX(P) FROM SeasonStatus )
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
List the flight date of flights with air carrier described as Profit Airlines Inc.: XBH which have an actual elapsed time below 100.
flight date refers to FL_DATE; Profit Airlines Inc.: XBH refers to Description = 'Profit Airlines Inc.: XBH'; actual elapsed time below 100 refers to ACTUAL_ELAPSED_TIME < 100;
SELECT T2.FL_DATE FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ACTUAL_ELAPSED_TIME < 100 AND T1.Description = 'Profit Airlines Inc.: XBH'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
ice_hockey_draft
Identify the name and position of the player who has committed the most rule violations.
name of the player refers to PlayerName; position of the player refers to position_info; committed the most rule violations refers to MAX(PIM);
SELECT T2.PlayerName, T2.position_info FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.PIM = ( SELECT MAX(PIM) FROM SeasonStatus )
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
What are the air carriers of the flights that flew on August 25, 2018 that have departure delay of -5?
on August 25, 2018 refers to FL_DATE = '2018/8/25'; departure delay of -5 refers to DEP_DELAY = -5;
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.FL_DATE = '2018/8/25' GROUP BY T1.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
On which platform was Panzer Tactics released in 2007?
platform refers to platform_name; Panzer Tactics refers to game_name = 'Panzer Tactics'; released in 2007 refers to release_year = 2007
SELECT T5.platform_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 INNER JOIN game_platform AS T4 ON T1.id = T4.game_publisher_id INNER JOIN platform AS T5 ON T4.platform_id = T5.id WHERE T3.game_name = 'Panzer Tactics' AND T4.release_year...
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
For how many times has SC Ganguly played as team captain in a match?
SC Ganguly refers to Player_Name = 'SC Ganguly'; team captain refers to Role_Desc = 'Captain'
SELECT SUM(CASE WHEN T3.Role_Desc = 'Captain' THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T1.Player_Name = 'SC Ganguly'
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 ...
ice_hockey_draft
Identify the players with the same height as Brian Gionta. How tall are they?
players refers to PlayerName; height refers to height_in_cm;
SELECT T2.PlayerName, T1.height_in_cm FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.height = ( SELECT height FROM PlayerInfo WHERE PlayerName = 'Brian Gionta' )
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
Provide the ID of 1C Company.
ID refers to publisher.id; 1C Company refers to publisher_name = '1C Company'
SELECT T.id FROM publisher AS T WHERE T.publisher_name = '1C Company'
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`, `...
ice_hockey_draft
Identify the players who weigh 120 kg.
players refers to PlayerName; weigh 120 kg refers to weight_in_kg = 120;
SELECT T2.PlayerName FROM weight_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.weight_id = T2.weight WHERE T1.weight_in_kg = 120
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
What is the total number of flights that have Oklahoma as their origin?
Oklahoma as origin refers to Origin = 'OKC';
SELECT COUNT(*) AS num FROM Airlines WHERE Origin = 'OKC'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
How many games were released in 1981?
released in 1981 refers to release_year = 1981
SELECT COUNT(T.id) FROM game_platform AS T WHERE T.release_year = 1981
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 is the average winning margin of all the matches SC Ganguly has played in?
SC Ganguly refers to Player_Name = 'SC Ganguly'; the average winning margin = divide(sum(Win_Margin), count(Match_Id)) where Player_Name = 'SC Ganguly'
SELECT CAST(SUM(T3.Win_Margin) AS REAL) / COUNT(*) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id WHERE T1.Player_Name = 'SC Ganguly'
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 ...
ice_hockey_draft
Name the Chilliwack Chiefs players who have scored 100 points or more in the NHL.
name of the player refers to PlayerName; Chilliwack Chiefs refers to TEAM = 'Chilliwack Chiefs'; scored 100 points or more in the NHL refers to P > 100;
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.TEAM = 'Chilliwack Chiefs' AND T1.P >= 100
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Among the flights with air carrier "Southwest Airlines Co.: WN", provide the tail number of flights with an actual elapsed time lower than the 80% of the average actual elapsed time of listed flights.
Southwest Airlines Co.: WN refers to Description = 'Southwest Airlines Co.: WN'; tail number refers to TAIL_NUM; actual elapsed time lower than the 80% of the average actual elapsed time refers to ACTUAL_ELAPSED_TIME < (MULTIPLY AVG(ACTUAL_ELAPSED_TIME), 0.8);
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southwest Airlines Co.: WN' AND T2.ACTUAL_ELAPSED_TIME < ( SELECT AVG(ACTUAL_ELAPSED_TIME) * 0.8 FROM Airlines )
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
Sum the total game sales in every region for platform ID 9658.
total game sales refers to multiply(sum(num_sales), 100000); platform ID 9658 refers to game_platform_id = 9658
SELECT SUM(T.num_sales) * 100000 FROM region_sales AS T WHERE T.game_platform_id = 9658
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 is the name of the player who won the "man of the match" award in the match on 2008/4/18?
name of player refers to Player_Name; on 2008/4/18 refers to Match_Date = '2008-04-18'
SELECT T2.Player_Name FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T1.Match_Date = '2008-04-18'
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 ...
ice_hockey_draft
Name the player who scored the most goals in a single game in the 2007-2008 season of WHL?
name of the player refers to PlayerName; scored the most goals in a single game refers to MAX(G); WHL refers to LEAGUE = 'WHL'; 2007-2008 season refers to SEASON = '2007-2008';
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2007-2008' AND T1.LEAGUE = 'WHL' ORDER BY T1.G DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
What is the airport description of the airport code A11?
null
SELECT Description FROM Airports WHERE Code = 'A11'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
List the game IDs that were released in 2017.
game ID refers to game.id; released in 2017 refers to release_year = 2017
SELECT T.id FROM game_platform AS T WHERE T.release_year = 2017
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
Among all the matches SC Ganguly has played in, what is the highest winning margin?
SC Ganguly refers to Player_Name = 'SC Ganguly'; the highest winning margin refers to max(Win_Margin)
SELECT MAX(T3.Win_Margin) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id WHERE T1.Player_Name = 'SC Ganguly'
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 ...
ice_hockey_draft
Among all the teams that made the playoffs in the 2007-2008 season, identify the percentage that played over 20 games.
playoffs refers to GAMETYPE = 'Playoffs'; percentage = MULTIPLY(DIVIDE(SUM(GP > 20), COUNT(ELITEID)), 100); played over 20 games refers to GP > 20; 2007-2008 season refers to SEASON = '2007-2008';
SELECT CAST(COUNT(CASE WHEN GP > 20 THEN TEAM ELSE NULL END) AS REAL) * 100 / COUNT(TEAM) FROM SeasonStatus WHERE SEASON = '2007-2008' AND GAMETYPE = 'Playoffs'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
Show the id of the game platform with the most sales in region 2.
id of the game platform refers to game_platform_id; the most sales refers to max(num_sales); region 2 refers to region_id = '2'
SELECT T1.game_platform_id FROM ( SELECT T.game_platform_id, SUM(T.num_sales) FROM region_sales AS T WHERE T.region_id = 2 GROUP BY T.game_platform_id ORDER BY SUM(T.num_sales) DESC LIMIT 1 ) T1
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
Give the name of the youngest player.
name of player refers to Player_Name; the youngest refers to max(DOB)
SELECT Player_Name FROM Player ORDER BY DOB 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 ...
ice_hockey_draft
What is the average weight in pounds of all the players with the highest prospects for the draft?
average = AVG(weight_in_lbs); weight in pounds refers to weight_in_lbs; players refers to PlayerName; highest prospects for the draft refers to MAX(CSS_rank);
SELECT CAST(SUM(T2.weight_in_lbs) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.CSS_rank = ( SELECT MAX(CSS_rank) FROM PlayerInfo )
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Among the flights of the air carrier described as American Airlines, what is the percentage of the flights with earlier departure?
American Airlines can be found in Description which contains 'American Airlines'; percentage = MULTIPLY(DIVIDE(SUM(DEP_DELAY < 0), COUNT(DEP_DELAY)), 1.0); earlier departure refers to DEP_DELAY < 0;
SELECT CAST(SUM(CASE WHEN T2.DEP_DELAY < 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%American Airlines%'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
How many games are puzzle genre?
puzzle genre refers to genre_name = 'Puzzle'
SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Puzzle'
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`, `...
ice_hockey_draft
What is the difference in the number of goals scored by Pavel Brendl during the regular season versus the playoffs in the 1998-1999 season?
difference = SUBTRACT(SUM(G WHERE GAMETYPE = 'Regular Season'), SUM(G WHERE GAMETYPE = 'Playoffs') WHERE SEASON = '1998-1999'); number of goals scored refers to G; regular season refers to GAMETYPE = 'Regular Season'; playoffs refers to GAMETYPE = 'Playoffs'; 1998-1999 season refers to SEASON = '1998-1999';
SELECT T3.Rs_G - T4.Pf_G AS diff FROM ( SELECT T2.PlayerName, T1.G AS Rs_G FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Pavel Brendl' AND T1.SEASON = '1998-1999' AND T1.GAMETYPE = 'Regular Season' ) AS T3 INNER JOIN ( SELECT T2.PlayerName, T1.G AS Pf_G FROM Seaso...
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
Provide the genre name of the genre ID 3.
genre ID 3 refers to genre.id = 3
SELECT T.genre_name FROM genre AS T WHERE T.id = 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`, `...
ice_hockey_draft
Among the players who played 72 games, how many are left-shooters?
played 72 games refers to GP = 72; left-shooters refers to shoots = 'L';
SELECT COUNT(T2.ELITEID) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.GP = 72 AND T2.shoots = 'L'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
Give the air carrier description of the flights that have an earlier arrival and departure.
earlier arrival and departure refers to ARR_DELAY < 0 AND DEP_DELAY < 0;
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_DELAY < 0 AND T2.DEP_DELAY < 0 GROUP BY T1.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
When was the "Adventure Island" game released?
when refers to release_year; the "Adventure Island" game refers to game_name = 'Adventure Island'
SELECT T3.release_year FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id WHERE T1.game_name = 'Adventure Island'
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
Give the name of venue for the game with a win margin of 138 points.
name of venue refers to Venue_Name; a win margin of 138 points refers to Win_Margin = 138
SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Win_Margin = 138
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 ...
ice_hockey_draft
Who is the youngest player to have played during the 1997-1998 season for OHL League?
youngest player refers to MAX(birthdate); 1997-1998 season refers to SEASON = '1997-1998'; OHL league refers to LEAGUE = 'OHL';
SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1997-1998' AND T1.LEAGUE = 'OHL' ORDER BY T2.birthdate DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
How many games were published by Acclaim Entertainment?
published by Acclaim Entertainment refers to publisher_name = 'Acclaim Entertainment'
SELECT COUNT(DISTINCT T1.game_id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T2.publisher_name = 'Acclaim Entertainment'
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
Among all the players born after the year 1985, what is the percentage of the players who use the right hand as their batting hand?
born after the year 1985 refers to SUBSTR(DOB, 1, 4) > 1985; right hand as batting hand refers to Batting_Hand = 'Right-hand bat'; percentage = divide(count(Player_Id where Batting_Hand = 'Right-hand bat'), count(Player_Id)) * 100% where SUBSTR(DOB, 1, 4) > 1985
SELECT CAST(SUM(CASE WHEN T2.Batting_Hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE SUBSTR(T1.DOB, 1, 4) > 1985
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 ...
ice_hockey_draft
How many games did the tallest player have ever played?
tallest player refers to MAX(height_in_cm);
SELECT T1.GP FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.ELITEID = ( SELECT t.ELITEID FROM PlayerInfo t ORDER BY t.height DESC LIMIT 1 )
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
List the air carrier's description with arrival time lower than the 40% of the average arrival time of flights that flew to Phoenix.
arrival time lower than the 40% of the average arrival time refers to ARR_TIME < MULTIPLY(AVG(ARR_TIME), 0.4); flew to Phoenix refers to DEST = 'PHX';
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'PHX' AND T2.ARR_TIME < ( SELECT AVG(ARR_TIME) * 0.4 FROM Airlines ) GROUP BY T1.Description
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
List the genre id of the game Pro Evolution Soccer 2012.
Pro Evolution Soccer 2012 refers to game_name = 'Pro Evolution Soccer 2012'
SELECT T.genre_id FROM game AS T WHERE T.game_name = 'Pro Evolution Soccer 2012'
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`, `...
ice_hockey_draft
What are the names of the players who played for Acadie-Bathurst Titan during the regular season in 1998-1999?
names of the players refers to PlayerName; played for Acadie-Bathurst Titan refers to TEAM = 'AcadieandBathurst Titan'; regular season refers to GAMETYPE = 'Regular Season'; in 1998-1999 refers to SEASON = '1998-1999';
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1998-1999' AND T1.GAMETYPE = 'Regular Season' AND T1.TEAM = 'Acadie-Bathurst Titan'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
Provide the number of games sold in North America on the PS4 platform.
number of games sold refers to sum(multiply(num_sales, 100000)); in North America refers to region_name = 'North America'; on the PS4 platform refers to platform_name = 'PS4'
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 = 'North America' AND T4.platform_name = 'PS4'
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
Give the name of the striker in the match no. 419169, over no.3, ball no.2, inning no.2.
name of the striker refers to Player_Name; match no. 419169 refers to Match_Id = 419169; over no.3 refers to Over_Id = 3; ball no.2 refers to Ball_Id = 2; inning no.2 refers to Innings_No = 2
SELECT T2.Player_Name FROM Ball_by_Ball AS T1 INNER JOIN Player AS T2 ON T1.Striker = T2.Player_Id WHERE T1.Match_Id = 419169 AND T1.Over_Id = 3 AND T1.Ball_Id = 2 AND T1.Innings_No = 2
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 ...
ice_hockey_draft
Who is the most valuable player in QMJHL league during the 2004-2005 season?
most valuable player refers to MAX(P); QMJHL league refers to LEAGUE = 'QMJHL'; 2004-2005 season refers to SEASON = '2004-2005';
SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON BETWEEN '2004' AND '2005' AND T1.LEAGUE = 'QMJHL' ORDER BY T1.P DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
airline
List the description of the airports that have code that ends with number 3?
code that ends with number 3 refers to Code like '%3';
SELECT Description FROM Airports WHERE Code LIKE '%3'
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - Nu...
video_games
What is the first year a game is released?
the first year refers to min(release_year)
SELECT MIN(T.release_year) FROM game_platform 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`, `...
ice_hockey_draft
What is the weight in kilograms of the player with the highest number of goal differential of all time?
weight in kilograms refers to weight_in_kg; highest number of goal differential of all time refers to MAX(PLUSMINUS);
SELECT T3.weight_in_kg FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN weight_info AS T3 ON T2.weight = T3.weight_id ORDER BY T1.PLUSMINUS DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
books
What is the publication date of the book with the most pages?
book with the most pages refers to Max(num_pages)
SELECT publication_date FROM book ORDER BY num_pages DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
video_games
Provide the games that can be played on the SCD platform.
game refers to game_name; on the SCD platform refers to platform_name = 'SCD'
SELECT T4.game_name 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 INNER JOIN game AS T4 ON T3.game_id = T4.id WHERE T2.platform_name = 'SCD'
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
State the name of captain keeper of the match no.419117.
name refers to Player_Name; captain keeper refers to Role_Desc = 'CaptainKeeper'; match no.419117 refers to Match_Id = '419117'
SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Rolee AS T2 ON T1.Role_Id = T2.Role_Id INNER JOIN Player AS T3 ON T1.Player_Id = T3.Player_Id WHERE T1.Match_Id = '419117' AND T2.Role_Desc = 'CaptainKeeper'
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 ...
ice_hockey_draft
How many players, who were drafted by Anaheim Ducks in 2008, have played for U.S. National U18 Team?
drafted by Anaheim Ducks refers to overallby = 'Anaheim Ducks'; in 2008 refers to draftyear = 2008; played for U.S. National U18 Team refers to TEAM = 'U.S. National U18 Team';
SELECT COUNT(DISTINCT T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.overallby = 'Anaheim Ducks' AND T1.draftyear = 2008 AND T2.TEAM = 'U.S. National U18 Team'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
Which is the publisher for the game "Prism: Light the Way"?
publisher refers to publisher_name; game "Prism: Light the Way" refers to game_name = 'Prism: Light the Way'
SELECT T1.publisher_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 T3.game_name = 'Prism: Light the Way'
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
How many times has Sunrisers Hyderabad been the toss winner of a game?
Sunrisers Hyderabad refers to Team_Name = 'Sunrisers Hyderabad'; time of toss winner refers to count(Toss_Winner)
SELECT SUM(CASE WHEN Toss_Winner = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Sunrisers Hyderabad' ) THEN 1 ELSE 0 END) 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 ...
ice_hockey_draft
What is the height in centimeter of the tallest player born in Edmonton, Alberta, Canada?
height in centimeter refers to height_in_cm; tallest player refers to MAX(height_in_cm); born in Edmonton, Alberta, Canada refers to birthplace = 'Edmonton, AB, CAN';
SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.birthplace = 'Edmonton, AB, CAN' ORDER BY T2.height_in_cm DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
ice_hockey_draft
Among the players whose total NHL games played in their first 7 years of NHL career is no less than 500, what is the name of the player who committed the most rule violations?
total NHL games played in their first 7 years of NHL career is no less than 500 refers to sum_7yr_GP > 500; name of the player refers to PlayerName; committed the most rule violations refers to MAX(PIM);
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.sum_7yr_GP > 500 ORDER BY T2.PIM DESC LIMIT 1
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
What is the average number of games published by a publisher?
average number = divide(count(game_id), count(publisher_id))
SELECT CAST(COUNT(T.game_id) AS REAL) / COUNT(DISTINCT T.publisher_id) FROM game_publisher AS 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
For the game on 2008/5/12, who was the man of the match?
on 2008/5/12 refers to Match_Date = '2008-05-12'; name refers to Player_Name;
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match WHERE T2.Match_Date = '2008-05-12'
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 ...
ice_hockey_draft
How many right-shooted players have a height of 5'7''?
right-shooted players refers to shoots = 'R'; height of 5'7'' refers to height_in_inch = '5''7"';
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T2.height_in_inch = '5''7"' AND T1.shoots = 'R'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
video_games
How many games do not have any sales in Europe?
do not have any sales refers to num_sales = 0; in Europe refers to region_name = 'Europe'
SELECT COUNT(*) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Europe' AND T1.num_sales = 0
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
Give the date of birth of the 2014 Orange Cap winner.
date of birth refers to DOB; 2014 refers to Season_Year = 2014; Orange Cap winner refers to Orange_Cap IS NOT NULL
SELECT T2.DOB FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2014 AND T1.Orange_Cap IS NOT NULL
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 ...
ice_hockey_draft
What is the weight in pounds of the heaviest player?
weight in pounds refers to weight_in_lbs; heaviest player refers to MAX(weight_in_lbs);
SELECT MAX(T2.weight_in_lbs) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
books
Among the books published by publisher ID 1929, how many of them have over 500 pages?
books have over 500 pages refers to num_pages > 500
SELECT COUNT(*) FROM book WHERE publisher_id = 1929 AND num_pages > 500
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
ice_hockey_draft
What is the average height in centimeters of all the players in the position of defense?
average = AVG(height_in_cm); players refers to PlayerName; position of defense refers to position_info = 'D' ;
SELECT CAST(SUM(T2.height_in_cm) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.position_info = 'D'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
ice_hockey_draft
What is the BMI of David Bornhammar?
BMI = DIVIDE(weight_in_kg, power(DIVIDE(height_in_cm, 100), 2));
SELECT CAST(T2.weight_in_kg AS REAL) / (CAST(T3.height_in_cm AS REAL) / 100 * (CAST(T3.height_in_cm AS REAL) / 100)) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T1.PlayerName = 'David Bornhammar'
CREATE TABLE PlayerInfo ( CSS_rank INTEGER, -- draftyear INTEGER, -- Example Values: `1999`, `2001`, `2002`, `2000`, `1998` | Value Statics: Total count 2171 - Distinct count 10 - Null count 0 GP_greater_than_0 TEXT, -- Example Values: `no`, `yes` | Value Statics: Total count 2171 - Distinct count 2 - Null coun...
books
How many books were published by publisher "Thomas Nelson"?
"Thomas Nelson" is the publisher_name
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
video_games
What is the least common game genre?
the least common game genre refers to min(count(genre_id)); genre refers to genre_name
SELECT T.game_name FROM ( SELECT T2.game_name, COUNT(T2.id) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id GROUP BY T2.game_name ORDER BY COUNT(T2.id) ASC 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`, `...