db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
ice_hockey_draft
Please list the names of all the players that are over 90 kg and are right-shooted.
names of the players refers to PlayerName; over 90 kg refers to weight_in_kg > 90; right-shooted refers to shoots = 'R';
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
How many cancelled flights are there?
cancelled flights refers to CANCELLED = 1;
SELECT COUNT(*) FROM Airlines WHERE CANCELLED = 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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
What is the genre of the game "Mario vs. Donkey Kong"?
genre refers to genre_name; game "Mario vs. Donkey Kong" refers to game_name = 'Mario vs. Donkey Kong'
SELECT T1.genre_name FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T2.game_name = 'Mario vs. Donkey Kong'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
Among all the players that are right-shooted, how many of them weigh over 90 kg?
right-shooted refers to shoots = 'R'; weigh over 90 kg refers to weight_in_kg > 90;
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
books
What is the name of the publisher of the book "The Illuminati"?
"The Illuminati" is the title of the book; name of publisher refers to publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
List the platforms that release the most games each year.
platform refers to platform_id; the most games refers to max(count(game_publisher_id))
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 GROUP BY T2.release_year, T1.platform_name ORDER BY COUNT(DISTINCT T3.game_id) DESC
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
How much taller is David Bornhammar than Pauli Levokari in centimeters?
how much taller = SUBTRACT(SUM(height_in_cm WHERE PlayerName = 'David Bornhammar'), SUM(height_in_cm WHERE PlayerName = 'Pauli Levokari')); height in centimeters refers to height_in_cm;
SELECT ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'David Bornhammar' ) - ( SELECT T2.height_in_cm FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.PlayerName = 'Pauli Levokari' )
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
List all the platform games.
platform game refers to genre_name = 'Platform'; game refers to game_name
SELECT T2.game_name FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T1.genre_name = 'Platform'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Which country does Ranchi city belong to?
country refers to Country_Name; Ranchi city refers to City_Name = 'Ranchi'
SELECT T2.Country_Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id WHERE T1.City_Name = 'Ranchi'
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
What is the weight of the player with the longest time on ice in the player’s first 7 years of NHL career in kilograms?
weight in kilograms refers to weight_in_kg; longest time on ice in the player's first 7 years of NHL career refers to MAX(sum_7yr_TOI);
SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.sum_7yr_TOI = ( SELECT MAX(t.sum_7yr_TOI) FROM PlayerInfo t )
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
What are the games that were released in 2006?
game refers to game_name; released in 2006 refers to release_year = 2006
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 = 2006
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
Among the players that weigh more than 90 kg, what is the name of the player that has the most attendance in the player's first 7 years of NHL career?
weigh more than 90 kg refers to weight_in_kg > 90; name of the player refers to PlayerName; most attendance in the player's first 7 years of NHL career refers to MAX(sum_7yr_GP);
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.sum_7yr_GP = ( SELECT MAX(T1.sum_7yr_GP) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 )
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
books
Please give the title of the oldest book published by publisher "Thomas Nelson".
"Thomas Nelson" is the publisher_name; oldest book refers to Min(publication_date)
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' ORDER BY T1.publication_date ASC 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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Which game has the most sales in Japan?
which game refers to game_name; most sales refers to MAX(num_sales); Japan refers to region_name = 'Japan';
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' ORDER BY T2.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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Who was the man of the series in 2013? Give the full name.
full name refers to Player_Name; in 2013 refers to Season_Year = 2013
SELECT T2.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2013
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
Among the players that weigh more than 90 kg, how many of them have a position of defense?
weigh more than 90 kg refers to weight_in_kg > 90; position of defense refers to position_info = 'D' ;
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND 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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
Provide the origin of the flight that has the shortest actual elapsed time.
shortest actual elapsed time refers to MIN(ACTUAL_ELAPSED_TIME);
SELECT ORIGIN FROM Airlines ORDER BY ACTUAL_ELAPSED_TIME ASC 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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Which publisher published the most games?
publisher refers to publisher_name; the most games refers to max(count(game_id))
SELECT T.publisher_name FROM ( SELECT T1.publisher_name, COUNT(DISTINCT T2.game_id) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id GROUP BY T1.publisher_name ORDER BY COUNT(DISTINCT T2.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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
What is the batting hand of MK Pandey?
MK Pandey refers to Player_Name = 'MK Pandey'
SELECT T2.Batting_hand FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T1.Player_Name = 'MK Pandey'
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
How many players weigh more than 90 kg?
weigh more than 90 kg refers to weight_in_kg > 90;
SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
books
What is the name of the publisher that has published the most number of books?
name of publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T1.book_id) 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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
soccer_2016
What is the nationality of the 7th season Purple Cap winner?
nationality refers to Country_Name; the 7th season refers to Season_Id = 7; Purple Cap winner refers to Purple_Cap IS NOT NULL
SELECT 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_Id = 7 AND T1.Purple_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
How much does David Bornhammar weigh in kilograms?
weigh in kilograms refers to weight_in_kg;
SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
List the tail number of flights that flew on August 17, 2018.
tail number refers to TAIL_NUM; on August 17, 2018 refers to FL_DATE = '2018/8/17';
SELECT TAIL_NUM FROM Airlines WHERE FL_DATE = '2018/8/17' GROUP BY TAIL_NUM
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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
What are the years that "WiiU" got a new game?
year refers to release_year; "WiiU" refers to platform_name = 'WiiU'
SELECT T2.release_year FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id WHERE T1.platform_name = 'WiiU' ORDER BY T2.release_year 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
State the name of the city with the most venues.
name of the city refers to City_Name; the most venues refers to max(count(Venue_Id))
SELECT T1.City_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T1.City_Id = T2.City_Id GROUP BY T1.City_Id 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
What is the name of the tallest player?
tallest player refers to MAX(height_in_cm);
SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id 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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
books
What is the name of the publisher of the book with the most pages?
book with the most pages refers to Max(num_pages); name of publisher refers to publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Name the game released in 2011.
game refers to game_name; released in 2011 refers to release_year = 2011
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 = 2011
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
Among the players with a height of over 6'2" inches, how many of them were born in Sweden?
height of over 6'2" inches refers to height_in_inch > '6''2"'; born in Sweden refers to nation = 'Sweden' ;
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 > '6''2"' AND T1.nation = 'Sweden'
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
video_games
Provide the ID of the most popular platform in Europe.
ID refers to game_platform_id; the most popular refers to max(num_sales); in Europe refers to region_name = 'Europe'
SELECT T.game_platform_id FROM ( SELECT T1.game_platform_id, SUM(T1.num_sales) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Europe' GROUP BY T1.game_platform_id ORDER BY SUM(T1.num_sales) 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many times does M Chinnaswamy Stadium host games than Maharashtra Cricket Association Stadium?
M Chinnaswamy Stadium refers to Venue_Name = 'M Chinnaswamy Stadium'; Maharashtra Cricket Association Stadium refers to Venue_Name = 'Maharashtra Cricket Association Stadium'; how many times = divide(count(Match_Id where Venue_Name = 'M Chinnaswamy Stadium'), count(Match_Id where Venue_Name = 'Maharashtra Cricket Association Stadium'))
SELECT SUM(CASE WHEN T2.Venue_Name = 'M Chinnaswamy Stadium' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.Venue_Name = 'Maharashtra Cricket Association Stadium' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
ice_hockey_draft
Please list the names of all the players with a height of over 6'2" inches.
name of the players refers to PlayerName; height of over 6'2" inches refers to height_in_inch > '6''2"' ;
SELECT DISTINCT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T2.height_in_inch > '6''2"'
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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
airline
Please list any three airports with their codes.
null
SELECT Code, Description FROM Airports LIMIT 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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Which game has the longest name?
game refers to game_name; the longest name refers to max(length(game_name))
SELECT T.game_name FROM game AS T ORDER BY LENGTH(T.game_name) 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
ice_hockey_draft
What is the height of David Bornhammar in inches?
heigh in inches refers to height_in_inch;
SELECT T2.height_in_inch FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.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 count 0 sum_7yr_TOI INTEGER, -- overall INTEGER, -- position_info TEXT, -- ELITEID INTEGER primary key, sum_7yr_GP INTEGER, -- weight INTEGER, -- birthdate TEXT, -- birthday INTEGER, -- foreign key (height) references height_info(height_id), birthmonth INTEGER, -- Example Values: `6`, `7`, `3`, `5`, `10` | Value Statics: Total count 2171 - Distinct count 12 - Null count 0 foreign key (weight) references weight_info(weight_id), draftround INTEGER, -- Example Values: `7`, `3`, `5`, `4`, `1` | Value Statics: Total count 2171 - Distinct count 9 - Null count 0 overallby TEXT, -- birthplace TEXT, -- height INTEGER, -- Example Values: `73`, `76`, `72`, `75`, `70` | Value Statics: Total count 2171 - Distinct count 16 - Null count 0 birthyear DATE, -- nation TEXT, -- shoots TEXT, -- Example Values: `L`, `R`, `-` | Value Statics: Total count 2171 - Distinct count 3 - Null count 0 PlayerName TEXT, -- ); CREATE TABLE height_info ( height_in_cm INTEGER, -- Example Values: `165`, `170`, `172`, `174`, `177` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 height_id INTEGER primary key, height_in_inch TEXT, -- Example Values: `5'5"`, `5'7"`, `5'8"`, `5'9"`, `5'10"` | Value Statics: Total count 16 - Distinct count 16 - Null count 0 ); CREATE TABLE weight_info ( weight_id INTEGER primary key, weight_in_kg INTEGER, -- weight_in_lbs INTEGER, -- ); CREATE TABLE SeasonStatus ( A INTEGER, -- SEASON TEXT, -- Example Values: `1997-1998`, `1999-2000`, `1998-1999`, `2000-2001`, `2001-2002` | Value Statics: Total count 5485 - Distinct count 10 - Null count 0 G INTEGER, -- ELITEID INTEGER, -- PIM INTEGER, -- LEAGUE TEXT, -- TEAM TEXT, -- GAMETYPE TEXT, -- Example Values: `Regular Season`, `Playoffs` | Value Statics: Total count 5485 - Distinct count 2 - Null count 0 P INTEGER, -- GP INTEGER, -- foreign key (ELITEID) references PlayerInfo(ELITEID), PLUSMINUS INTEGER, -- );
books
Among the books published by publisher "Thomas Nelson", how many of them have over 300 pages?
"Thomas Nelson" is the publisher_name; books with over 300 pages refers to num_pages > 300
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' AND T1.num_pages > 300
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
soccer_2016
How many Indian cities are there in the database?
Indian refers to Country_Name = 'India'
SELECT SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How much is the discounted price of every item that customer 111511 ordered in order 53159? List the names of the parts of every item.
discounted price refers to multiply(l_extendedprice, subtract(1, l_discount)); customer 111511 refers to o_custkey = 111511; order 53159 refers to o_orderkey = 53159; name of the part refers to p_name
SELECT T2.l_extendedprice * (1 - T2.l_discount), T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 111511 AND T1.o_orderkey = 53159
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
airline
How many flights on the 1st of August 2018 were coming from Allentown, Pennsylvania?
1st of August 2018 refers to FL_DATE = '2018/8/1'; coming from Allentown, Pennsylvania refers to ORIGIN = 'ABE';
SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND ORIGIN = 'ABE'
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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
retails
What are the names of the parts that were ordered by customer 110942?
name of the part refers to p_name; customer 110942 refers to o_custkey = 110942
SELECT T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 110942
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
video_games
How many games were released in 2001?
released in 2001 refers to release_year = 2001
SELECT COUNT(T.id) FROM game_platform AS T WHERE T.release_year = 2001
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many players were born in the 90s?
born in the 90s refers to DOB > = '1990-01-01' AND DOB < = '1999-12-31'
SELECT COUNT(Player_Id) AS cnt FROM Player WHERE DOB BETWEEN '1990-01-01' AND '1999-12-31'
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
What is the total amount of tax charged for the order placed by customer 88931 on 7/13/994?
total amount of tax refers to sum(multiply(multiply(l_extendedprice, subtract(1, l_discount)), add(1, l_tax))); customer 88931 refers to o_custkey = 88931; on 7/13/1994 refers to o_orderdate = '1994-07-13'
SELECT SUM(T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax)) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = 88931 AND T1.o_orderdate = '1994-07-13'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
soccer_2016
In the database, how many times is the number of Indian cities to the South African cities?
Indian refers to Country_Name = 'India'; South African refers to Country_Name = 'South Africa'; how many times = divide(count(City_Id where Country_Name = 'India'), count(City_Id where Country_Name = 'South Africa'))
SELECT CAST(SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
What are the total quantities of the items ordered by customer 101660 on 10/5/1995?
total quantity refers to sum(l_quantity); customer 101660 refers to o_custkey = 101660; on 10/5/1995 refers to o_orderdate = '1995-10-05'
SELECT SUM(T2.l_quantity) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1995-10-05' AND T1.o_custkey = 101660
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
Please list the titles of all the books in British English.
"British English" is the language_name of the book
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'British English'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Calculate how many percent of sales in North America is higher than the average sale per region for platform ID 9577.
in North America refers to region_name = 'North America'; platform ID 9577 refers to game_platform_id = 9577; percent = divide(subtract(num_sales where region_name = 'North America' and game_platform_id = 9577, avg(num_sales)), avg(num_sales)) * 100%
SELECT (SUM(CASE WHEN T2.region_name = 'North America' THEN T1.num_sales ELSE 0 END) - AVG(T1.num_sales)) * 100.0 / AVG(T1.num_sales) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id WHERE T1.game_platform_id = 9577
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many matches were played on May 2008?
in May 2008 refers to SUBSTR(Match_Date, 1, 4) = '2008' AND SUBSTR(Match_Date, 7, 1) = '5'
SELECT SUM(CASE WHEN SUBSTR(Match_Date, 7, 1) = '5' THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008'
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
Who is the clerk in charge of handling the item with the highest amount of extended price?
clerk refers to o_clerk; the highest amount of extended price refers to max(l_extendedprice)
SELECT T1.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T2.l_extendedprice DESC LIMIT 1
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
airline
Give the actual elapsed time of the flights with air carrier named Semo Aviation Inc.: SEM.
actual elapsed time refers to ACTUAL_ELAPSED_TIME; Semo Aviation Inc.: SEM. Refers to Description = 'Semo Aviation Inc.: SEM';
SELECT T2.ACTUAL_ELAPSED_TIME FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Semo Aviation Inc.: SEM'
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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Mention the genre of the 2Xtreme.
genre refers to genre_name; the 2Xtreme game refers to game_name = '2Xtreme'
SELECT T2.id FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2Xtreme'
CREATE TABLE 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
retails
What is the name of the country of the supplier with the highest debt?
name of the country refers to n_name; the highest debt refers to min(s_acctbal)
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey ORDER BY T1.s_suppkey DESC LIMIT 1
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
How many books are in English?
books in English refers to language_name = 'English'
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'English'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
retails
What are the names of the parts that have a part supply cost of at least 1,000?
name of the part refers to p_name; part supply cost of at least 1,000 refers to ps_supplycost > 1000
SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost > 1000
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
airline
Provide the date and tail number of flight with air carrier "Ross Aviation Inc.: GWE".
date of flight refers to FL_DATE; tail number of flight refers to TAIL_NUM; Ross Aviation Inc.: GWE refers to Description = 'Ross Aviation Inc.: GWE';
SELECT T1.FL_DATE, T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Ross Aviation Inc.: GWE'
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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
Provide the platform where the Panzer Tactics can be played.
platform refers to platform_name; the Panzer Tactics is a game name.
SELECT T4.platform_name 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 INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T1.game_name = 'Panzer Tactics'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
retails
What are the top 2 countries with the highest number of indebted suppliers?
country refers to c_name; highest number of indebted refers to max(sum(acctbal)) where s_acctbal < 0
SELECT T.n_name FROM ( SELECT T2.n_name, SUM(T1.s_acctbal) AS num FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 GROUP BY T1.s_nationkey ) AS T ORDER BY T.num LIMIT 2
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
video_games
Please list the names of the publishers of all the puzzle games.
name of publisher refers to publisher_name; puzzle refers to genre_name = 'Puzzle'
SELECT DISTINCT T3.publisher_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id INNER JOIN genre AS T4 ON T1.genre_id = T4.id WHERE T4.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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
List the id of the player who won the Orange Cap for 2 consecutive seasons.
id of the player who won the Orange Cap refers to Orange_Cap; for 2 consecutive seasons refers to count(Season_Year) > 1
SELECT Orange_Cap FROM Season GROUP BY Orange_Cap HAVING COUNT(Season_Year) > 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How much is the part supply cost for the medium metallic grey dodger linen?
part supply cost refers to ps_supplycost; medium metallic grey dodger linen refers to p_name = 'medium metallic grey dodger linen'
SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'medium metallic grey dodger linen'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
Please list the titles of all the books that Lucas Wyldbore has ordered.
null
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
soccer_2016
Who is the oldest player?
name of the player refers to Player_Name; the oldest refers to min(DOB)
SELECT Player_Name FROM Player ORDER BY DOB ASC LIMIT 1
CREATE TABLE 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
Which country has the least number of suppliers?
country refers to n_name; the least number of suppliers refers to min(count(s_name))
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) LIMIT 1
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
airline
List the air carrier description and code of the flight with the shortest arrival time.
shortest arrival time refers to MIN(ARR_TIME);
SELECT T1.Description, T1.Code FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ARR_TIME ASC 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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
How many games were sold on the DS platform on average in the 4 different regions?
on the DS platform refers to platform_name = 'DS'; number of games sold on average = divide(sum(multiply(num_sales, 100000)), 4) where platform_name = 'DS'
SELECT SUM(T1.num_sales) * 100000 / 4 FROM region_sales AS T1 INNER JOIN game_platform AS T2 ON T1.game_platform_id = T2.id INNER JOIN platform AS T3 ON T2.platform_id = T3.id WHERE T3.platform_name = 'DS'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
What is the name of the player with the highest number of outstanding player awards in a particular match?
name of the player refers to Player_Name; the highest number of outstanding player awards refers to max(count(Man_of_the_Match))
SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match GROUP BY T2.Man_of_the_Match ORDER BY COUNT(T2.Man_of_the_Match) 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How many customers in the building segments have orders with a total price of no less than 50,000?
building segment refers to c_mktsegment = 'BUILDING'; a total price of no less than 50,000 refers to o_totalprice > 50000
SELECT COUNT(T2.c_name) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'BUILDING' AND T1.o_totalprice > 50000
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
What is the cheapest order price of the book "The Little House"?
"The Little House" is the title of book; cheapest order price refers to Min(price)
SELECT MIN(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Little House'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
soccer_2016
How many matches did Team 10 play in 2012?
Team 10 refers to Team_1 = 10 OR Team_2 = 10; in 2012 refers to SUBSTR(Match_Date, 1, 4) = '2012'
SELECT SUM(CASE WHEN Team_1 = 10 OR Team_2 = 10 THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How much is the total price of all the orders shipped to customers in Argentina?
total price = sum(o_totalprice); Argentina refers to n_name = 'Argentina'
SELECT SUM(T3.o_totalprice) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'ARGENTINA'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
video_games
What is the total number of sales across all regions?
total number of sales = sum(num_sales)
SELECT SUM(T.num_sales) * 100000 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many umpires are from South Africa?
South Africa refers to Country_Name = 'South Africa'
SELECT SUM(CASE WHEN T1.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN Umpire AS T2 ON T1.Country_ID = T2.Umpire_Country
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
What is the name of the customer whose order was delivered the longest?
name of the customer refers to c_name; delivered the longest refers to max(subtract(l_receiptdate, l_commitdate))
SELECT T3.c_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN customer AS T3 ON T1.o_custkey = T3.c_custkey ORDER BY (JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate)) DESC LIMIT 1
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
What is the total price of all the books ordered by Lucas Wyldbore?
total price refers to Sum(price)
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Name the publisher of the Chronicles of the Sword game.
publisher refers to publisher_name; the Chronicles of the Sword game refers to game_name = 'Chronicles of the Sword'
SELECT T3.publisher_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id WHERE T1.game_name = 'Chronicles of the Sword'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
How many Orange Cap awards were won by CH Gayle?
CH Gayle refers to Player_Name = 'CH Gayle'
SELECT SUM(CASE WHEN T1.Player_Name = 'CH Gayle' THEN 1 ELSE 0 END) AS cnt FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Orange_Cap
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How many urgent orders did Clerk#000000001 handle in 1997?
urgent order refers to o_orderpriority = '1-URGENT'; Clerk#000000001 refers to o_clerk = 'Clerk#000000001'; 1997 refers to year(o_orderdate) = 1997
SELECT COUNT(o_orderkey) FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1997' AND o_clerk = 'Clerk#000000001' AND o_orderpriority = '1-URGENT'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
soccer_2016
How many matches were played in Season 7?
Season 7 refers to Season_Id = 7
SELECT COUNT(Match_Id) FROM `Match` WHERE Season_Id = 7
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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How many customers in the machinery segment are in debt?
machinery segment refers to c_mktsegment = 'MACHINERY'; in debt refers to c_acctbal < 0
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'MACHINERY'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
airline
Provide the air carrier description of all flights arriving at Miami.
arriving at Miami refers to DEST = 'MIA';
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'MIA'
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 - Null count 96205 SECURITY_DELAY INTEGER, -- ORIGIN_CITY_MARKET_ID INTEGER, -- OP_CARRIER_FL_NUM INTEGER, -- ORIGIN_AIRPORT_ID INTEGER, -- LATE_AIRCRAFT_DELAY INTEGER, -- DEP_DELAY INTEGER, -- ORIGIN_AIRPORT_SEQ_ID INTEGER, -- DEP_TIME INTEGER, -- FOREIGN KEY (OP_CARRIER_AIRLINE_ID) REFERENCES "Air Carriers"(Code), ARR_DELAY INTEGER, -- ACTUAL_ELAPSED_TIME INTEGER, -- NAS_DELAY INTEGER, -- FOREIGN KEY (DEST) REFERENCES Airports(Code), TAIL_NUM TEXT, -- DEST TEXT, -- DEST_CITY_MARKET_ID INTEGER, -- ARR_DELAY_NEW INTEGER, -- OP_CARRIER_AIRLINE_ID INTEGER, -- ARR_TIME INTEGER, -- FOREIGN KEY (ORIGIN) REFERENCES Airports(Code), DEST_AIRPORT_ID INTEGER, -- WEATHER_DELAY INTEGER, -- DEP_DELAY_NEW INTEGER, -- ORIGIN TEXT, -- FL_DATE TEXT, -- CARRIER_DELAY INTEGER, -- DEST_AIRPORT_SEQ_ID INTEGER, -- ); CREATE TABLE Airports ( Code TEXT primary key, Description TEXT, -- ); CREATE TABLE Air Carriers ( Code INTEGER primary key, Description TEXT, -- );
video_games
In which year was Panzer Tactics released on DS?
year refers to release_year; Panzer Tactics refers to game_name = 'Panzer Tactics'; on DS refers to platform_name = 'DS'
SELECT T4.release_year 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 T5.platform_name = 'DS'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
In which country do the majority of the players are from?
country refers to Country_Name; the majority of the players  refers to max(count(Country_Name))
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T1.Country_Id = T2.Country_Name GROUP BY T2.Country_Name ORDER BY COUNT(T2.Country_Name) 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
Among the items shipped in 1994 via truck, how many items were returned?
1994 refers to year(l_shipdate) = 1994; via truck refers to l_shipmode = 'TRUCK'; returned refers to l_returnflag = 'R'
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1994' AND l_returnflag = 'R' AND l_shipmode = 'TRUCK'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
video_games
State the name of the publisher with the most games.
name of publisher refers to publisher_name; the most games refers to max(game_id)
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
What is the name of the team that won the most number of matches in season 1?
name of the team refers to Team_Name; the most number of matches refers to max(count(Match_Winner)); season 1 refers to season_Id = 1
SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT Match_Winner FROM `Match` WHERE season_Id = 1 GROUP BY Match_Winner ORDER BY COUNT(Match_Winner) 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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
How many customers are in the furniture segment?
furniture segment refers to c_mktsegment = 'FURNITURE'
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'FURNITURE'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
Which city does the address id 547 belong to?
null
SELECT city FROM address WHERE address_id = 547
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
How many platforms are available for the game Pro Evolution Soccer 2016?
game Pro Evolution Soccer 2016 refers to game_name = 'Pro Evolution Soccer 2016'
SELECT COUNT(T2.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 INNER JOIN game AS T4 ON T3.game_id = T4.id WHERE T4.game_name = 'Pro Evolution Soccer 2016'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
retails
In 1997, how many orders were shipped via mail?
1997 refers to year(l_shipdate) = 1997; shipped via mail refers to l_shipmode = 'MAIL'
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL'
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
video_games
State the publisher name of the game "ModNation Racers".
game "ModNation Racers" refers to game_name = 'ModNation Racers'
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 = 'ModNation Racers'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
retails
Which market segment does the customer with the highest amount of debt belongs to?
market segment refers to c_mktsegment; the highest amount of debt refers to max(c_acctbal)
SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
Among the books ordered by Lucas Wyldbore, how many of them are over 300 pages?
books have over 300 pages refers to num_pages > 300
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore' AND T1.num_pages > 300
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Show the number of games which were released on X360 in 2010.
on X360 refers to platform_name = 'X360'; in 2010 refers to release_year = '2010'
SELECT COUNT(DISTINCT 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 = 'X360' 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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
retails
What is the discounted price of the part "burnished seashell gainsboro navajo chocolate" in order no.1?
part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1; discounted price refers to multiply(l_extendedprice, subtract(1, l_discount))
SELECT T1.l_extendedprice * (1 - T1.l_discount) FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' AND T1.l_orderkey = 1
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
soccer_2016
Which team has the highest number of losses of all time?
name of the team refers to Team_Name; the highest number of losses refers to max(add(count(Team_1 where Team_Id = Team_1 and Team_1 <> Match_Winner), count(Team_2 where Team_Id = Team_2 and Team_2 <> Match_Winner)))
SELECT T1.Team_Name FROM Team AS T1 INNER JOIN ( SELECT COUNT(Team_1) AS a, Team_1 FROM Match WHERE Team_1 <> Match_Winner GROUP BY Team_1 UNION SELECT COUNT(Team_2) AS a, Team_2 FROM Match WHERE Team_2 <> Match_Winner GROUP BY Team_2 ORDER BY a DESC LIMIT 1 ) AS T2 ON T1.Team_Id = T2.Team_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );
retails
What is the profit for part no.98768 in order no.1?
part no.98768 refers to l_partkey = 98768; order no.1 refers to l_orderkey = 1; profit = subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))
SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_orderkey = 1 AND T1.l_partkey = 98768
CREATE TABLE partsupp ( ps_supplycost REAL not null, -- foreign key (ps_suppkey) references supplier (s_suppkey) on update cascade on delete cascade, ps_comment TEXT null, -- ps_availqty INTEGER null, -- ps_suppkey INTEGER not null, -- ps_partkey INTEGER not null, -- primary key (ps_partkey, ps_suppkey), foreign key (ps_partkey) references part (p_partkey) on update cascade on delete cascade, ); CREATE TABLE supplier ( s_phone TEXT null, -- s_acctbal REAL null, -- s_comment TEXT null, -- s_address TEXT null, -- s_name TEXT null, -- s_nationkey INTEGER null, -- foreign key (s_nationkey) references nation (n_nationkey), s_suppkey INTEGER not null primary key, ); CREATE TABLE customer ( `c_acctbal` REAL DEFAULT NULL, -- PRIMARY KEY (`c_custkey`), `c_comment` TEXT DEFAULT NULL, -- FOREIGN KEY (`c_nationkey`) REFERENCES `nation` (`n_nationkey`) ON DELETE CASCADE ON UPDATE CASCADE, `c_address` TEXT DEFAULT NULL, -- `c_custkey` INTEGER NOT NULL, -- `c_mktsegment` TEXT DEFAULT NULL, -- Example Values: `BUILDING`, `MACHINERY`, `FURNITURE`, `AUTOMOBILE`, `HOUSEHOLD` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 `c_phone` TEXT DEFAULT NULL, -- `c_name` TEXT DEFAULT NULL, -- `c_nationkey` INTEGER DEFAULT NULL, -- ); CREATE TABLE region ( r_name TEXT null, -- Example Values: `AFRICA`, `AMERICA`, `ASIA`, `EUROPE`, `MIDDLE EAST` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_comment TEXT null, -- Example Values: `asymptotes sublate after the r`, `requests affix quickly final tithes. blithely even packages above the a`, `accounts cajole carefully according to the carefully exp`, `slyly even theodolites are carefully ironic pinto beans. platelets above the unusual accounts aff`, `furiously express accounts wake sly` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 r_regionkey INTEGER not null primary key, ); CREATE TABLE orders ( o_comment TEXT null, -- o_orderkey INTEGER not null primary key, o_custkey INTEGER not null, -- o_clerk TEXT null, -- o_orderstatus TEXT null, -- Example Values: `P`, `O`, `F` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 o_totalprice REAL null, -- foreign key (o_custkey) references customer (c_custkey) on update cascade on delete cascade, o_orderpriority TEXT null, -- Example Values: `4-NOT SPECIFIED`, `1-URGENT`, `5-LOW`, `3-MEDIUM`, `2-HIGH` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 o_orderdate DATE null, -- o_shippriority INTEGER null, -- Example Values: `0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE nation ( n_regionkey INTEGER null, -- Example Values: `0`, `1`, `3`, `2`, `4` | Value Statics: Total count 25 - Distinct count 5 - Null count 0 n_name TEXT null, -- n_comment TEXT null, -- n_nationkey INTEGER not null primary key, foreign key (n_regionkey) references region (r_regionkey) on update cascade on delete cascade, ); CREATE TABLE lineitem ( l_comment TEXT null, -- l_receiptdate DATE null, -- l_returnflag TEXT null, -- Example Values: `N`, `A`, `R` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0 l_quantity INTEGER not null, -- l_linestatus TEXT null, -- Example Values: `O`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 l_shipmode TEXT null, -- Example Values: `RAIL`, `TRUCK`, `SHIP`, `MAIL`, `AIR` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_shipdate DATE null, -- l_suppkey INTEGER not null, -- l_linenumber INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 l_discount REAL not null, -- Example Values: `0.1`, `0.09`, `0.02`, `0.08`, `0.07` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (l_orderkey) references orders (o_orderkey) on update cascade on delete cascade, l_shipinstruct TEXT null, -- Example Values: `NONE`, `TAKE BACK RETURN`, `COLLECT COD`, `DELIVER IN PERSON` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 l_partkey INTEGER not null, -- l_commitdate DATE null, -- foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, foreign key (l_partkey, l_suppkey) references partsupp (ps_partkey, ps_suppkey) on update cascade on delete cascade, l_extendedprice REAL not null, -- primary key (l_orderkey, l_linenumber), l_tax REAL not null, -- Example Values: `0.06`, `0.08`, `0.07`, `0.02`, `0.01` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 l_orderkey INTEGER not null, -- ); CREATE TABLE part ( p_type TEXT null, -- p_size INTEGER null, -- p_partkey INTEGER not null primary key, p_comment TEXT null, -- p_brand TEXT null, -- p_retailprice REAL null, -- p_mfgr TEXT null, -- Example Values: `Manufacturer#4`, `Manufacturer#5`, `Manufacturer#1`, `Manufacturer#3`, `Manufacturer#2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0 p_container TEXT null, -- p_name TEXT null, -- );
books
Among the books ordered by Lucas Wyldbore, what is the percentage of those books over $13?
books over $13 refers to price > 13; percentage = Divide (Sum (order_id where price > 13), Count (order_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
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_author ( author_id INTEGER, -- foreign key (book_id) references book(book_id), primary key (book_id, author_id), book_id INTEGER, -- foreign key (author_id) references author(author_id), ); CREATE TABLE address ( city TEXT, -- street_number TEXT, -- address_id INTEGER primary key, foreign key (country_id) references country(country_id), country_id INTEGER, -- street_name TEXT, -- ); CREATE TABLE cust_order ( shipping_method_id INTEGER references shipping_method, -- Example Values: `4`, `2`, `1`, `3` | Value Statics: Total count 7550 - Distinct count 4 - Null count 0 dest_address_id INTEGER references address, -- customer_id INTEGER references customer, -- order_date DATETIME, -- order_id INTEGER primary key autoincrement, ); CREATE TABLE author ( author_id INTEGER primary key, author_name TEXT, -- ); CREATE TABLE customer_address ( customer_id INTEGER, -- address_id INTEGER, -- status_id INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 3350 - Distinct count 2 - Null count 0 foreign key (address_id) references address(address_id), foreign key (customer_id) references customer(customer_id), primary key (customer_id, address_id), ); CREATE TABLE publisher ( publisher_name TEXT, -- publisher_id INTEGER primary key, ); CREATE TABLE order_status ( status_value TEXT, -- Example Values: `Order Received`, `Pending Delivery`, `Delivery In Progress`, `Delivered`, `Cancelled` | Value Statics: Total count 6 - Distinct count 6 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE book_language ( language_id INTEGER primary key, language_name TEXT, -- language_code TEXT, -- ); CREATE TABLE book ( title TEXT, -- num_pages INTEGER, -- publisher_id INTEGER, -- isbn13 TEXT, -- publication_date DATE, -- foreign key (publisher_id) references publisher(publisher_id), language_id INTEGER, -- book_id INTEGER primary key, foreign key (language_id) references book_language(language_id), foreign key (language_id) references book_language(language_id), ); CREATE TABLE address_status ( address_status TEXT, -- Example Values: `Active`, `Inactive` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 status_id INTEGER primary key, ); CREATE TABLE shipping_method ( method_name TEXT, -- Example Values: `Standard`, `Priority`, `Express`, `International` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 cost REAL, -- Example Values: `5.9`, `8.9`, `11.9`, `24.5` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 method_id INTEGER primary key, ); CREATE TABLE country ( country_id INTEGER primary key, country_name TEXT, -- ); CREATE TABLE order_history ( order_id INTEGER references cust_order, -- status_id INTEGER references order_status, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 22348 - Distinct count 6 - Null count 0 status_date DATETIME, -- history_id INTEGER primary key autoincrement, );
video_games
Tell the genre of the game "Resident Evil: Revelations".
genre refers to genre_name; game "Resident Evil: Revelations" refers to game_name = 'Resident Evil: Revelations'
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = 'Resident Evil: Revelations'
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`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0 num_sales REAL default NULL, -- game_platform_id INTEGER default NULL, -- ); CREATE TABLE genre ( id INTEGER not null primary key, genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE region ( id INTEGER not null primary key, region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE game ( foreign key (genre_id) references genre(id), game_name TEXT default NULL, -- id INTEGER not null primary key, genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0 ); CREATE TABLE publisher ( id INTEGER not null primary key, publisher_name TEXT default NULL, -- ); CREATE TABLE game_platform ( platform_id INTEGER default NULL, -- game_publisher_id INTEGER default NULL, -- foreign key (platform_id) references platform(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), foreign key (game_publisher_id) references game_publisher(id), id INTEGER not null primary key, release_year INTEGER default NULL, -- ); CREATE TABLE game_publisher ( publisher_id INTEGER default NULL, -- game_id INTEGER default NULL, -- id INTEGER not null primary key, foreign key (game_id) references game(id), foreign key (publisher_id) references publisher(id), ); CREATE TABLE platform ( id INTEGER not null primary key, platform_name TEXT default NULL, -- );
soccer_2016
Which season played the highest number of matches at M Chinnaswamy Stadium?
season refers to Season_Id; the highest number of matches refers to max(count(Season_Id)); M Chinnaswamy Stadium refers to Venue_Name = 'M Chinnaswamy Stadium'
SELECT T1.Season_Id FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'M Chinnaswamy Stadium' GROUP BY T1.Season_Id ORDER BY COUNT(T1.Season_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 - Distinct count 9 - Null count 0 Player_Out INTEGER, -- foreign key (Player_Out) references Player(Player_Id), Over_Id INTEGER, -- primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Fielders INTEGER, -- foreign key (Match_Id) references Match(Match_Id), Ball_Id INTEGER, -- Example Values: `1`, `2`, `5`, `8`, `6` | Value Statics: Total count 6727 - Distinct count 9 - Null count 0 foreign key (Kind_Out) references Out_Type(Out_Id), foreign key (Fielders) references Player(Player_Id), Innings_No INTEGER, -- Example Values: `2`, `1`, `3`, `4` | Value Statics: Total count 6727 - Distinct count 4 - Null count 0 Match_Id INTEGER, -- ); CREATE TABLE Toss_Decision ( Toss_Id INTEGER primary key, Toss_Name TEXT, -- Example Values: `field`, `bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Player_Match ( foreign key (Role_Id) references Rolee(Role_Id), Player_Id INTEGER, -- foreign key (Team_Id) references Team(Team_Id), foreign key (Match_Id) references Match(Match_Id), Role_Id INTEGER, -- Example Values: `1`, `3`, `2`, `4` | Value Statics: Total count 12694 - Distinct count 4 - Null count 0 Team_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 12694 - Distinct count 13 - Null count 0 Match_Id INTEGER, -- foreign key (Player_Id) references Player(Player_Id), primary key (Match_Id, Player_Id, Role_Id), ); CREATE TABLE Season ( Orange_Cap INTEGER, -- Example Values: `100`, `18`, `133`, `162`, `19` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Man_of_the_Series INTEGER, -- Example Values: `32`, `53`, `133`, `162`, `315` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 Season_Id INTEGER primary key, Season_Year INTEGER, -- Example Values: `2008`, `2009`, `2010`, `2011`, `2012` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 Purple_Cap INTEGER, -- Example Values: `102`, `61`, `131`, `194`, `190` | Value Statics: Total count 9 - Distinct count 8 - Null count 0 ); CREATE TABLE Batting_Style ( Batting_Id INTEGER primary key, Batting_hand TEXT, -- Example Values: `Left-hand bat`, `Right-hand bat` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ); CREATE TABLE Ball_by_Ball ( Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Bowler INTEGER, -- Match_Id INTEGER, -- Striker INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Non_Striker INTEGER, -- Team_Bowling INTEGER, -- Example Values: `2`, `1`, `4`, `3`, `6` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Striker_Batting_Position INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 Team_Batting INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 11 - Null count 0 foreign key (Match_Id) references Match(Match_Id), Over_Id INTEGER, -- ); CREATE TABLE Rolee ( Role_Desc TEXT, -- Example Values: `Captain`, `Keeper`, `Player`, `CaptainKeeper` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 Role_Id INTEGER primary key, ); CREATE TABLE Umpire ( Umpire_Name TEXT, -- Umpire_Country INTEGER, -- Example Values: `6`, `10`, `4`, `2`, `5` | Value Statics: Total count 52 - Distinct count 9 - Null count 0 Umpire_Id INTEGER primary key, foreign key (Umpire_Country) references Country(Country_Id), foreign key (Umpire_Country) references Country(Country_Id), ); CREATE TABLE Country ( Country_Id INTEGER primary key, foreign key (Country_Id) references Country(Country_Id), Country_Name TEXT, -- Example Values: `India`, `South Africa`, `U.A.E`, `New Zealand`, `Australia` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 ); CREATE TABLE Batsman_Scored ( Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 9 - Null count 0 Match_Id INTEGER, -- Runs_Scored INTEGER, -- Example Values: `0`, `1`, `4`, `6`, `2` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0 foreign key (Match_Id) references Match(Match_Id), primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Over_Id INTEGER, -- Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0 ); CREATE TABLE Team ( Team_Id INTEGER primary key, Team_Name TEXT, -- Example Values: `Kolkata Knight Riders`, `Royal Challengers Bangalore`, `Chennai Super Kings`, `Kings XI Punjab`, `Rajasthan Royals` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 ); CREATE TABLE City ( Country_id INTEGER, -- Example Values: `1`, `2`, `3` | Value Statics: Total count 29 - Distinct count 3 - Null count 0 City_Name TEXT, -- City_Id INTEGER primary key, ); CREATE TABLE Outcome ( Outcome_Type TEXT, -- Example Values: `Result`, `No Result`, `Superover` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 Outcome_Id INTEGER primary key, ); CREATE TABLE Player ( Player_Id INTEGER primary key, Player_Name TEXT, -- foreign key (Country_Name) references Country(Country_Id), foreign key (Bowling_skill) references Bowling_Style(Bowling_Id), Batting_hand INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 469 - Distinct count 2 - Null count 0 Country_Name INTEGER, -- Example Values: `1`, `4`, `5`, `6`, `2` | Value Statics: Total count 469 - Distinct count 11 - Null count 0 Bowling_skill INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 426 - Distinct count 14 - Null count 43 foreign key (Batting_hand) references Batting_Style(Batting_Id), DOB DATE, -- ); CREATE TABLE Venue ( Venue_Name TEXT, -- Venue_Id INTEGER primary key, foreign key (City_Id) references City(City_Id), City_Id INTEGER, -- ); CREATE TABLE Extra_Type ( Extra_Name TEXT, -- Example Values: `legbyes`, `wides`, `byes`, `noballs`, `penalty` | Value Statics: Total count 5 - Distinct count 5 - Null count 0 Extra_Id INTEGER primary key, ); CREATE TABLE Out_Type ( Out_Id INTEGER primary key, Out_Name TEXT, -- Example Values: `caught`, `bowled`, `run out`, `lbw`, `retired hurt` | Value Statics: Total count 9 - Distinct count 9 - Null count 0 ); CREATE TABLE Match ( Win_Margin INTEGER, -- foreign key (Toss_Winner) references Team(Team_Id), foreign key (Win_Type) references Win_By(Win_Id), foreign key (Team_2) references Team(Team_Id), foreign key (Toss_Decide) references Toss_Decision(Toss_Id), foreign key (Team_1) references Team(Team_Id), Venue_Id INTEGER, -- foreign key (Venue_Id) references Venue(Venue_Id), Match_Id INTEGER primary key, Match_Winner INTEGER, -- Example Values: `1`, `3`, `6`, `2`, `5` | Value Statics: Total count 574 - Distinct count 13 - Null count 3 Team_1 INTEGER, -- Example Values: `2`, `4`, `6`, `7`, `1` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 Match_Date DATE, -- Toss_Decide INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 577 - Distinct count 2 - Null count 0 foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Outcome_type) references Out_Type(Out_Id), foreign key (Man_of_the_Match) references Player(Player_Id), foreign key (Man_of_the_Match) references Player(Player_Id), Season_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 577 - Distinct count 9 - Null count 0 Outcome_type INTEGER, -- Example Values: `1`, `3`, `2` | Value Statics: Total count 577 - Distinct count 3 - Null count 0 Team_2 INTEGER, -- Example Values: `1`, `3`, `5`, `2`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Match_Winner) references Team(Team_Id), foreign key (Match_Winner) references Team(Team_Id), Win_Type INTEGER, -- Example Values: `1`, `2`, `4`, `3` | Value Statics: Total count 577 - Distinct count 4 - Null count 0 Man_of_the_Match INTEGER, -- Toss_Winner INTEGER, -- Example Values: `2`, `3`, `5`, `7`, `8` | Value Statics: Total count 577 - Distinct count 13 - Null count 0 foreign key (Season_Id) references Season(Season_Id), ); CREATE TABLE Extra_Runs ( Extra_Runs INTEGER, -- Example Values: `1`, `4`, `5`, `2`, `3` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 Match_Id INTEGER, -- Ball_Id INTEGER, -- Example Values: `1`, `2`, `3`, `7`, `5` | Value Statics: Total count 7469 - Distinct count 9 - Null count 0 primary key (Match_Id, Over_Id, Ball_Id, Innings_No), Extra_Type_Id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 7469 - Distinct count 5 - Null count 0 foreign key (Extra_Type_Id) references Extra_Type(Extra_Id), Innings_No INTEGER, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 7469 - Distinct count 4 - Null count 0 Over_Id INTEGER, -- ); CREATE TABLE Bowling_Style ( Bowling_skill TEXT, -- Example Values: `Right-arm medium`, `Right-arm offbreak`, `Right-arm fast-medium`, `Legbreak googly`, `Right-arm medium-fast` | Value Statics: Total count 14 - Distinct count 14 - Null count 0 Bowling_Id INTEGER primary key, );