db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
retails
How much higher in percentage is the highest supply cost of the part "hot spring dodger dim light" than the lowest supply cost?
part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; percentage = divide(subtract(max(ps_supplycost), min(ps_supplycost)), min(ps_supplycost)) * 100%
SELECT CAST((MAX(T1.ps_supplycost) - MIN(T1.ps_supplycost)) AS REAL) * 100 / MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light'
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
List the title of the earliest published Japanese book.
Japanese book refers to language_name = 'Japanese'; earliest published refers to Min(publication_date)
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Japanese' 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
How many games in the database belong to the genre of sports?
the genre of sports refers to genre_name = 'Sports'
SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Sports'
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 average supply cost for the part "hot spring dodger dim light"?
average supply cost refers to avg(ps_supplycost); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT AVG(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light'
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
Tell the number of games whose publisher id is 352.
number of games refers to count(game_id)
SELECT DISTINCT T.game_id FROM game_publisher AS T WHERE T.publisher_id = 352
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 venue did Kolkata Knight Riders play most of their matches as a Team 1?
venue refers to Venue_Name; Kolkata Knight Riders refers to Team_Name = 'Kolkata Knight Riders'; most of their matches refers to max(count(Venue_Id)); Team 1 refers to Team_Id = Team_1
SELECT T3.Venue_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 INNER JOIN Venue AS T3 ON T2.Venue_Id = T3.Venue_Id WHERE T1.Team_Name = 'Kolkata Knight Riders' GROUP BY T3.Venue_Id ORDER BY COUNT(T3.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, );
retails
Please list all the modes of shipping for the part "burnished seashell gainsboro navajo chocolate".
mode of shipping refers to l_shipmode; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'
SELECT DISTINCT T1.l_shipmode 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'
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 much money on average does Lucas Wyldbore spend on book orders?
average spend on book orders = AVG (price)
SELECT SUM(T1.price) / 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, );
retails
What is the biggest discount among all orders for the part "burnished seashell gainsboro navajo chocolate"?
the biggest discount refers to max(l_discount); part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'
SELECT MAX(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'
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 orders has Cordy Dumbarton made?
null
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Cordy' AND T1.last_name = 'Dumbarton'
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 of the publisher of the game id 10031.
name of publisher refers to publisher_name; the game id 10031 refers to game_id = '10031'
SELECT T2.publisher_name FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id WHERE T1.game_id = 10031
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 part is ordered in a bigger amount in order no.1, "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy"?
amount refers to sum(l_quantity); order no.1 refers to l_orderkey = 1; "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy" refers to p_name IN ('salmon white grey tan navy', 'burnished seashell gainsboro navajo chocolate')
SELECT T.p_name FROM ( SELECT T2.p_name, SUM(T1.l_quantity) AS num FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name IN ('salmon white grey tan navy', 'burnished seashell gainsboro navajo chocolate') GROUP BY T1.l_partkey ) AS T ORDER BY T.num 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 were published by Kensington?
"Kensington" is the publisher_name;
SELECT COUNT(T1.book_id) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Kensington'
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
When did Chennai Super Kings play its first match?
match date refers to Match_Date; Chennai Super Kings refers to Team_Name = 'Chennai Super Kings'; first match refers to min(Match_Date)
SELECT Match_Date FROM `Match` WHERE team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) OR Team_2 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) ORDER BY Match_Date 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
What is the quantity of the part "burnished seashell gainsboro navajo chocolate" ordered in order no.1?
quantity refers to l_quantity; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1
SELECT T1.l_quantity FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate'
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 of air carrier called JetBlue Airways: B6 have 0 new arrival delay?
JetBlue Airways refers to Description = '%JetBlue Airway%'; 0 new arrival delay refers to ARR_DELAY_NEW = 0;
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%JetBlue Airways: B6%' AND T2.ARR_DELAY_NEW = 0
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
Show the id of game platform which makes the most sales in Japan.
id of game platform refers to game_platform_id; the most sales refers to max(num_sales); in Japan refers to region_name = 'Japan'
SELECT T.game_platform_id FROM ( SELECT T2.game_platform_id, MAX(T2.num_sales) FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'Japan' ) 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, -- );
retails
On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped?
date refers to l_shipdate; part "burnished seashell gainsboro navajo chocolate" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1
SELECT T1.l_shipdate FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate'
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 customer has made the most orders? Show his/her full name.
most order refers to Max(Count(order_id)); customer refers to first_name, last_name
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) 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, );
retails
Among the parts that are returned, how many of them are provided by a supplier in debt?
returned refers to l_returnflag = 'R'; in debt refers to s_acctbal < 0
SELECT COUNT(T1.l_partkey) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_returnflag = 'R' AND T2.s_acctbal < 0
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
Give the number of games which were published by Ascaron Entertainment GmbH.
published by Ascaron Entertainment GmbH refers to publisher_name = 'Ascaron Entertainment GmbH'
SELECT COUNT(T2.game_id) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id WHERE T1.publisher_name = 'Ascaron Entertainment GmbH'
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
Among the suppliers for the parts ordered in order no.4, how many of them are in debt?
order no.4 refers to l_orderkey = 4; in debt refers to s_acctbal < 0
SELECT COUNT(T1.l_linenumber) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_orderkey = 4 AND T2.s_acctbal < 0
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 more sports games than simulation games?
sports game refers to genre_name = 'Sports'; simulation game refers to genre_name = 'Simulation'; how many more = subtract(sum(game_id where genre_name = 'Sports'), sum(game_id where genre_name = 'Simulation'))
SELECT COUNT(CASE WHEN T1.genre_name = 'Sports' THEN T2.id ELSE NULL END) - COUNT(CASE WHEN T1.genre_name = 'Simulation' THEN T2.id ELSE NULL END) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id
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
Please list the phone numbers of all the suppliers for the parts ordered in order no.1.
phone number refers to s_phone; order no.1 refers to l_orderkey = 1
SELECT T2.s_phone FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE 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, -- );
books
For the publisher which published the most books, show its name.
published the most books refers to Max(Count(book_id)); 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 GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_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, );
video_games
For all the games which were published by Namco Bandai Games, what percentage of them were adventure games?
published by Namco Bandai Games refers to publisher_name = 'Namco Bandai Games'; adventure game refers to genre_name = 'Adventure'; percentage = divide(sum(game_id where genre_name = 'Adventure'), count(game_id)) * 100% where publisher_name = 'Namco Bandai Games'
SELECT CAST(COUNT(CASE WHEN T4.genre_name = 'Adventure' THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) 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 T3.publisher_name = 'Namco Bandai Games'
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
Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in Europe?
part "hot spring dodger dim light" refers to p_name = hot spring dodger dim light; Europe refers to r_name = 'EUROPE'
SELECT COUNT(T1.r_regionkey) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T1.r_name = 'EUROPE'
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 did David Foster Wallace write?
"David Foster Wallace" is the author_name;
SELECT COUNT(T1.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace'
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 percentage of all right-handed batting players among all the other players?
right-handed batting refers to Batting_hand = 'Right-hand bat'; percentage = divide(count(Player_Id where Batting_hand = 'Right-hand bat'), count(Player_Id)) * 100%
SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Player_Id) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T2.Batting_hand = T1.Batting_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
Among all the suppliers in debt, how many of them are in Europe?
in debt refers to s_acctbal < 0; Europe refers to r_name = 'EUROPE'
SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' AND T3.s_acctbal < 0
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 times more is the number of games which were published by Atari than Athena?
published by Atari refers to publisher_name = 'Atari'; published by  Athena refers to publisher_name = 'Athena'; times = divide(sum(publisher_id where publisher_name = 'Atari'), sum(publisher_id where publisher_name = 'Athena'))
SELECT CAST(COUNT(CASE WHEN T1.publisher_name = 'Atari' THEN T2.game_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN T1.publisher_name = 'Athena' THEN T2.game_id ELSE NULL END) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id
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 is the player who won the first ever "man of the match" award?
name of the player refers to Player_Name; the first ever refers to min(match_date); "man of the match" award refers to Player_Id in 'Man_of_the_Match'
SELECT Player_Name FROM Player WHERE Player_Id = ( SELECT Man_of_the_Match FROM `Match` ORDER BY match_date 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
Please list the order keys of all the orders that have more than 2 parts with a jumbo case container.
order key refers to l_orderkey; jumbo case container refers to p_container = 'JUMBO CASE'; more than 2 parts refers to count(l_partkey) > 2
SELECT T.l_orderkey FROM ( SELECT T2.l_orderkey, COUNT(T2.l_partkey) AS num FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_container = 'JUMBO CASE' GROUP BY T2.l_orderkey ) AS T WHERE T.num > 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, -- );
books
Which language was book id 1405 written in?
language written in refers to language_name;
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.book_id = 1405
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 sales does game platform id 3871 make in Europe?
number of sales = multiply(num_sales, 100000); in Europe refers to region_name = 'Europe'
SELECT T2.num_sales * 100000 FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'Europe' AND T2.game_platform_id = 3871
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 is the player that has the highest number of roles as a captain for Deccan Chargers?
name of the player refers to Player_Name; the highest number of roles refers to max(count(Role_Id)); as a captain refers to Role_Desc = 'Captain'; Deccan Chargers refers to Team_Name = 'Deccan Chargers'
SELECT T4.Player_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_id = T2.Team_id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Player AS T4 ON T2.Player_Id = T4.Player_Id WHERE T1.Team_Name = 'Deccan Chargers' AND T1.Team_Id = 8 AND T3.Role_Desc = 'Captain' AND T3.Role_Id = 1 GROUP BY T4.Player_Id ORDER BY COUNT(T3.Role_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, );
retails
What is the total quantity of the part "hot spring dodger dim light" ordered in all orders?
total quantity refers to sum(l_quantity); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT SUM(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'
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
Name the book title of the bestseller.
book title refers to title; best sellers refers to title where Max(count(order_id))
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id GROUP BY T1.title ORDER BY COUNT(T1.title) 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
List the first team's name in the match with the highest winning margin.
team's name refers to Team_Name; first team refers to Team_Id = Team_1; the highest winning margin refers to max(Win_Margin)
SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 ORDER BY T1.Win_Margin 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
The part "hot spring dodger dim light" is ordered in how many orders?
part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'
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 genre of the Advent Rising game?
genre refers to genre_name; Advent Rising game refers to game_name = 'Advent Rising'
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = 'Advent Rising'
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
Among all the parts under the type "promo brushed steel", how many of them have a total available quantity from all suppliers of under 5000?
type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000
SELECT SUM(num) FROM ( SELECT COUNT(T3.s_name) AS num FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_type = 'PROMO BRUSHED STEEL' GROUP BY T2.ps_partkey HAVING SUM(T2.ps_availqty) < 5000 ) T
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 country does Malina Johnson live in?
country refers to country_name
SELECT T4.country_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.first_name = 'Malina' AND T1.last_name = 'Johnson' AND T2.status_id = 2
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 role-playing games did Microsoft Game Studios publish?
role-playing game refers to genre_name = 'Role-Playing'; Microsoft Game Studios refers to publisher_name = 'Microsoft Game Studios'
SELECT COUNT(T3.id) 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 INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T4.genre_name = 'Role-Playing' AND T1.publisher_name = 'Microsoft Game Studios'
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 with left-hand batting style are from India?
left-hand batting style refers to Batting_hand = 'Left-hand bat'; India refers to Country_Name = 'India'
SELECT SUM(CASE WHEN T1.Batting_hand = 'Left-hand bat' THEN 1 ELSE 0 END) AS cnt FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_Id = T2.Batting_hand INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'India'
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
Please list the names of all the suppliers for parts under Brand#55.
supplier name refers to s_name; Brand#55 refers to p_brand = 'Brand#55'
SELECT T3.s_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_brand = 'Brand#55'
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
Which genre has the most games? Show its id.
the most games refers to max(game_id); genre id refers to genre_id
SELECT genre_id FROM ( SELECT T.genre_id, COUNT(T.id) FROM game AS T GROUP BY T.genre_id ORDER BY COUNT(T.id) 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, -- );
retails
Among the suppliers providing parts under the type "promo brushed steel", how many of them are in debt?
type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; in debt refers to s_acctbal < 0
SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T3.s_acctbal < 0 AND T1.p_type = 'PROMO BRUSHED STEEL'
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 code of the airport described as Driftwood Bay, AK: Driftwood Bay Airport.
Driftwood Bay, AK: Driftwood Bay Airport refers to Description = 'Driftwood Bay, AK: Driftwood Bay Airport';
SELECT Code FROM Airports WHERE Description = 'Driftwood Bay, AK: Driftwood Bay Airport'
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(publisher_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
How many matches were played by the player with player ID 2?
player ID 2 refers to Player_Id = 2
SELECT SUM(CASE WHEN Player_Id = 2 THEN 1 ELSE 0 END) FROM Player_Match
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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 suppliers for the part "hot spring dodger dim light" are in Vietnam?
part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; Vietnam refers to n_name = 'VIETNAM'
SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey INNER JOIN nation AS T4 ON T3.s_nationkey = T4.n_nationkey WHERE T1.p_name = 'hot spring dodger dim light' AND T4.n_name = 'VIETNAM'
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
Calculate the percentage of the International shipping orders on 2022/11/10.
International shipping order refers to method_name = 'International'; orders on 2022/11/10 refers to order_date LIKE '2022-11-10%'; percentage = Divide (Sum(order_id  where method_name = 'International'), Count(order_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipping_method AS T1 INNER JOIN cust_order AS T2 ON T1.method_id = T2.shipping_method_id WHERE T2.order_date LIKE '2022-11-10%'
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
List the player's name of Mumbai Indians in the match ID 335990.
Mumbai Indians refers to Team_Name = 'Mumbai Indians'; match ID 335990 refers to Match_Id = 335990
SELECT T3.Team_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T2.Match_Id = 335990 AND T3.Team_Name = 'Mumbai Indians' GROUP BY T3.Team_Name
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
Please list the names of all the suppliers for the part with the highest retail price.
supplier name refers to s_name; the highest retail price refers to max(p_retailprice)
SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T1.p_size 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 orders does the book "O Xará" have?
"O Xará" is the title of the book
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'O Xará'
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 publishers have published more than 3 puzzle games?
puzzle refers to genre_name = 'Puzzle'; more than 3 puzzle games refers to count(game_id where genre_name = 'Puzzle') > 3
SELECT COUNT(T.publisher_name) FROM ( SELECT T3.publisher_name, COUNT(DISTINCT T1.id) 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' GROUP BY T3.publisher_name HAVING COUNT(DISTINCT T1.id) > 3 ) 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
Name the player who is born on July 7, 1981.
name of the player refers to Player_Name; born on July 7 1981 refers to DOB = '1981-07-07'
SELECT Player_name FROM Player WHERE DOB = '1981-07-07'
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 supplier can provide the most number of "hot spring dodger dim light"? Please give the supplier's phone number.
the most number refers to max(ps_availqty); "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; phone number refers to s_phone
SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T2.ps_availqty 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
Which country does Žirovnica city belong to?
"Žirovnica" is the city; country refers to country_name
SELECT T1.country_name FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Žirovnica'
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 name of the earliest platform in the database.
the earliest refers to min(release_year); name of platform refers to platform_name
SELECT T2.platform_name FROM game_platform AS T1 INNER JOIN platform AS T2 ON T1.platform_id = T2.id ORDER BY T1.release_year ASC LIMIT 1
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `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 total quantity available by all suppliers for the part "hot spring dodger dim light"?
total quantity available refers to sum(ps_availqty); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT SUM(T1.ps_availqty) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light'
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 cost of the slowest and least expensive shipping method?
slowest and least expesive method refers to shipping_method = 'Standard'
SELECT method_name FROM shipping_method ORDER BY cost 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
How many games were released on PS4 in 2014?
on PS4 refers to platform_name = 'PS4'; in 2014 refers to release_year = 2014
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 = 'PS4' AND T2.release_year = 2014
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `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 cities located in U.A.E.
city refers to City_Name; U.A.E refers to Country_Name = 'U.A.E'
SELECT T1.City_Name FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id WHERE T2.Country_Name = 'U.A.E'
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 supplier that provides the part "hot spring dodger dim light" with the lowest supply cost?
supplier name refers to s_name; part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'; the lowest supply cost refers to min(ps_supplycost)
SELECT T2.s_name FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light' ORDER BY T1.ps_supplycost 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
Give the number of Ukrainian addresses in the database.
Ukrainian address refers to country_name = 'Ukraine'
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'Ukraine'
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 games did Electronic Arts publish?
Electronic Arts refers to publisher_name = 'Electronic Arts'
SELECT COUNT(DISTINCT T2.game_id) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id WHERE T1.publisher_name = 'Electronic Arts'
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
Give the country where St. George's Park is located.
country refers to Country_Name; St. George's Park refers to Venue_Name = 'St George''s Park'
SELECT T3.Country_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Country AS T3 ON T3.Country_Id = T2.Country_id WHERE T1.Venue_Name = 'St George''s Park'
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 lowest supply cost for the part "hot spring dodger dim light"?
the lowest supply cost refers to min(ps_supplycost); part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light'
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 of the matches are Superover?
Superover refers to Outcome_Type = 'Superover'
SELECT SUM(CASE WHEN T2.Outcome_Type = 'Superover' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Outcome AS T2 ON T2.Outcome_Id = T1.Outcome_type
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
Please list the names of all the suppliers for the part "hot spring dodger dim light".
supplier name refers to s_name; part "hot spring dodger dim light" refers to p_name = 'hot spring dodger dim light'
SELECT T2.s_name FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light'
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 average number of pages of David Coward's books?
number of pages refers to num_pages; average = Divide (Sum(num_pages), Count(book_id))
SELECT AVG(T1.num_pages) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Coward'
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
Please list the phone numbers of all the suppliers in Germany.
phone number refers to s_phone; Germany refers to n_name = 'Germany'
SELECT T1.s_phone FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'Germany'
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 full name of the customer who owns the "aalleburtonkc@yellowbook.com" e-mail address?
"aalleburtonkc@yellowbook.com" is the email of customer; full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = 'aalleburtonkc@yellowbook.com'
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
What is the name of the publisher that has published the most puzzle games?
name of publisher refers to publisher_name; puzzle refers to genre_name = 'Puzzle'; the most puzzle games refers to max(count(game_id where genre_name = 'Puzzle'))
SELECT T.publisher_name FROM ( SELECT T3.publisher_name, COUNT(DISTINCT T1.id) 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' GROUP BY T3.publisher_name ORDER BY COUNT(DISTINCT T1.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, -- );
retails
Please list the names of the top 3 suppliers with the most amount of money in their accounts.
supplier name refers to s_name; the most amount of money refers to max(s_acctbal)
SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3
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 from Charlotte Douglas International Airport to Austin - Bergstrom International Airport experienced serious reasons that cause flight cancellation?
from refers to ORIGIN; Charlotte Douglas International Airport refers to Description = 'Charlotte, NC: Charlotte Douglas International'; to refers to DEST; Austin - Bergstrom International Airport refers to Description = 'Austin, TX: Austin - Bergstrom International'; serious reasons refers to CANCELLATION_CODE = 'A';
SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ORIGIN = 'CLT' AND T1.DEST = 'AUS' AND T2.Description = 'Charlotte, NC: Charlotte Douglas International' AND T1.CANCELLATION_CODE = 'A'
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 publishers in Japan released a game on X360 in 2011?
in Japan refers to region_name = 'Japan'; on X360 refers to platform_name = 'X360'; in 2011 refers to release_year = 2011
SELECT COUNT(T3.game_publisher_id) 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 platform AS T4 ON T3.platform_id = T4.id WHERE T4.platform_name = 'X360' AND T3.release_year = 2011 AND T1.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `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
How many suppliers have their accounts in debt?
account in debt refers to s_acctbal < 0
SELECT COUNT(s_suppkey) FROM supplier WHERE s_acctbal < 0
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 Daisey Lamball's orders, how many were shipped via International shipping?
via international shipping refers to method_name = 'International'
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'
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
In 2004, what are the names of the platforms where Codemasters publish its games?
name of platform refers to platform_name; Codemasters refers to publisher_name = 'Codemasters'; in 2004 refers to release_year = 2004
SELECT T4.platform_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_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 T3.release_year = 2004 AND T1.publisher_name = 'Codemasters'
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 size of the smallest part in a jumbo case container?
size refers to p_size; the smallest part refers to min(p_size); jumbo case container refers to p_container = 'JUMBO CASE'
SELECT MIN(p_size) FROM part WHERE p_container = 'JUMBO CASE'
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 title of the first book that was published in 1900?
published in 1900 refers to publication_date LIKE '1900%'; first book refers to Min(publication_date)
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date 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
What are the names of the games that were published by 505 Games?
name of game refers to game_name; published by 505 Games refers to publisher_name = '505 Games'
SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = '505 Games'
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
Among the matches held in 2015, who is the winning team in the match ID 829768?
in 2015 refers to Match_Date LIKE '2015%'; the winning team refers to Team_Id = Match_Winner; match ID 829768 refers to Match_Id = 829768
SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Date LIKE '2015%' AND T1.Match_Id = 829768
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 parts have a jumbo case container?
jumbo case container refers to p_container = 'JUMBO CASE'
SELECT COUNT(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'
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 shipping method is preferred by customers the most?
shipping method preferred the most by customers refers to method_id where Max(Count(method_id)); which shipping method refers to method_name
SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) 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
Provide the winning team's name in the match with the point of winning margin of 7 on May 7, 2009.
the winning team refers to Team_Id = Match_Winner; the point of winning margin of 7 refers to Win_Margin = 7; on May 7 2009 refers to Match_Date = '2009-05-07'
SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Match_Date = '2009-05-07' AND T2.Win_Margin = 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
Which part has a bigger size, "pink powder drab lawn cyan" or "cornflower sky burlywood green beige"?
size refers to p_size; "pink powder drab lawn cyan" or "cornflower sky burlywood green beige" refers to p_name in ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige')
SELECT T.p_name FROM ( SELECT p_name, p_size FROM part WHERE p_name IN ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') ) AS T ORDER BY p_size 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 orders in 2022 have Iran as their destinations?
Iran as their destination refers to country_name = 'Iran'; orders in 2022 refers to order_date LIKE '2022%'
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id INNER JOIN cust_order AS T3 ON T3.dest_address_id = T2.address_id WHERE T1.country_name = 'Iran' AND STRFTIME('%Y', T3.order_date) = '2022'
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
Among the games published by Nintendo, what is the percentage of those in the genre of sports?
published by Nintendo refers to publisher_name = 'Nintendo'; in the genre of sports refers to genre_name = 'Sports'; percentage = divide(count(game_id where genre_name = 'Sports'), count(game_id)) * 100% where publisher_name = 'Nintendo'
SELECT CAST(COUNT(CASE WHEN T4.genre_name = 'Sports' THEN T1.id ELSE NULL END) AS REAL) * 100/ COUNT(T1.id) 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 T3.publisher_name = 'Nintendo'
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 cities are located in South Africa?
South Africa refers to Country_Name = 'South Africa'
SELECT SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.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 is the name of the product with the highest retail price?
name of the product refers to p_name; the highest retail price refers to p_retailprice
SELECT p_name FROM part WHERE p_retailprice = ( SELECT MAX(p_retailprice) FROM part )
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 orders did Antonia Poltun return?
order returned refers to status_value = 'Returned'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_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 T1.status_value = 'Returned' AND T4.first_name = 'Antonia' AND T4.last_name = 'Poltun'
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
Please list all the brands that contain a part under the type "promo brushed steel".
brand refers to p_brand; type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'
SELECT p_brand FROM part WHERE p_type = 'PROMO BRUSHED STEEL'
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 from Dallas to Santa Ana departed on time?
from Dallas refers to ORIGIN = 'DFW'; to Santa Ana refers to DEST = 'SNA'; departed on time refers to DEP_DELAY = 0;
SELECT COUNT(*) FROM Airlines WHERE DEST = 'SNA' AND ORIGIN = 'DFW' AND DEP_DELAY = 0
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, -- );
soccer_2016
What is the total number of won matches of the team named "Pune Warriors"?
the team named "Pune Warriors" refers to Team_Name = 'Pune Warriors'; the total number of won matches = count(Team_Name where Team_Id = Match_Winner)
SELECT SUM(CASE WHEN T2.Team_Name = 'Pune Warriors' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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 products under the type "promo brushed steel", how many of them are manufactured by Manufacturer#5?
type "promo brushed steel" refers to p_type = 'PROMO BRUSHED STEEL'; Manufacturer#5 refers to p_mfgr = 'Manufacturer#5'
SELECT COUNT(p_partkey) FROM part WHERE p_type = 'PROMO BRUSHED STEEL' AND p_mfgr = 'Manufacturer#5'
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
Which flight carrier operator has the most cancelled flights?
flight carrier operator refers to OP_CARRIER_AIRLINE_ID; most cancelled flights refers to MAX(COUNT(CANCELLED = 1));
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.CANCELLED DESC LIMIT 1
CREATE TABLE Airlines ( CANCELLED INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 CRS_DEP_TIME INTEGER, -- CRS_ELAPSED_TIME INTEGER, -- CANCELLATION_CODE TEXT, -- Example Values: `A`, `B`, `C` | Value Statics: Total count 3795 - Distinct count 3 - 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, -- );