-- Schema: spider__baseball_1
CREATE SCHEMA IF NOT EXISTS "spider__baseball_1";

-- Table: all_star
CREATE TABLE "spider__baseball_1"."all_star" (
    "player_id" TEXT,
    "year" BIGINT,
    "game_num" BIGINT,
    "game_id" TEXT,
    "team_id" TEXT,
    "league_id" TEXT,
    "gp" NUMERIC,
    "starting_pos" NUMERIC
);

-- Table: appearances
CREATE TABLE "spider__baseball_1"."appearances" (
    "year" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "player_id" TEXT,
    "g_all" NUMERIC,
    "gs" NUMERIC,
    "g_batting" BIGINT,
    "g_defense" NUMERIC,
    "g_p" BIGINT,
    "g_c" BIGINT,
    "g_1b" BIGINT,
    "g_2b" BIGINT,
    "g_3b" BIGINT,
    "g_ss" BIGINT,
    "g_lf" BIGINT,
    "g_cf" BIGINT,
    "g_rf" BIGINT,
    "g_of" BIGINT,
    "g_dh" NUMERIC,
    "g_ph" NUMERIC,
    "g_pr" NUMERIC
);

-- Table: batting
CREATE TABLE "spider__baseball_1"."batting" (
    "player_id" TEXT,
    "year" BIGINT,
    "stint" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "g" BIGINT,
    "ab" NUMERIC,
    "r" NUMERIC,
    "h" NUMERIC,
    "double" NUMERIC,
    "triple" NUMERIC,
    "hr" NUMERIC,
    "rbi" NUMERIC,
    "sb" NUMERIC,
    "cs" NUMERIC,
    "bb" NUMERIC,
    "so" NUMERIC,
    "ibb" NUMERIC,
    "hbp" NUMERIC,
    "sh" NUMERIC,
    "sf" NUMERIC,
    "g_idp" NUMERIC
);

-- Table: batting_postseason
CREATE TABLE "spider__baseball_1"."batting_postseason" (
    "year" BIGINT,
    "round" TEXT,
    "player_id" TEXT,
    "team_id" TEXT,
    "league_id" TEXT,
    "g" BIGINT,
    "ab" BIGINT,
    "r" BIGINT,
    "h" BIGINT,
    "double" BIGINT,
    "triple" BIGINT,
    "hr" BIGINT,
    "rbi" BIGINT,
    "sb" BIGINT,
    "cs" NUMERIC,
    "bb" BIGINT,
    "so" BIGINT,
    "ibb" NUMERIC,
    "hbp" NUMERIC,
    "sh" NUMERIC,
    "sf" NUMERIC,
    "g_idp" NUMERIC
);

-- Table: college
CREATE TABLE "spider__baseball_1"."college" (
    "college_id" TEXT,
    "name_full" TEXT,
    "city" TEXT,
    "state" TEXT,
    "country" TEXT
);

-- Table: fielding
CREATE TABLE "spider__baseball_1"."fielding" (
    "player_id" TEXT,
    "year" BIGINT,
    "stint" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "pos" TEXT,
    "g" BIGINT,
    "gs" NUMERIC,
    "inn_outs" NUMERIC,
    "po" NUMERIC,
    "a" NUMERIC,
    "e" NUMERIC,
    "dp" NUMERIC,
    "pb" NUMERIC,
    "wp" NUMERIC,
    "sb" NUMERIC,
    "cs" NUMERIC,
    "zr" NUMERIC
);

-- Table: fielding_outfield
CREATE TABLE "spider__baseball_1"."fielding_outfield" (
    "player_id" TEXT,
    "year" BIGINT,
    "stint" BIGINT,
    "glf" NUMERIC,
    "gcf" NUMERIC,
    "grf" NUMERIC
);

-- Table: fielding_postseason
CREATE TABLE "spider__baseball_1"."fielding_postseason" (
    "player_id" TEXT,
    "year" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "round" TEXT,
    "pos" TEXT,
    "g" BIGINT,
    "gs" NUMERIC,
    "inn_outs" NUMERIC,
    "po" BIGINT,
    "a" BIGINT,
    "e" BIGINT,
    "dp" BIGINT,
    "tp" BIGINT,
    "pb" NUMERIC,
    "sb" NUMERIC,
    "cs" NUMERIC
);

-- Table: hall_of_fame
CREATE TABLE "spider__baseball_1"."hall_of_fame" (
    "player_id" TEXT,
    "yearid" BIGINT,
    "votedby" TEXT,
    "ballots" NUMERIC,
    "needed" NUMERIC,
    "votes" NUMERIC,
    "inducted" TEXT,
    "category" TEXT,
    "needed_note" TEXT
);

-- Table: home_game
CREATE TABLE "spider__baseball_1"."home_game" (
    "year" BIGINT,
    "league_id" TEXT,
    "team_id" TEXT,
    "park_id" TEXT,
    "span_first" TEXT,
    "span_last" TEXT,
    "games" BIGINT,
    "openings" BIGINT,
    "attendance" BIGINT
);

-- Table: manager
CREATE TABLE "spider__baseball_1"."manager" (
    "player_id" TEXT,
    "year" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "inseason" BIGINT,
    "g" BIGINT,
    "w" BIGINT,
    "l" BIGINT,
    "rank" NUMERIC,
    "plyr_mgr" TEXT
);

-- Table: manager_award
CREATE TABLE "spider__baseball_1"."manager_award" (
    "player_id" TEXT,
    "award_id" TEXT,
    "year" BIGINT,
    "league_id" TEXT,
    "tie" TEXT,
    "notes" NUMERIC
);

-- Table: manager_award_vote
CREATE TABLE "spider__baseball_1"."manager_award_vote" (
    "award_id" TEXT,
    "year" BIGINT,
    "league_id" TEXT,
    "player_id" TEXT,
    "points_won" BIGINT,
    "points_max" BIGINT,
    "votes_first" BIGINT
);

-- Table: manager_half
CREATE TABLE "spider__baseball_1"."manager_half" (
    "player_id" TEXT,
    "year" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "inseason" BIGINT,
    "half" BIGINT,
    "g" BIGINT,
    "w" BIGINT,
    "l" BIGINT,
    "rank" BIGINT
);

-- Table: park
CREATE TABLE "spider__baseball_1"."park" (
    "park_id" TEXT,
    "park_name" TEXT,
    "park_alias" TEXT,
    "city" TEXT,
    "state" TEXT,
    "country" TEXT
);

-- Table: pitching
CREATE TABLE "spider__baseball_1"."pitching" (
    "player_id" TEXT,
    "year" BIGINT,
    "stint" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "w" BIGINT,
    "l" BIGINT,
    "g" BIGINT,
    "gs" BIGINT,
    "cg" BIGINT,
    "sho" BIGINT,
    "sv" BIGINT,
    "ipouts" NUMERIC,
    "h" BIGINT,
    "er" BIGINT,
    "hr" BIGINT,
    "bb" BIGINT,
    "so" BIGINT,
    "baopp" NUMERIC,
    "era" NUMERIC,
    "ibb" NUMERIC,
    "wp" NUMERIC,
    "hbp" NUMERIC,
    "bk" BIGINT,
    "bfp" NUMERIC,
    "gf" NUMERIC,
    "r" BIGINT,
    "sh" NUMERIC,
    "sf" NUMERIC,
    "g_idp" NUMERIC
);

-- Table: pitching_postseason
CREATE TABLE "spider__baseball_1"."pitching_postseason" (
    "player_id" TEXT,
    "year" BIGINT,
    "round" TEXT,
    "team_id" TEXT,
    "league_id" TEXT,
    "w" BIGINT,
    "l" BIGINT,
    "g" BIGINT,
    "gs" BIGINT,
    "cg" BIGINT,
    "sho" BIGINT,
    "sv" BIGINT,
    "ipouts" BIGINT,
    "h" BIGINT,
    "er" BIGINT,
    "hr" BIGINT,
    "bb" BIGINT,
    "so" BIGINT,
    "baopp" TEXT,
    "era" NUMERIC,
    "ibb" NUMERIC,
    "wp" NUMERIC,
    "hbp" NUMERIC,
    "bk" NUMERIC,
    "bfp" NUMERIC,
    "gf" BIGINT,
    "r" BIGINT,
    "sh" NUMERIC,
    "sf" NUMERIC,
    "g_idp" NUMERIC
);

-- Table: player
CREATE TABLE "spider__baseball_1"."player" (
    "player_id" TEXT,
    "birth_year" NUMERIC,
    "birth_month" NUMERIC,
    "birth_day" NUMERIC,
    "birth_country" TEXT,
    "birth_state" TEXT,
    "birth_city" TEXT,
    "death_year" NUMERIC,
    "death_month" NUMERIC,
    "death_day" NUMERIC,
    "death_country" TEXT,
    "death_state" TEXT,
    "death_city" TEXT,
    "name_first" TEXT,
    "name_last" TEXT,
    "name_given" TEXT,
    "weight" NUMERIC,
    "height" NUMERIC,
    "bats" TEXT,
    "throws" TEXT,
    "debut" TEXT,
    "final_game" TEXT,
    "retro_id" TEXT,
    "bbref_id" TEXT
);

-- Table: player_award
CREATE TABLE "spider__baseball_1"."player_award" (
    "player_id" TEXT,
    "award_id" TEXT,
    "year" BIGINT,
    "league_id" TEXT,
    "tie" TEXT,
    "notes" TEXT
);

-- Table: player_award_vote
CREATE TABLE "spider__baseball_1"."player_award_vote" (
    "award_id" TEXT,
    "year" BIGINT,
    "league_id" TEXT,
    "player_id" TEXT,
    "points_won" NUMERIC,
    "points_max" BIGINT,
    "votes_first" NUMERIC
);

-- Table: player_college
CREATE TABLE "spider__baseball_1"."player_college" (
    "player_id" TEXT,
    "college_id" TEXT,
    "year" BIGINT
);

-- Table: postseason
CREATE TABLE "spider__baseball_1"."postseason" (
    "year" BIGINT,
    "round" TEXT,
    "team_id_winner" TEXT,
    "league_id_winner" TEXT,
    "team_id_loser" TEXT,
    "league_id_loser" TEXT,
    "wins" BIGINT,
    "losses" BIGINT,
    "ties" BIGINT
);

-- Table: salary
CREATE TABLE "spider__baseball_1"."salary" (
    "year" BIGINT,
    "team_id" TEXT,
    "league_id" TEXT,
    "player_id" TEXT,
    "salary" BIGINT
);

-- Table: team
CREATE TABLE "spider__baseball_1"."team" (
    "year" BIGINT,
    "league_id" TEXT,
    "team_id" TEXT,
    "franchise_id" TEXT,
    "div_id" TEXT,
    "rank" BIGINT,
    "g" BIGINT,
    "ghome" NUMERIC,
    "w" BIGINT,
    "l" BIGINT,
    "div_win" TEXT,
    "wc_win" TEXT,
    "lg_win" TEXT,
    "ws_win" TEXT,
    "r" BIGINT,
    "ab" BIGINT,
    "h" BIGINT,
    "double" BIGINT,
    "triple" BIGINT,
    "hr" BIGINT,
    "bb" BIGINT,
    "so" NUMERIC,
    "sb" NUMERIC,
    "cs" NUMERIC,
    "hbp" NUMERIC,
    "sf" NUMERIC,
    "ra" BIGINT,
    "er" BIGINT,
    "era" NUMERIC,
    "cg" BIGINT,
    "sho" BIGINT,
    "sv" BIGINT,
    "ipouts" BIGINT,
    "ha" BIGINT,
    "hra" BIGINT,
    "bba" BIGINT,
    "soa" BIGINT,
    "e" BIGINT,
    "dp" NUMERIC,
    "fp" NUMERIC,
    "name" TEXT,
    "park" TEXT,
    "attendance" NUMERIC,
    "bpf" BIGINT,
    "ppf" BIGINT,
    "team_id_br" TEXT,
    "team_id_lahman45" TEXT,
    "team_id_retro" TEXT
);

-- Table: team_franchise
CREATE TABLE "spider__baseball_1"."team_franchise" (
    "franchise_id" TEXT,
    "franchise_name" TEXT,
    "active" TEXT,
    "na_assoc" TEXT
);

-- Table: team_half
CREATE TABLE "spider__baseball_1"."team_half" (
    "year" BIGINT,
    "league_id" TEXT,
    "team_id" TEXT,
    "half" BIGINT,
    "div_id" TEXT,
    "div_win" TEXT,
    "rank" BIGINT,
    "g" BIGINT,
    "w" BIGINT,
    "l" BIGINT
);
