db_id stringclasses 66 values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66 values |
|---|---|---|---|---|
soccer_2016 | Count the total venues located in Pune City. | Pune City refers to City_Name = 'Pune' | SELECT SUM(T1.Venue_Name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Pune' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | List the infant mortality of country with the least Amerindian. | null | SELECT T1.Infant_Mortality FROM population AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country WHERE T2.Name = 'Amerindian' ORDER BY T2.Percentage ASC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | How many grocery stores paid $250 fine upon their inspection? | grocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250 | SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Grocery Store' AND T3.fine = 250 | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
shakespeare | What is the description of the chapter with the longest number of paragraphs? | chapter with the longest number of paragraphs refers to max(ParagraphNum) | SELECT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id ORDER BY T1.ParagraphNum DESC LIMIT 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Calculate the average runs scored during the first half of all first innings. | first half refers to 1 < Over_Id and Over_Id < 25; average = divide(sum(Over_Id) when 1 < Over_Id and Over_Id < 25, sum(Runs_Scored)) as percentage; first innings refers to Innings_No = 1 | SELECT CAST(SUM(CASE WHEN 1 < Over_Id AND Over_Id < 25 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(Runs_Scored) FROM Batsman_Scored WHERE Innings_No = 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | What is the full name of the country with 100% Africans? | Percentage = 100 means 100% of the population | SELECT T1.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Percentage = 100 AND T1.Name = 'African' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | What is the inspection ID where the employee named "David Hodges" is currently employed in the "Kamayan Express" establishment? | the "Kamayan Express" establishment refers to dba_name = 'KAMAYAN EXPRESS' | SELECT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T3.first_name = 'David' AND T3.last_name = 'Hodges' AND T1.dba_name = 'KAMAYAN EXPRESS' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | What year were the first game released? | year the first game was released refers to MIN(release_year); | SELECT T.release_year FROM game_platform AS T ORDER BY T.release_year ASC LIMIT 1 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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 name of the players born between 1970 and 1990 in descending order of age. | name of the players refers to Player_Name; born between 1970 and 1990 refers to DOB between '1970-01-01' and '1990-12-31' | SELECT Player_Name FROM Player WHERE DOB BETWEEN '1970-01-01' AND '1990-12-31' ORDER BY DOB DESC | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | Provide the country with its full name which has the most ethnic group? List them all ethnic group together with its percentage. | null | SELECT T1.Name, T2.Name, T2.Percentage FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Name = ( SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1 ) GROUP BY T1.Name, T2.Name, T2.Percentage | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | List down the inspection ID with the inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" and inspection category of Personnel. | inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" refers to inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAGO SANITATION CERTIFICATE POSTED OR VALID DOCUMENTATION DURING THIS INSPECTION.'; inspection category of Personnel refers to category = 'Personnel' | SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Personnel' AND T2.inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAGO SANITATION CERTIFICATE POSTED OR VALID DOCUMENTATION DURING THIS INSPECTION.' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
olympics | State the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old. | the 1984 Summer Olympic Games refer to games_name = '1984 Summer'; athletes more than 50 years old refer to person_id where age > 50; | SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1984 Summer' AND T2.age > 50 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
video_games | Who is the publisher of the game 2002 FIFA World Cup? | who is the publisher refers to publisher_name; 2002 FIFA World Cup refers to game_name = '2002 FIFA World Cup'; | SELECT T2.publisher_name FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN game AS T3 ON T1.game_id = T3.id WHERE T3.game_name = '2002 FIFA World Cup' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | What is the long title of the work with the highest number of scenes in act 1? | highest number of scenes refers to max(count(Scene)) | SELECT T2.LongTitle FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Act = 1 ORDER BY T1.Scene DESC LIMIT 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
mondial_geo | Which is the majority of the ethnic group in country with great than 10,000,000 population | null | SELECT T2.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Population > 10000000 GROUP BY T2.Name, T2.Percentage ORDER BY T2.Percentage DESC LIMIT 2 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | Name the taverns that failed the inspection in January 2010. | tavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%' | SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
olympics | How many kinds of events does athletics have? | kinds of events refer to event_name; athletics refer to sport_name = 'Athletics'; | SELECT COUNT(T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Athletics' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
video_games | Which region has the highest number of games sold on all platforms? | which region refers to region_name; highest number of games sold on all platforms refers to MAX(SUM(num_sales)); | SELECT T.region_name FROM ( SELECT T2.region_name, SUM(T1.num_sales) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id INNER JOIN game_platform AS T3 ON T1.game_platform_id = T3.id INNER JOIN platform AS T4 ON T3.platform_id = T4.id GROUP BY T4.platform_name ORDER BY SUM(T1.num_sales) DESC LIMIT 1 ) 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, --
); |
mondial_geo | State the country and its population with population growth greater than 2% but infant mortality rate less than 5%. | null | SELECT T1.Name, T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth > 2 AND T2.Infant_Mortality < 5 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
mondial_geo | Find the GPD for Bosnia and Herzegovina and the type of government it belongs to. | null | SELECT T1.GDP, T2.Government FROM economy AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Bosnia and Herzegovina' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | What is the difference in the number of restaurants that passed and failed the canvass inspection type? | canvass inspection type refers to inspection_type = 'Canvass'; restaurant refers to facility_type = 'Restaurant'; difference = subtract(count(inspection_id where results = 'Pass'), count(inspection_id where results = 'Fail')) | SELECT COUNT(CASE WHEN T2.results = 'Pass' THEN T1.license_no END) - COUNT(CASE WHEN T2.results = 'Fail' THEN T1.license_no END) AS diff FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_type = 'Canvass' AND T1.facility_type = 'Restaurant' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | What are the three largest numbers of games sold? | 3 largest numbers of games sold refers to game_name where MAX(num_sales) LIMIT 3; | SELECT T.game_platform_id, SUM(T.num_sales) * 100000 FROM region_sales AS T GROUP BY game_platform_id ORDER BY SUM(T.num_sales) * 100000 DESC LIMIT 3 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | From 1593 onwards, what is the difference between the number of comedy works and history works? | From 1593 onwards refers to Date > 1593; comedy works and history works refers to GenreType = 'comedy' and GenreType = 'History' | SELECT SUM(IIF(GenreType = 'Comedy', 1, 0)) - SUM(IIF(GenreType = 'History', 1, 0)) FROM works WHERE Date > 1593 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Among the players, what percentage are both captain and keeper? | captain and keeper refers to Role_Desc = 'CaptainKeeper'; percentage = divide(count(Player_Id) when Role_Desc = 'CaptainKeeper', count(Player_Id)) as percentage | SELECT CAST(SUM(CASE WHEN T2.Role_Desc = 'CaptainKeeper' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Rolee AS T2 ON T1.Role_Id = T2.Role_Id | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | Calculate the percentage of country which gained independence as republic after 1970. | null | SELECT CAST(SUM(CASE WHEN Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | What is the category of the inspection of the establishment named "J & J FOOD"? | the establishment named "J & J FOOD" refers to dba_name = 'J & J FOOD' | SELECT DISTINCT T4.category FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T1.dba_name = 'J & J FOOD' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | What are the names of games that were released in 2007? | names of games refers to game_name; released in 2007 refers to release_year = 2007; | SELECT T3.game_name FROM game_platform AS T1 INNER JOIN game_publisher AS T2 ON T1.game_publisher_id = T2.id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.release_year = 2007 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | How many "all" character names have the "all" abbreviation? | character names refers to CharName;"all" abbreviation refers to Abbrev = 'all' | SELECT COUNT(id) FROM characters WHERE Abbrev = 'All' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Among the matches, what percentage have a winning margin above 100? | winning margin above 100 refers to Win_Margin > 100; percentage = divide(count(Match_Id) when Win_Margin > 100, count(Match_Id)) as percentage | SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match` | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | State the different ethnic group and percentage of the language in Singapore. | null | SELECT T1.Name, T1.Percentage FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Singapore' GROUP BY T1.Name, T1.Percentage | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | What is the establishment's name with an inspection category of No Smoking Regulations? | establishment's name refers to dba_name; an inspection category of No Smoking Regulations refers to category = 'No Smoking Regulations' | SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'No Smoking Regulations' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
soccer_2016 | From which country does the most umpires are from? How many of them are from the mentioned country?
| which country refers to Country_Id; most umpires refers to max(count(Umpire_Id)) | SELECT T2.Country_Id, COUNT(T1.Umpire_Id) FROM Umpire AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Umpire_Country GROUP BY T2.Country_Id ORDER BY COUNT(T1.Umpire_Id) DESC LIMIT 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
mondial_geo | Which countries have more than 90% of African? List the name of the country in full. | Percentage = 90 means 90% of the population | SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'African' AND T1.Percentage > 90 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
video_games | What genre is the game 2010 FIFA World Cup South Africa? | genre refers to genre_name; 2010 FIFA World Cup South Africa refers to game_name = '2010 FIFA World Cup South Africa'; | SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2010 FIFA World Cup South Africa' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Please name any three comedic works. | comedic works refers to GenreType = 'comedy' | SELECT Title FROM works WHERE GenreType = 'comedy' LIMIT 3 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
mondial_geo | In which country does Polish found least in? | null | SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Polish' GROUP BY T2.Name, T1.Percentage ORDER BY T1.Percentage ASC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `Depe`, `USA`, `NL`, `GB`, `AUS` | Value Statics: Total count 39 - Distinct count 10 - Null count 200
);
CREATE TABLE river
(
River TEXT, --
Mountains TEXT, --
SourceAltitude REAL, --
Length REAL, --
EstuaryLatitude REAL, --
SourceLongitude REAL, --
Lake TEXT constraint river_ibfk_1 references lake on update cascade on delete cascade, --
EstuaryLongitude REAL, --
Sea TEXT, --
Name TEXT default '' not null primary key,
SourceLatitude REAL, --
);
CREATE TABLE mountainOnIsland
(
Mountain TEXT default '' not null constraint mountainOnIsland_ibfk_2 references mountain on update cascade on delete cascade, --
primary key (Mountain, Island),
Island TEXT default '' not null constraint mountainOnIsland_ibfk_1 references island on update cascade on delete cascade, --
);
CREATE TABLE organization
(
City TEXT, --
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint organization_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
Country TEXT constraint organization_ibfk_1 references country on update cascade on delete cascade, --
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint organization_ibfk_3 foreign key (Province, Country) references province on update cascade on delete cascade,
Abbreviation TEXT not null primary key,
Province TEXT, --
Name TEXT not null constraint ix_organization_OrgNameUnique unique, --
Established DATE, --
);
CREATE TABLE geo_desert
(
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_desert_ibfk_1 references country on update cascade on delete cascade, --
Desert TEXT default '' not null constraint geo_desert_ibfk_3 references desert on update cascade on delete cascade, --
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_desert_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Desert),
);
CREATE TABLE geo_source
(
River TEXT default '' not null constraint geo_source_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_source_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_source_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (Province, Country, River),
);
CREATE TABLE geo_sea
(
Country TEXT default '' not null constraint geo_sea_ibfk_1 references country on update cascade on delete cascade, --
Sea TEXT default '' not null constraint geo_sea_ibfk_3 references sea on update cascade on delete cascade, --
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_sea_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, Sea),
Province TEXT default '' not null, --
);
CREATE TABLE geo_estuary
(
primary key (Province, Country, River),
River TEXT default '' not null constraint geo_estuary_ibfk_3 references river on update cascade on delete cascade, --
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_estuary_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_estuary_ibfk_1 references country on update cascade on delete cascade, --
);
CREATE TABLE located
(
River TEXT constraint located_ibfk_3 references river on update cascade on delete cascade, --
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint located_ibfk_6 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT constraint located_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT constraint located_ibfk_4 references lake on update cascade on delete cascade, --
Sea TEXT constraint located_ibfk_5 references sea on update cascade on delete cascade, --
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
constraint located_ibfk_2 foreign key (City, Province) references city on update cascade on delete cascade,
City TEXT, --
Province TEXT, --
);
CREATE TABLE lake
(
Depth REAL, --
Altitude REAL, --
Name TEXT default '' not null primary key,
Longitude REAL, --
Latitude REAL, --
Type TEXT, -- Example Values: `artificial`, `salt`, `caldera`, `impact`, `acid` | Value Statics: Total count 56 - Distinct count 6 - Null count 74
River TEXT, --
Area REAL, --
);
CREATE TABLE desert
(
Longitude REAL, --
Area REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
);
CREATE TABLE geo_mountain
(
Country TEXT default '' not null constraint geo_mountain_ibfk_1 references country on update cascade on delete cascade, --
primary key (Province, Country, Mountain),
Province TEXT default '' not null, --
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_mountain_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Mountain TEXT default '' not null constraint geo_mountain_ibfk_3 references mountain on update cascade on delete cascade, --
);
CREATE TABLE ethnicGroup
(
primary key (Name, Country),
Country TEXT default '' not null constraint ethnicGroup_ibfk_1 references country on update cascade on delete cascade, --
Name TEXT default '' not null, --
Percentage REAL, --
);
CREATE TABLE economy
(
Industry REAL, --
GDP REAL, --
Country TEXT default '' not null primary key constraint economy_ibfk_1 references country on update cascade on delete cascade,
Inflation REAL, --
Service REAL, --
Agriculture REAL, --
);
CREATE TABLE borders
(
primary key (Country1, Country2),
Country2 TEXT default '' not null constraint borders_ibfk_2 references country, --
Length REAL, --
Country1 TEXT default '' not null constraint borders_ibfk_1 references country, --
);
CREATE TABLE language
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint language_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE islandIn
(
Sea TEXT constraint islandIn_ibfk_3 references sea on update cascade on delete cascade, --
River TEXT constraint islandIn_ibfk_2 references river on update cascade on delete cascade, -- Example Values: `River` | Value Statics: Total count 1 - Distinct count 1 - Null count 349
Island TEXT constraint islandIn_ibfk_4 references island on update cascade on delete cascade, --
Lake TEXT constraint islandIn_ibfk_1 references lake on update cascade on delete cascade, -- Example Values: `Lake`, `Ozero Baikal`, `Lake Toba`, `Lake Manicouagan`, `Lake Huron` | Value Statics: Total count 6 - Distinct count 6 - Null count 344
);
CREATE TABLE country
(
Area REAL, --
Capital TEXT, --
Population INTEGER, --
Name TEXT not null constraint ix_county_Name unique, --
Province TEXT, --
Code TEXT default '' not null primary key,
);
CREATE TABLE city
(
Longitude REAL, --
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint city_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Population INTEGER, --
Province TEXT default '' not null, --
primary key (Name, Province),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint city_ibfk_1 references country on update cascade on delete cascade, --
Latitude REAL, --
);
CREATE TABLE island
(
Name TEXT default '' not null primary key,
Islands TEXT, --
Area REAL, --
Type TEXT, -- Example Values: `volcanic`, `lime`, `coral`, `atoll` | Value Statics: Total count 91 - Distinct count 4 - Null count 185
Longitude REAL, --
Height REAL, --
Latitude REAL, --
);
CREATE TABLE geo_lake
(
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_lake_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
Country TEXT default '' not null constraint geo_lake_ibfk_1 references country on update cascade on delete cascade, --
Lake TEXT default '' not null constraint geo_lake_ibfk_3 references lake on update cascade on delete cascade, --
primary key (Province, Country, Lake),
Province TEXT default '' not null, --
);
CREATE TABLE mountain
(
Longitude REAL, --
Name TEXT default '' not null primary key,
Latitude REAL, --
Type TEXT, --
Height REAL, --
Mountains TEXT, --
);
CREATE TABLE province
(
Capital TEXT, --
Country TEXT not null constraint province_ibfk_1 references country on update cascade on delete cascade, --
primary key (Name, Country),
Population INTEGER, --
Area REAL, --
Name TEXT not null, --
CapProv TEXT, --
);
CREATE TABLE population
(
Infant_Mortality REAL, --
Population_Growth REAL, --
Country TEXT default '' not null primary key constraint population_ibfk_1 references country on update cascade on delete cascade,
);
CREATE TABLE isMember
(
primary key (Country, Organization),
Country TEXT default '' not null constraint isMember_ibfk_1 references country on update cascade on delete cascade, --
Organization TEXT default '' not null constraint isMember_ibfk_2 references organization on update cascade on delete cascade, --
Type TEXT default 'member', --
);
CREATE TABLE locatedOn
(
Island TEXT default '' not null constraint locatedOn_ibfk_2 references island on update cascade on delete cascade, --
Country TEXT default '' not null constraint locatedOn_ibfk_1 references country on update cascade on delete cascade, --
Province TEXT default '' not null, --
primary key (City, Province, Country, Island),
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_3 foreign key (City, Province) references city on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint locatedOn_ibfk_4 foreign key (Province, Country) references province on update cascade on delete cascade,
City TEXT default '' not null, --
);
CREATE TABLE mergesWith
(
Sea2 TEXT default '' not null constraint mergesWith_ibfk_2 references sea on update cascade on delete cascade, --
Sea1 TEXT default '' not null constraint mergesWith_ibfk_1 references sea on update cascade on delete cascade, --
primary key (Sea1, Sea2),
);
CREATE TABLE encompasses
(
Continent TEXT not null constraint encompasses_ibfk_2 references continent on update cascade on delete cascade, -- Example Values: `Europe`, `Asia`, `America`, `Australia/Oceania`, `Africa` | Value Statics: Total count 242 - Distinct count 5 - Null count 0
Country TEXT not null constraint encompasses_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, -- Example Values: `100.0`, `90.0`, `10.0`, `80.0`, `20.0` | Value Statics: Total count 242 - Distinct count 7 - Null count 0
primary key (Country, Continent),
);
CREATE TABLE continent
(
Name TEXT default '' not null primary key,
Area REAL, -- Example Values: `30254700.0`, `39872000.0`, `45095300.0`, `8503470.0`, `9562490.0` | Value Statics: Total count 5 - Distinct count 5 - Null count 0
);
CREATE TABLE religion
(
primary key (Name, Country),
Name TEXT default '' not null, --
Country TEXT default '' not null constraint religion_ibfk_1 references country on update cascade on delete cascade, --
Percentage REAL, --
);
CREATE TABLE geo_river
(
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_river_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
primary key (Province, Country, River),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_river_ibfk_1 references country on update cascade on delete cascade, --
River TEXT default '' not null constraint geo_river_ibfk_3 references river on update cascade on delete cascade, --
);
CREATE TABLE sea
(
Depth REAL, --
Name TEXT default '' not null primary key,
);
CREATE TABLE target
(
Country TEXT not null primary key constraint target_Country_fkey references country on update cascade on delete cascade,
Target TEXT, -- Example Values: `Target`, `Christian`, `non-Christian` | Value Statics: Total count 205 - Distinct count 3 - Null count 0
);
CREATE TABLE geo_island
(
Island TEXT default '' not null constraint geo_island_ibfk_3 references island on update cascade on delete cascade, --
primary key (Province, Country, Island),
Province TEXT default '' not null, --
Country TEXT default '' not null constraint geo_island_ibfk_1 references country on update cascade on delete cascade, --
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
constraint geo_island_ibfk_2 foreign key (Province, Country) references province on update cascade on delete cascade,
); |
food_inspection_2 | Among the establishments that paid a 500 fine, what is the percentage of restaurants? | a 500 fine refers to fine = 500; restaurant refers to facility_type = 'Restaurant'; percentage = divide(count(license_no where facility_type = 'Restaurant'), count(license_no)) * 100% where fine = 500 | SELECT CAST(COUNT(CASE WHEN T1.facility_type = 'Restaurant' THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.facility_type) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T3.fine = 500 | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | How many games were sold on PS3 platform in Japan? | how many games = MULTIPLY(SUM(num_sales), 100000); PS3 refers to platform_name = 'PS3'; Japan refers to region_name = 'Japan'; | SELECT SUM(T1.num_sales * 100000) FROM region_sales AS T1 INNER JOIN region AS T2 ON T1.region_id = T2.id INNER JOIN game_platform AS T3 ON T1.game_platform_id = T3.id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T2.region_name = 'Japan' AND T4.platform_name = 'PS3' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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 | On average, how many players from each country bat with their right hand? | bat with their right hand refers to Batting_hand = 'Right-hand bat'; average = divide(count(Player_Id) when Batting_hand = 'Right-hand bat', count(Country_Name)) | SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Country_Name) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_id = T2.Batting_hand | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What was the average temperature differences during May 2012 for store number 6 and 7? | during May 2012 refers to SUBSTR(date, 1, 7) = '2012-05'; store number 6 refers to store_nbr = 6; store number 7 refers to store_nbr = 7; average temperature difference = Subtract (Divide (Sum(tavg), Count (date) where the store_nbr = 6), Divide (Sum(tavg), Count(date) where store_nbr = 7)) | SELECT ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr AND T1.`date` LIKE '%2012-05%' AND T2.store_nbr = 6 ) - ( SELECT CAST(SUM(tavg) AS REAL) / COUNT(`date`) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` LIKE '%2012-05%' AND T2.store_nbr = 7 ) | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
food_inspection_2 | How many of the inspections with serious point levels have no fines? | serious point level refers to point_level = 'Serious'; no fines refers to fine = 0 | SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0 | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | Indicate the release year of the game with more than 200000 sales in Japan. | more than 200000 sales refers to SUM(num_sales) > 2; Japan refers to region_name = 'Japan'; | SELECT DISTINCT T3.release_year FROM region AS T1 INNER JOIN region_sales AS T2 ON T1.id = T2.region_id INNER JOIN game_platform AS T3 ON T2.game_platform_id = T3.id WHERE T2.num_sales * 100000 > 200000 AND T1.region_name = 'Japan' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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 | Of the wickets taken in the third overs, how many are without the involvement of fielders? | third overs refers to Over_Id = 3; without the involvement of fielders refers to Fielders = '' | SELECT SUM(CASE WHEN Fielders = '' THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Over_Id = 3 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What was the total unit sold for item 10 when the average temperature was below the median temperature? | item 10 refers to item_nbr = 10; average temperature below median temperature refers to tavg < avg(tavg); total units refers to Sum(units) | SELECT SUM(T5.units) FROM weather AS T4 INNER JOIN sales_in_weather AS T5 ON T4.`date` = T5.`date` INNER JOIN relation AS T6 ON T5.store_nbr = T6.store_nbr WHERE T5.item_nbr = 10 AND T4.tavg < ( SELECT AVG(T1.tavg) FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 10 ) | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | List the price for Zetacoin on 13/11/1 and the next 7 consecutive days. What is the average price for these 7 days? | on 1/11/13 and the next 7 consecutive days refers to DATE BETWEEN '2013-11-01' AND '2013-11-07'; average price refers to AVG(price); Zetacoin refers to name = 'Zetacoin' | SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07' UNION ALL SELECT AVG(T2.PRICE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07' | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | Indicate the name of all adventure games. | name of games refers to game_name; adventure games refers to game_name WHERE genre_name = 'Adventure'; | SELECT T2.game_name FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T1.genre_name = 'Adventure' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Calculate average scene per act in Antony and Cleopatra. | Antony and Cleopatra refers to Title = 'Antony and Cleopatra'; average scene per act = divide(sum(Scene), count(act))
| SELECT CAST(SUM(T2.Scene) AS REAL) / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Antony and Cleopatra' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | In the players, how many were out by hit wicket? | out by hit wicket refers to Out_Name = 'hit wicket' | SELECT Player_Out FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T1.Kind_Out = T2.Out_Id WHERE Out_Name = 'hit wicket' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What is the difference between the units sold for item 1 when the sunset was the earliest and the latest? | item 1 refers to item_nbr = 1; when the sunset earliest refers to Min(sunset); latest sunset refers to Max(sunset); difference unit sold refers to Subtract(Sum(units where Min(sunset)), Sum(units where Max(sunset))) | SELECT ( SELECT SUM(T2.units) AS sumunit FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 5 AND sunset IS NOT NULL GROUP BY T1.sunset ORDER BY T1.sunset LIMIT 1 ) - ( SELECT SUM(T2.units) AS sumunit FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 5 AND sunset IS NOT NULL GROUP BY T1.sunset ORDER BY T1.sunset DESC LIMIT 1 ) | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
food_inspection_2 | Among the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees. | failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7) | SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee ) | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
olympics | How many games has Prithipal Singh participated in? | games refer to games_id; | SELECT COUNT(T2.games_id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Prithipal Singh' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
video_games | How many shooter games are there? | shooter games refers to game_name WHERE genre_name = 'shooter'; | SELECT COUNT(T1.id) FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T2.genre_name = 'Shooter' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Calculate the percentage of paragraphs in all chapters of "All's Well That Ends Well". | "All's Well That Ends Well" refers to Title = 'All's Well That Ends Well'; percentage = divide(sum(paragraphs.id) when Title = 'All's Well That Ends Well', count(paragraphs.id)) as percentage | SELECT CAST(SUM(IIF(T1.Title = 'All''s Well That Ends Well', 1, 0)) AS REAL) * 100 / COUNT(T3.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | In the matches where the winning margin is less than fifty, how many teams won by wicket? | winning margin is less than fifty refers to Win_Margin < 50; won by wicket refers to Win_Type = 'wickets' | SELECT COUNT(T2.Win_Id) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id WHERE T2.Win_Type = 'wickets' AND T1.Win_Margin < 50 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | How many units are being sold for item 1 when the average temperature is 83? | item 1 refers to item_nbr = 1; when the average temperature is 83 refers to tavg = 83 | SELECT SUM(units) FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.item_nbr = 1 AND T1.tavg = 83 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | What is the total value of Argentum coined traded in the past 24 hours on 2016/10/11. | total value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10' | SELECT T2.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11' | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | How many games were published by Activision? | Activision refers to publisher_name = 'Activision'; | SELECT COUNT(DISTINCT T3.id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id INNER JOIN game AS T3 ON T1.game_id = T3.id WHERE T2.publisher_name = 'Activision' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Please name the latest historical work. | name refers to LongTitle; latest historical work refers to GenreType = 'History' and max(Date) | SELECT LongTitle FROM works WHERE GenreType = 'History' ORDER BY Date DESC LIMIT 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Calculate the win rate of the team "Chennai Super Kings". | team "Chennai Super Kings" refers to Team_Name = 'Chennai Super Kings'; win rate = divide(count(Match_Id where Match_Winner = 3), count(Match_Id)) * 100% | SELECT CAST(SUM(CASE WHEN T1.Match_Winner = 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T2.Team_Name = 'Chennai Super Kings' OR T3.Team_Name = 'Chennai Super Kings' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What was the average temperature difference between store number 18 and 19 on 16 September 2022? | store number 18 refers to store_nbr = 18; store number 19 refers to store_nbr = 19; on 16 September 2022 refers to date = '2022-09-16'; average temperature difference = Subtract(tavg where store_nbr = 18, tavg where store_nbr = 19) | SELECT SUM(CASE WHEN T1.store_nbr = 18 THEN T2.tavg ELSE 0 END) - SUM(CASE WHEN T1.store_nbr = 19 THEN T2.tavg ELSE 0 END) FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.`date` = '2012-09-16' | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
shakespeare | Describe the scene number, act, and title of work which had the description of "The house of ANTIPHOLUS of Ephesus" in chapter. | null | SELECT T2.Act, T2.Scene, T1.Title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T2.Description = 'The house of ANTIPHOLUS of Ephesus.' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Give the name of the venue where the most number of matches are held. | name of the venue refers to Venue_Name; most number of matches refers to max(count(Venue_Id)) | SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id GROUP BY T2.Venue_Name ORDER BY COUNT(T2.Venue_Id) DESC LIMIT 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What was the difference of number of units sold in station number 1 and number 2 on year 2012? | station 1 refers to station_nbr = 1; station 2 refers to station_nbr = 2; on year 2012 refers to substring (date, 1, 4) = '2012'; difference = Subtract (Sum(units where station_nbr = 1), Sum(units where station_nbr = 2)) | SELECT SUM(CASE WHEN T1.station_nbr = 1 THEN units ELSE 0 END) - SUM(CASE WHEN T1.station_nbr = 2 THEN units ELSE 0 END) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.`date` LIKE '%2012%' | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | State the transaction date whereby DigixDAO was transacted at the hightest price. | the highest price refers to max(price); DigixDAO refers to name = 'DigixDAO' | SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1 | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | Indicate the publisher who has published the most games of all time. | publisher refers to publisher_name; publisher who has published the most games of all time refers to MAX(COUNT(publisher_name)); | SELECT T.publisher_name FROM ( SELECT T2.publisher_name, COUNT(DISTINCT T1.game_id) FROM game_publisher AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.id GROUP BY T2.publisher_name ORDER BY COUNT(DISTINCT T1.game_id) DESC LIMIT 1 ) t | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0
num_sales REAL default NULL, --
game_platform_id INTEGER default NULL, --
);
CREATE TABLE genre
(
id INTEGER not null primary key,
genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
);
CREATE TABLE region
(
id INTEGER not null primary key,
region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE game
(
foreign key (genre_id) references genre(id),
game_name TEXT default NULL, --
id INTEGER not null primary key,
genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0
);
CREATE TABLE publisher
(
id INTEGER not null primary key,
publisher_name TEXT default NULL, --
);
CREATE TABLE game_platform
(
platform_id INTEGER default NULL, --
game_publisher_id INTEGER default NULL, --
foreign key (platform_id) references platform(id),
foreign key (game_publisher_id) references game_publisher(id),
foreign key (game_publisher_id) references game_publisher(id),
foreign key (game_publisher_id) references game_publisher(id),
id INTEGER not null primary key,
release_year INTEGER default NULL, --
);
CREATE TABLE game_publisher
(
publisher_id INTEGER default NULL, --
game_id INTEGER default NULL, --
id INTEGER not null primary key,
foreign key (game_id) references game(id),
foreign key (publisher_id) references publisher(id),
);
CREATE TABLE platform
(
id INTEGER not null primary key,
platform_name TEXT default NULL, --
); |
soccer_2016 | What percentage of players have Legbreak skill? | Legbreak skill refers to Bowling_skill = 'Legbreak' ; percentage = divide(sum(Player_Id) when Bowling_skill = 'Legbreak', count(Player_Id)) as percentage | SELECT CAST(SUM(CASE WHEN T2.Bowling_skill = ' Legbreak' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T1.Bowling_skill = T2.Bowling_Id | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What is the ratio of the highest and lowest temperature in store 11? | store 11 refers to store_nbr = 11; highest temperature refers to Max(tmax); lowest temperature refers to Min(tmin); ration = Divide (Max(tmax), Min(tmin)) | SELECT CAST((MAX(T1.tmax) - MIN(T1.tmin)) AS REAL) / MIN(T1.tmin) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 11 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | Name the coin that has the highest market capitalization for all transactions in 2018. | highest market capitalization refers to max(market_cap); in 2018 refers to year(date) = 2018 | SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date LIKE '2018%' AND T2.market_cap = ( SELECT MAX(market_cap) FROM historical WHERE STRFTIME('%Y', date) = '2018' ) | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | List the games from the publisher "Activision". | games refers to game_name; "Activision" refers to publisher_name = 'Activision'; | SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = 'Activision' | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Provide the character name, paragraph number, and plain text of "cousin to the king" description. | character name refers to CharName; paragraph number refers to ParagraphNum | SELECT T1.CharName, T2.ParagraphNum, T2.PlainText FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.Description = 'cousin to the king' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Which player became the man of the series in the year 2012? Give the name and country of this player. | year 2012 refers to Season_Year = 2012; name of player refers to Player_Name.; country of this player refers to Country_Name | SELECT T2.Player_Name, T3.Country_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Season_Year = 2012 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | Which items from store 1 have the highest units sold during rainy day? | store 1 refers to store_nbr = 1; highest unit sold refers to Max(units); during rainy day refers to codesum like '%'||'RA'||'%'; item refers to item_nbr | SELECT T2.item_nbr FROM weather AS T1 INNER JOIN sales_in_weather AS T2 ON T1.`date` = T2.`date` INNER JOIN relation AS T3 ON T2.store_nbr = T3.store_nbr AND T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 1 AND T1.codesum LIKE '%' OR 'RA' OR '%' GROUP BY T2.item_nbr ORDER BY T2.units DESC LIMIT 1 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | List all the inactive coins and state the last date of its transaction? | the last date refers to max(date); inactive coins refers to status = 'inactive' | SELECT T1.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1 | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | How much are the sales of the games in region ID 4? | how much are the sales = SUM(num_sales); | SELECT SUM(T.num_sales) * 100000 FROM region_sales AS T WHERE T.region_id = 4 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | List the scenes and descriptions in Act 1 of " Pericles, Prince of Tyre". | " Pericles, Prince of Tyre" refers to LongTitle = 'Pericles, Prince of Tyre' | SELECT T2.Scene, T2.Description FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Pericles, Prince of Tyre' AND T2.Act = 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Write the name of the player who was the man of the series more than one time. | name of the player refers to Player_Name; man of the series more than one time refers to count(Man_of_the_Series) > 1 | SELECT T2.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Man_of_the_Series > 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What is the sea level and average speed for store number 3 and store number 4? | store number 3 refers to store_nbr = 3; average speed refers to avgspeed; store number 4 refers to store_nbr = 4 | SELECT T1.sealevel, T1.avgspeed FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 3 OR T2.store_nbr = 4 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | For all transactions for WRAP in August 2016, list the time to achieve highest price and the time to achieve the lowest price. | in May 2013 refers to month(date) = 5 AND year(date) = 2013; time to achieve the highest price refers to time_high; time to achieve the lowest price refers to time_low; WRAP refers to name = 'WARP' | SELECT T2.time_high, T2.time_low, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'WARP' AND STRFTIME('%Y-%m', T2.date) = '2016-08' | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | In 2010, how many PS3 games were released? | in 2010 refers to release_year = 2010; PS3 refers to platform_name = 'PS3'; | SELECT COUNT(T3.game_id) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN game_publisher AS T3 ON T2.game_publisher_id = T3.id WHERE T1.platform_name = 'PS3' AND T2.release_year = 2010 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4` | Value Statics: Total count 65320 - Distinct count 4 - Null count 0
num_sales REAL default NULL, --
game_platform_id INTEGER default NULL, --
);
CREATE TABLE genre
(
id INTEGER not null primary key,
genre_name TEXT default NULL, -- Example Values: `Action`, `Adventure`, `Fighting`, `Misc`, `Platform` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
);
CREATE TABLE region
(
id INTEGER not null primary key,
region_name TEXT default NULL, -- Example Values: `North America`, `Europe`, `Japan`, `Other` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE game
(
foreign key (genre_id) references genre(id),
game_name TEXT default NULL, --
id INTEGER not null primary key,
genre_id INTEGER default NULL, -- Example Values: `4`, `5`, `11`, `2`, `9` | Value Statics: Total count 11317 - Distinct count 12 - Null count 0
);
CREATE TABLE publisher
(
id INTEGER not null primary key,
publisher_name TEXT default NULL, --
);
CREATE TABLE game_platform
(
platform_id INTEGER default NULL, --
game_publisher_id INTEGER default NULL, --
foreign key (platform_id) references platform(id),
foreign key (game_publisher_id) references game_publisher(id),
foreign key (game_publisher_id) references game_publisher(id),
foreign key (game_publisher_id) references game_publisher(id),
id INTEGER not null primary key,
release_year INTEGER default NULL, --
);
CREATE TABLE game_publisher
(
publisher_id INTEGER default NULL, --
game_id INTEGER default NULL, --
id INTEGER not null primary key,
foreign key (game_id) references game(id),
foreign key (publisher_id) references publisher(id),
);
CREATE TABLE platform
(
id INTEGER not null primary key,
platform_name TEXT default NULL, --
); |
soccer_2016 | In how many venues did team 2 win the toss and lose the match? | team 2 win the toss refers to Toss_Winner = Team_2 ; lose the match refers to Match_Winner = Team_1 | SELECT SUM(CASE WHEN T1.Team_2 = T1.Match_Winner THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Team_1 = T1.Toss_Winner | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | List out dates when haze is recorded in store 35. | store 35 refers to store_nbr = 35; haze is recorded refers to codesum like '%'||'HZ'||'%' | SELECT T1.`date` FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 35 AND T1.codesum LIKE '%' OR 'HZ' OR '%' | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | What is the average monthly circulating supply for Frozen in 2014. | average monthly circulating supply = AVG(circulating_supply); in 2017 refers to date BETWEEN '2017-01-01' AND '2017-12-31' | SELECT CAST(SUM(T2.circulating_supply) AS REAL) / 12 FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Frozen' AND STRFTIME('%Y', T2.date) = '2014' | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
shakespeare | Describe the full title which had the character named Servant to Montague. | full title refers to LongTitle; character named Servant to Montague refers to characters.Description = 'Servant to Montague' | SELECT DISTINCT T1.LongTitle FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.Description = 'Servant to Montague' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
sales_in_weather | List out stations number and items sold by store 17. | station number refers to station_nbr; store 17 refers to store_nbr = 17 | SELECT T1.station_nbr, T2.item_nbr FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.store_nbr = 17 GROUP BY T1.station_nbr, T2.item_nbr | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
video_games | Calculate the difference between sales of games from region ID 2 and region ID 3. | difference = SUBTRACT(SUM(num_sales WHERE region_id = 2), SUM(num_sales WHERE region_id = 3)); | SELECT SUM(CASE WHEN T.region_id = 2 THEN T.num_sales ELSE 0 END) - SUM(CASE WHEN T.region_id = 3 THEN T.num_sales ELSE 0 END) FROM region_sales t | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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 city hosted the least number of no-result matches? | city refers to City_Name; no-result matches refers to Win_type = 'NoResult'; least number refers to min(count(Win_type = 'NoResult')) | SELECT T4.City_Name FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Venue AS T3 ON T1.Venue_Id = T3.Venue_Id INNER JOIN City AS T4 ON T3.City_Id = T4.City_Id WHERE T2.Win_Type = 'NO Result' GROUP BY T4.City_Id ORDER BY COUNT(T2.Win_Type) ASC LIMIT 1 | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | How many items were sold by store 9 during a snowy day? | store 9 refers to store_nbr = 9; snowy day refers to snowfall < > 0 and snowfall is not null; item refers to item_nbr | SELECT COUNT(DISTINCT item_nbr) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T3.store_nbr = 9 AND T1.snowfall <> 0 AND T1.snowfall IS NOT NULL | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
video_games | What is the percentage of games that were released on PS4 in 2014 among all platforms? | percentage - MULTIPLY(DIVIDE(SUM(platform_name = 'PS4'), COUNT(game_id)), 100); in 2014 refers to release_year = 2014; | SELECT CAST(COUNT(CASE WHEN T2.platform_name = 'PS4' THEN T3.game_id ELSE NULL END) AS REAL) * 100 / COUNT(T3.game_id) FROM game_platform AS T1 INNER JOIN platform AS T2 ON T1.platform_id = T2.id INNER JOIN game_publisher AS T3 ON T1.game_publisher_id = T3.id WHERE T1.release_year = 2014 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | Gives the average number of chapters in Shakespeare's 1599 work. | 1599 work refers to Date = '1599'; average number refers to divide(count(chapters.id), count(works.id)) | SELECT CAST(COUNT(T1.id) AS REAL) / COUNT(DISTINCT T2.id) FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.Date = '1599' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
sales_in_weather | How many units of item 7 have been sold by store 7 when the snow is less than 5 inches? | item 7 refers to item_nbr = 7; store 7 refers to store_nbr = 7; snow is less than 5 inches refers to snowfall < 5 | SELECT SUM(units) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.store_nbr = 7 AND T3.item_nbr = 7 AND T1.snowfall < 5 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
food_inspection_2 | Where in Chicago does the restaurant named "Old Timers Rest & Lounge" located? | in Chicago refers to city = 'CHICAGO'; restaurant refers to facility_type = 'Restaurant'; "Old Timers Rest & Lounge" refers to dba_name = 'OLD TIMERS REST & LOUNGE'; location refers to address | SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER primary key,
results TEXT, -- Example Values: `Pass`, `Pass w/ Conditions`, `Fail`, `Out of Business`, `Business Not Located` | Value Statics: Total count 100000 - Distinct count 7 - Null count 0
inspection_date DATE, --
inspection_type TEXT, --
);
CREATE TABLE violation
(
inspector_comment TEXT, --
inspection_id INTEGER, --
foreign key (inspection_id) references inspection(inspection_id),
point_id INTEGER, --
primary key (inspection_id, point_id),
foreign key (point_id) references inspection_point(point_id),
foreign key (point_id) references inspection_point(point_id),
fine INTEGER, -- Example Values: `100`, `0`, `500`, `250` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
);
CREATE TABLE establishment
(
facility_type TEXT, --
address TEXT, --
risk_level INTEGER, -- Example Values: `2`, `1`, `3` | Value Statics: Total count 31621 - Distinct count 3 - Null count 21
aka_name TEXT, --
state TEXT, -- Example Values: `IL` | Value Statics: Total count 31640 - Distinct count 1 - Null count 2
zip INTEGER, --
license_no INTEGER primary key,
city TEXT, -- Example Values: `CHICAGO`, `Chicago`, `chicago`, `CHicago`, `MAYWOOD` | Value Statics: Total count 31593 - Distinct count 16 - Null count 49
ward INTEGER, --
longitude REAL, --
latitude REAL, --
dba_name TEXT, --
);
CREATE TABLE employee
(
zip INTEGER, --
city TEXT, -- Example Values: `Chicago`, `Park Forest`, `Hoffman Estates` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
phone TEXT, --
employee_id INTEGER primary key,
title TEXT, -- Example Values: `Sanitarian`, `Supervisor`, `Division Manager` | Value Statics: Total count 75 - Distinct count 3 - Null count 0
first_name TEXT, --
salary INTEGER, --
address TEXT, --
supervisor INTEGER, -- Example Values: `177316`, `186742`, `179582`, `182205`, `192462` | Value Statics: Total count 75 - Distinct count 8 - Null count 0
state TEXT, -- Example Values: `IL` | Value Statics: Total count 75 - Distinct count 1 - Null count 0
last_name TEXT, --
foreign key (supervisor) references employee(employee_id),
);
CREATE TABLE inspection_point
(
point_id INTEGER primary key,
category TEXT, -- Example Values: `Food Protection`, `Food Equipment and Utensil Sanitation`, `Wash and Waste Water Disposal`, `Toilet and Hand Washing Facilities for Staff`, `Compliance Insect and Rodent Control` | Value Statics: Total count 46 - Distinct count 14 - Null count 0
Description TEXT, --
fine INTEGER, -- Example Values: `500`, `250`, `100` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
point_level TEXT, -- Example Values: `Critical`, `Serious `, `Minor ` | Value Statics: Total count 46 - Distinct count 3 - Null count 0
code TEXT, -- Example Values: `7-38-005 (B) (B-2)`, `7-38-005 (A)`, `7-38-010 (A) (B)`, `7-38-030`, `7-38-031` | Value Statics: Total count 46 - Distinct count 17 - Null count 0
); |
video_games | List down the game platform IDs of games with a region ID of 1. | null | SELECT T.game_platform_id FROM region_sales AS T WHERE T.region_id = 1 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | What is the title which has character named "Froth"? | character named "Froth" refers to CharName = 'Froth' | SELECT DISTINCT T1.title FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id INNER JOIN paragraphs AS T3 ON T2.id = T3.chapter_id INNER JOIN characters AS T4 ON T3.character_id = T4.id WHERE T4.CharName = 'Froth' | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Of the matches that were won by runs by team 1, what percentage have team 1 won the toss and decided to field? | won by runs refers to Win_Type = 'runs'; won the toss and decided to field refers to Toss_Winner and Toss_Name = 'field'; percentage = divide(count(Team_1) when Match_Winner = Team_1 and Toss_Winner = Team_1, count(Team_1)) as percentage | SELECT CAST(COUNT(CASE WHEN T1.Team_1 = T1.Match_Winner = T1.Toss_Winner THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Team_1) FROM `Match` AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id INNER JOIN Toss_Decision AS T3 ON T1.Toss_Decide = T3.Toss_Id WHERE T3.Toss_Name = 'field' AND T2.Win_Type = 'runs' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | What is the lowest minimum temperature recorded in store 16 on January 2012? | lowest minimum temperature refers to Min(tmin); store 16 refers to store_nbr = 16; on January 2012 refers to Substring (date, 1, 7) = '2012-01' | SELECT MIN(tmin) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 16 AND T1.`date` LIKE '%2012-01%' | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
coinmarketcap | State the transaction date and the price when Bitcoin was bottomed? | was bottomed refers to min(price) | SELECT T2.date, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.price LIMIT 1 | CREATE TABLE historical
(
total_supply REAL, --
high REAL, --
percent_change_7d REAL, --
open REAL, --
close REAL, --
percent_change_1h REAL, --
percent_change_24h REAL, --
num_market_pairs INTEGER, --
time_low TEXT, --
coin_id INTEGER, --
date DATE, --
time_high TEXT, --
market_cap REAL, --
low REAL, --
circulating_supply REAL, --
cmc_rank INTEGER, --
price REAL, --
volume_24h REAL, --
max_supply REAL, --
);
CREATE TABLE coins
(
tags TEXT, --
notice TEXT, --
category TEXT, -- Example Values: `coin`, `token` | Value Statics: Total count 8869 - Distinct count 2 - Null count 58
date_added TEXT, --
date_launched TEXT, --
name TEXT, --
id INTEGER not null primary key,
description TEXT, --
slug TEXT, --
platform_id INTEGER, --
website TEXT, --
tag_names TEXT, --
symbol TEXT, --
status TEXT, -- Example Values: `active`, `untracked`, `inactive`, `extinct` | Value Statics: Total count 8927 - Distinct count 4 - Null count 0
subreddit TEXT, --
); |
video_games | State the game publisher IDs of the games with a platform ID of 16. | null | SELECT T.game_publisher_id FROM game_platform AS T WHERE T.platform_id = 16 | CREATE TABLE region_sales
(
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (game_platform_id) references game_platform(id),
foreign key (region_id) references region(id),
region_id INTEGER default NULL, -- Example Values: `1`, `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, --
); |
shakespeare | How many scenes are there in work id 7, act 1? | null | SELECT COUNT(id) FROM chapters WHERE work_id = 7 AND Act = 1 | CREATE TABLE characters
(
CharName TEXT not null, --
Abbrev TEXT not null, --
Description TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE paragraphs
(
chapter_id INTEGER default 0 not null references chapters, --
character_id INTEGER not null references characters, --
ParagraphNum INTEGER not null, --
PlainText TEXT not null, --
id INTEGER primary key autoincrement,
);
CREATE TABLE works
(
GenreType TEXT not null, -- Example Values: `Comedy`, `Tragedy`, `History`, `Poem`, `Sonnet` | Value Statics: Total count 43 - Distinct count 5 - Null count 0
Title TEXT not null, --
Date INTEGER not null, --
id INTEGER primary key autoincrement,
LongTitle TEXT not null, --
);
CREATE TABLE chapters
(
work_id INTEGER not null references works, --
Act INTEGER not null, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 945 - Distinct count 6 - Null count 0
Description TEXT not null, --
id INTEGER primary key autoincrement,
Scene INTEGER not null, --
); |
soccer_2016 | Among the players who were born in 1977, provide names and birthdates of the players from England. | born in 1977 refers to DOB LIKE '1977%'; name refers to Player_Name; birthdate refers to DOB; England refers to Country_Name = 'England' | SELECT T2.Player_Name, T2.DOB FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.DOB LIKE '1977%' AND T1.Country_Name = 'England' | CREATE TABLE Win_By
(
Win_Id INTEGER primary key,
Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE Wicket_Taken
(
Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 - 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,
); |
sales_in_weather | How many stations were able to sell item 5 on January 2014? | item 5 refers to item_nbr = 5; on January 2014 refers to Substring (date, 1, 7) = '2014-01' | SELECT COUNT(DISTINCT T2.station_nbr) AS number FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE SUBSTR(`date`, 1, 7) = '2014-01' AND item_nbr = 5 | CREATE TABLE sales_in_weather
(
primary key (store_nbr, date, item_nbr),
store_nbr INTEGER, --
units INTEGER, --
item_nbr INTEGER, --
date DATE, --
);
CREATE TABLE relation
(
store_nbr INTEGER primary key,
station_nbr INTEGER, --
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (store_nbr) references sales_in_weather(store_nbr),
foreign key (station_nbr) references weather(station_nbr),
);
CREATE TABLE weather
(
resultdir INTEGER, --
date DATE, --
codesum TEXT, --
dewpoint INTEGER, --
primary key (station_nbr, date),
avgspeed REAL, --
heat INTEGER, --
depart INTEGER, --
resultspeed REAL, --
tmin INTEGER, --
tmax INTEGER, --
sunset TEXT, --
wetbulb INTEGER, --
station_nbr INTEGER, --
tavg INTEGER, --
stnpressure REAL, --
sunrise TEXT, --
cool INTEGER, --
sealevel REAL, --
preciptotal REAL, --
snowfall REAL, --
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.