CREATE TABLE all_star (
    player_id TEXT,
    year NUMBER,
    game_num NUMBER,
    game_id TEXT,
    team_id TEXT,
    league_id TEXT,
    gp NUMBER,
    starting_pos NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE appearances (
    year NUMBER,
    team_id TEXT,
    league_id TEXT,
    player_id TEXT,
    g_all NUMBER,
    gs NUMBER,
    g_batting NUMBER,
    g_defense NUMBER,
    g_p NUMBER,
    g_c NUMBER,
    g_1b NUMBER,
    g_2b NUMBER,
    g_3b NUMBER,
    g_ss NUMBER,
    g_lf NUMBER,
    g_cf NUMBER,
    g_rf NUMBER,
    g_of NUMBER,
    g_dh NUMBER,
    g_ph NUMBER,
    g_pr NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id"),
    FOREIGN KEY ("team_id") REFERENCES team("team_id")
);
CREATE TABLE manager_award (
    player_id TEXT,
    award_id TEXT,
    year NUMBER,
    league_id TEXT,
    tie TEXT,
    notes NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE player_award (
    player_id TEXT,
    award_id TEXT,
    year NUMBER,
    league_id TEXT,
    tie TEXT,
    notes TEXT,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE manager_award_vote (
    award_id TEXT,
    year NUMBER,
    league_id TEXT,
    player_id TEXT,
    points_won NUMBER,
    points_max NUMBER,
    votes_first NUMBER
);
CREATE TABLE player_award_vote (
    award_id TEXT,
    year NUMBER,
    league_id TEXT,
    player_id TEXT,
    points_won NUMBER,
    points_max NUMBER,
    votes_first NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE batting (
    player_id TEXT,
    year NUMBER,
    stint NUMBER,
    team_id TEXT,
    league_id TEXT,
    g NUMBER,
    ab NUMBER,
    r NUMBER,
    h NUMBER,
    double NUMBER,
    triple NUMBER,
    hr NUMBER,
    rbi NUMBER,
    sb NUMBER,
    cs NUMBER,
    bb NUMBER,
    so NUMBER,
    ibb NUMBER,
    hbp NUMBER,
    sh NUMBER,
    sf NUMBER,
    g_idp NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE batting_postseason (
    year NUMBER,
    round TEXT,
    player_id TEXT,
    team_id TEXT,
    league_id TEXT,
    g NUMBER,
    ab NUMBER,
    r NUMBER,
    h NUMBER,
    double NUMBER,
    triple NUMBER,
    hr NUMBER,
    rbi NUMBER,
    sb NUMBER,
    cs NUMBER,
    bb NUMBER,
    so NUMBER,
    ibb NUMBER,
    hbp NUMBER,
    sh NUMBER,
    sf NUMBER,
    g_idp NUMBER,
    FOREIGN KEY ("team_id") REFERENCES team("team_id"),
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE player_college (
    player_id TEXT,
    college_id TEXT,
    year NUMBER,
    FOREIGN KEY ("college_id") REFERENCES college("college_id"),
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE fielding (
    player_id TEXT,
    year NUMBER,
    stint NUMBER,
    team_id TEXT,
    league_id TEXT,
    pos TEXT,
    g NUMBER,
    gs NUMBER,
    inn_outs NUMBER,
    po NUMBER,
    a NUMBER,
    e NUMBER,
    dp NUMBER,
    pb NUMBER,
    wp NUMBER,
    sb NUMBER,
    cs NUMBER,
    zr NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE fielding_outfield (
    player_id TEXT,
    year NUMBER,
    stint NUMBER,
    glf NUMBER,
    gcf NUMBER,
    grf NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE fielding_postseason (
    player_id TEXT,
    year NUMBER,
    team_id TEXT,
    league_id TEXT,
    round TEXT,
    pos TEXT,
    g NUMBER,
    gs NUMBER,
    inn_outs NUMBER,
    po NUMBER,
    a NUMBER,
    e NUMBER,
    dp NUMBER,
    tp NUMBER,
    pb NUMBER,
    sb NUMBER,
    cs NUMBER,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE hall_of_fame (
    player_id TEXT,
    yearid NUMBER,
    votedby TEXT,
    ballots NUMBER,
    needed NUMBER,
    votes NUMBER,
    inducted TEXT,
    category TEXT,
    needed_note TEXT,
    FOREIGN KEY ("player_id") REFERENCES player("player_id")
);
CREATE TABLE home_game (
 

Question: List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007.
SQL: SELECT T2.name_first ,  T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'

Question: What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
SQL: SELECT T2.name_first ,  T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'

Question: How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?
SQL: SELECT sum(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000;

Question: Count the total number of games the team Boston Red Stockings attended from 1990 to 2000.
SQL: SELECT sum(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000;

Question: Which team had the least number of attendances in home games in 1980?
SQL: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;

Question: Find the team that attended the least number of home games in 1980.
SQL: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;

Question: List the names of states that have more than 2 parks.
SQL: SELECT state FROM park GROUP BY state HAVING count(*)  >  2;

Question: Which states have more than 2 parks?
SQL: SELECT state FROM park GROUP BY state HAVING count(*)  >  2;

Question: How many team franchises are active, with active value 'Y'?
SQL: SELECT count(*) FROM team_franchise WHERE active = 'Y';

Question: Find the number of team franchises that are active (have 'Y' as "active" information).
SQL: SELECT count(*) FROM team_franchise WHERE active = 'Y';

Question: Which cities have 2 to 4 parks?
SQL: SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;

Question: Find all the cities that have 2 to 4 parks.
SQL: SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;

Question: Which park had most attendances in 2008?
SQL: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;

Question: Which park did the most people attend in 2008?
SQL: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;