Schema:
CREATE TABLE all_star (
    player_id TEXT,
    year INTEGER,
    game_num INTEGER,
    game_id TEXT,
    team_id TEXT,
    league_id TEXT,
    gp NUMERIC,
    starting_pos NUMERIC,
    foreign key (player_id) references player(player_id)
);
CREATE TABLE appearances (
    year INTEGER,
    team_id TEXT,
    league_id TEXT,
    player_id TEXT,
    g_all NUMERIC,
    gs NUMERIC,
    g_batting INTEGER,
    g_defense NUMERIC,
    g_p INTEGER,
    g_c INTEGER,
    g_1b INTEGER,
    g_2b INTEGER,
    g_3b INTEGER,
    g_ss INTEGER,
    g_lf INTEGER,
    g_cf INTEGER,
    g_rf INTEGER,
    g_of INTEGER,
    g_dh NUMERIC,
    g_ph NUMERIC,
    g_pr NUMERIC,
    foreign key (team_id) references team(team_id),
    foreign key (player_id) references player(player_id)
);
CREATE TABLE manager_award (
    player_id TEXT,
    award_id TEXT,
    year INTEGER,
    league_id TEXT,
    tie TEXT,
    notes NUMERIC,
    foreign key (player_id) references player(player_id)
);
CREATE TABLE player_award ( 
	player_id TEXT, 
	award_id TEXT, 
	year INTEGER, 
	league_id TEXT,
    	tie TEXT,
    	notes TEXT,
	foreign key (player_id) references player(player_id)
);
CREATE TABLE manager_award_vote (
    award_id TEXT,
    year INTEGER,
    league_id TEXT,
    player_id TEXT,
    points_won INTEGER,
    points_max INTEGER,
    votes_first INTEGER);
CREATE TABLE player_award_vote (
    award_id TEXT,
    year INTEGER,
    league_id TEXT,
    player_id TEXT,
    points_won NUMERIC,
    points_max INTEGER,
    votes_first NUMERIC,
   foreign key (player_id) references player(player_id)
);
CREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, 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,
foreign key (player_id) references player(player_id)
);
CREATE TABLE batting_postseason (
    year INTEGER,
    round TEXT,
    player_id TEXT,
    team_id TEXT,
    league_id TEXT,
    g INTEGER,
    ab INTEGER,
    r INTEGER,
    h INTEGER,
    double INTEGER,
    triple INTEGER,
    hr INTEGER,
    rbi INTEGER,
    sb INTEGER,
    cs NUMERIC,
    bb INTEGER,
    so INTEGER,
    ibb NUMERIC,
    hbp NUMERIC,
    sh NUMERIC,
    sf NUMERIC,
    g_idp NUMERIC,
	foreign key (player_id) references player(player_id),
	foreign key (team_id) references team(team_id)
);
CREATE TABLE player_college ( player_id TEXT,
    college_id TEXT,
    year INTEGER,
	foreign key (player_id) references player(player_id),
	foreign key (college_id) references college(college_id)
);
CREATE TABLE fielding (
    player_id TEXT,
    year INTEGER,
    stint INTEGER,
    team_id TEXT,
    league_id TEXT,
    pos TEXT,
    g INTEGER,
    gs NUMERIC,
    inn_outs NUMERIC,
    po NUMERIC,
    a NUMERIC,
    e NUMERIC,
    dp NUMERIC,
    pb NUMERIC,
    wp NUMERIC,
    sb NUMERIC,
    cs NUMERIC,
    zr NUMERIC,
	foreign key (player_id) references player(player_id)
);
CREATE TABLE fielding_outfield (
    player_id TEXT,
    year INTEGER,
    stint INTEGER,
    glf NUMERIC,
    gcf NUMERIC,
    grf NUMERIC,
	foreign key (player_id) references player(player_id)
);
CREATE TABLE fielding_postseason (
    player_id TEXT,
    year INTEGER,
    team_id TEXT,
    league_id TEXT,
    round TEXT,
    pos TEXT,
    g INTEGER,
    gs NUMERIC,
    inn_outs NUMERIC,
    po INTEGER,
    a INTEGER,
    e INTEGER,
    dp INTEGER,
    tp INTEGER,
    pb NUMERIC,
    sb NUMERIC,
    cs NUMERIC,
	foreign key (player_id) references player(player_id),
	foreign key (team_id) references player(team_id)
);
CREATE TABLE hall_of_fame (
    player_id TEXT,
    yearid INTEGER,
    votedby TEXT,
    ballots NUMERIC,
    needed NUMERIC,
    votes NUMERIC,
    inducted TEXT,
    category TEXT,
    needed_note TEXT,
	foreign key (player_id) references player(player_id)
);
CREATE TABLE home_game (
    year INTEGER,
    league_id TEXT,
    team_id TEXT,
    park_id TEXT,
    span_first TEXT,
    span_last TEXT,
    games INTEGER,
    openings INTEGER,
    attendance INTEGER,
	foreign key (team_id) references team(team_id),
	foreign key (park_id) references park(park_id)
);
CREATE TABLE manager (
    player_id TEXT,
    year INTEGER,
    team_id TEXT,
    league_id TEXT,
    inseason INTEGER,
    g INTEGER,
    w INTEGER,
    l INTEGER,
    rank NUMERIC,
    plyr_mgr TEXT,
	foreign key (team_id) references team(team_id)
);
CREATE TABLE manager_half (
    player_id TEXT,
    year INTEGER,
    team_id TEXT,
    league_id TEXT,
    inseason INTEGER,
    half INTEGER,
    g INTEGER,
    w INTEGER,
    l INTEGER,
    rank INTEGER,
	foreign key (team_id) references team(team_id)
);
CREATE TABLE 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);
CREATE TABLE park (
    park_id TEXT,
    park_name TEXT,
    park_alias TEXT,
    city TEXT,
    state TEXT,
    country TEXT);
CREATE TABLE pitching (
    player_id TEXT,
    year INTEGER,
    stint INTEGER,
    team_id TEXT,
    league_id TEXT,
    w INTEGER,
    l INTEGER,
    g INTEGER,
    gs INTEGER,
    cg INTEGER,
    sho INTEGER,
    sv INTEGER,
    ipouts NUMERIC,
    h INTEGER,
    er INTEGER,
    hr INTEGER,
    bb INTEGER,
    so INTEGER,
    baopp NUMERIC,
    era NUMERIC,
    ibb NUMERIC,
    wp NUMERIC,
    hbp NUMERIC,
    bk INTEGER,
    bfp NUMERIC,
    gf NUMERIC,
    r INTEGER,
    sh NUMERIC,
    sf NUMERIC,
    g_idp NUMERIC);
CREATE TABLE pitching_postseason (
    player_id TEXT,
    year INTEGER,
    round TEXT,
    team_id TEXT,
    league_id TEXT,
    w INTEGER,
    l INTEGER,
    g INTEGER,
    gs INTEGER,
    cg INTEGER,
    sho INTEGER,
    sv INTEGER,
    ipouts INTEGER,
    h INTEGER,
    er INTEGER,
    hr INTEGER,
    bb INTEGER,
    so INTEGER,
    baopp TEXT,
    era NUMERIC,
    ibb NUMERIC,
    wp NUMERIC,
    hbp NUMERIC,
    bk NUMERIC,
    bfp NUMERIC,
    gf INTEGER,
    r INTEGER,
    sh NUMERIC,
    sf NUMERIC,
    g_idp NUMERIC);
CREATE TABLE salary (
    year INTEGER,
    team_id TEXT,
    league_id TEXT,
    player_id TEXT,
    salary INTEGER);
CREATE TABLE college (
    college_id TEXT,
    name_full TEXT,
    city TEXT,
    state TEXT,
    country TEXT);
CREATE TABLE postseason (
    year INTEGER,
    round TEXT,
    team_id_winner TEXT,
    league_id_winner TEXT,
    team_id_loser TEXT,
    league_id_loser TEXT,
    wins INTEGER,
    losses INTEGER,
    ties INTEGER);
CREATE TABLE team (
    year INTEGER,
    league_id TEXT,
    team_id TEXT,
    franchise_id TEXT,
    div_id TEXT,
    rank INTEGER,
    g INTEGER,
    ghome NUMERIC,
    w INTEGER,
    l INTEGER,
    div_win TEXT,
    wc_win TEXT,
    lg_win TEXT,
    ws_win TEXT,
    r INTEGER,
    ab INTEGER,
    h INTEGER,
    double INTEGER,
    triple INTEGER,
    hr INTEGER,
    bb INTEGER,
    so NUMERIC,
    sb NUMERIC,
    cs NUMERIC,
    hbp NUMERIC,
    sf NUMERIC,
    ra INTEGER,
    er INTEGER,
    era NUMERIC,
    cg INTEGER,
    sho INTEGER,
    sv INTEGER,
    ipouts INTEGER,
    ha INTEGER,
    hra INTEGER,
    bba INTEGER,
    soa INTEGER,
    e INTEGER,
    dp NUMERIC,
    fp NUMERIC,
    name TEXT,
    park TEXT,
    attendance NUMERIC,
    bpf INTEGER,
    ppf INTEGER,
    team_id_br TEXT,
    team_id_lahman45 TEXT,
    team_id_retro TEXT);
CREATE TABLE team_franchise (
    franchise_id TEXT,
    franchise_name TEXT,
    active TEXT,
    na_assoc TEXT);
CREATE TABLE team_half (
    year INTEGER,
    league_id TEXT,
    team_id TEXT,
    half INTEGER,
    div_id TEXT,
    div_win TEXT,
    rank INTEGER,
    g INTEGER,
    w INTEGER,
    l INTEGER);

Question: what is the full name and id of the college with the largest number of baseball players?
SQL:
SELECT T1.name_full ,  T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id  =  T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;

Question: Find the full name and id of the college that has the most baseball players.
SQL:
SELECT T1.name_full ,  T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id  =  T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;

Question: What is average salary of the players in the team named 'Boston Red Stockings' ?
SQL:
SELECT avg(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings'

Question: Compute the average salary of the players in the team called 'Boston Red Stockings'.
SQL:
SELECT avg(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings'

Question: What are first and last names of players participating in all star game in 1998?
SQL:
SELECT name_first ,  name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id  =  T2.player_id WHERE YEAR  =  1998

Question: List the first and last name for players who participated in all star game in 1998.
SQL:
SELECT name_first ,  name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id  =  T2.player_id WHERE YEAR  =  1998

Question: What are the first name, last name and id of the player with the most all star game experiences? Also list the count.
SQL:
SELECT T1.name_first , T1.name_last ,  T1.player_id ,   count(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id  =  T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 1;

Question: Which player has the most all star game experiences? Give me the first name, last name and id of the player, as well as the number of times the player participated in all star game.
SQL:
SELECT T1.name_first , T1.name_last ,  T1.player_id ,   count(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id  =  T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 1;

Question: How many players enter hall of fame each year?
SQL:
SELECT yearid ,  count(*) FROM hall_of_fame GROUP BY yearid;

Question: Count the number of players who enter hall of fame for each year.
SQL:
SELECT yearid ,  count(*) FROM hall_of_fame GROUP BY yearid;

Question: What is the average number of attendance at home games for each year?
SQL:
SELECT YEAR ,  avg(attendance) FROM home_game GROUP BY YEAR;

Question: For each year, return the year and the average number of attendance at home games.
SQL:
SELECT YEAR ,  avg(attendance) FROM home_game GROUP BY YEAR;

Question: In 2014, what are the id and rank of the team that has the largest average number of attendance?
SQL:
SELECT T2.team_id ,  T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id WHERE T1.year  =  2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;

Question: Find the id and rank of the team that has the highest average attendance rate in 2014.
SQL:
SELECT T2.team_id ,  T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id WHERE T1.year  =  2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;

Question: What are the manager's first name, last name and id who won the most manager award?
SQL:
SELECT T1.name_first ,  T1.name_last ,  T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id  =  T2.player_id GROUP BY T2.player_id ORDER BY count(*) DESC LIMIT 1;

Question: Which manager won the most manager award? Give me the manager's first name, last name and id.
SQL:
SELECT T1.name_first ,  T1.name_last ,  T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id  =  T2.player_id GROUP BY T2.player_id ORDER BY count(*) DESC LIMIT 1;

Question: How many parks are there in the state of NY?
SQL:
SELECT count(*) FROM park WHERE state  =  'NY';

Question: Show me the number of parks the state of NY has.
SQL:
SELECT count(*) FROM park WHERE state  =  'NY';

Question: Which 3 players won the most player awards? List their full name and id.
SQL:
SELECT T1.name_first ,  T1.name_last ,  T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id  =  T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 3;

Question: Find the first name, last name and id for the top three players won the most player awards.
SQL:
SELECT T1.name_first ,  T1.name_last ,  T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id  =  T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 3;

Question: List three countries which are the origins of the least players.
SQL:
SELECT birth_country FROM player GROUP BY birth_country ORDER BY count(*) ASC LIMIT 3;

Question: What are the three countries that the least players are from?
SQL:
SELECT birth_country FROM player GROUP BY birth_country ORDER BY count(*) ASC LIMIT 3;

Question: Find all the players' first name and last name who have empty death record.
SQL:
SELECT name_first ,  name_last FROM player WHERE death_year = '';

Question: What are the first name and last name of the players whose death record is empty?
SQL:
SELECT name_first ,  name_last FROM player WHERE death_year = '';

Question: How many players born in USA are right-handed batters? That is, have the batter value 'R'.
SQL:
SELECT count(*) FROM player WHERE birth_country = 'USA' AND bats  =  'R';

Question: Count the number of players who were born in USA and have bats information 'R'.
SQL:
SELECT count(*) FROM player WHERE birth_country = 'USA' AND bats  =  'R';

Question: What is the average height of the players from the college named 'Yale University'?
SQL:
SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id  =  T2.player_id JOIN college AS T3 ON T3.college_id  =  T2.college_id WHERE T3.name_full  =  'Yale University';

Question: Find the average height of the players who belong to the college called 'Yale University'.
SQL:
SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id  =  T2.player_id JOIN college AS T3 ON T3.college_id  =  T2.college_id WHERE T3.name_full  =  'Yale University';

Question: What is the highest salary among each team? List the team name, id and maximum salary.
SQL:
SELECT T1.name ,  T1.team_id ,  max(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id  =  T2.team_id GROUP BY T1.team_id;

Question: For each team, return the team name, id and the maximum salary among the team.
SQL:
SELECT T1.name ,  T1.team_id ,  max(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id  =  T2.team_id GROUP BY T1.team_id;

Question: What are the name and id of the team offering the lowest average salary?
SQL:
SELECT T1.name ,  T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY avg(T2.salary) ASC LIMIT 1;

Question: Which team offers the lowest average salary? Give me the name and id of the team.
SQL:
SELECT T1.name ,  T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY avg(T2.salary) ASC LIMIT 1;

Question: Find the players' first name and last name who won award both in 1960 and in 1961.
SQL:
SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year  =  1960 INTERSECT SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year  =  1961

Question: Which players won awards in both 1960 and 1961? Return their first names and last names.
SQL:
SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year  =  1960 INTERSECT SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year  =  1961

Question: List players' first name and last name who have weight greater than 220 or height shorter than 75.
SQL:
SELECT name_first ,  name_last FROM player WHERE weight  >  220 OR height  <  75

Question: What are the first name and last name of the players who have weight above 220 or height below 75?
SQL:
SELECT name_first ,  name_last FROM player WHERE weight  >  220 OR height  <  75

Question: List the maximum scores of the team Boston Red Stockings when the team won in postseason?
SQL:
SELECT max(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings';

Question: What are the maximum scores the team Boston Red Stockings got when the team won in postseason?
SQL:
SELECT max(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings';

Question: How many times did Boston Red Stockings lose in 2009 postseason?
SQL:
SELECT count(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' AND T1.year = 2009;

Question: Count the number of times the team "Boston Red Stockings" lost in 2009 postseason.
SQL:
SELECT count(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' AND T1.year = 2009;

Question: What are the name and id of the team with the most victories in 2008 postseason?
SQL:
SELECT T2.name ,  T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T1.year  =  2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;

Question: Find the name and id of the team that won the most times in 2008 postseason.
SQL:
SELECT T2.name ,  T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T1.year  =  2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;

Question: What is the number of wins the team Boston Red Stockings got in the postseasons each year in history?
SQL:
SELECT count(*) ,  T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' GROUP BY T1.year

Question: For each year, return the year and the number of times the team Boston Red Stockings won in the postseasons.
SQL:
SELECT count(*) ,  T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' GROUP BY T1.year

Question: What is the total number of postseason games that team Boston Red Stockings participated in?
SQL:
SELECT count(*) FROM ( SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' );

Question: How many times in total did the team Boston Red Stockings participate in postseason games?
SQL:
SELECT count(*) FROM ( SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser  =  T2.team_id_br WHERE T2.name  =  'Boston Red Stockings' );

Question: How many games in 1885 postseason resulted in ties (that is, the value of "ties" is '1')?
SQL:
SELECT count(*) FROM postseason WHERE YEAR  =  1885 AND ties  =  1;

Question: Find the number of tied games (the value of "ties" is '1') in 1885 postseason.
SQL:
SELECT count(*) FROM postseason WHERE YEAR  =  1885 AND ties  =  1;

Question: What is the total salary paid by team Boston Red Stockings in 2010?
SQL:
SELECT sum(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings' AND T1.year  =  2010

Question: What is the total salary expenses of team Boston Red Stockings in 2010?
SQL:
SELECT sum(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings' AND T1.year  =  2010

Question: How many players were in the team Boston Red Stockings in 2000?
SQL:
SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings' AND T1.year  =  2000

Question: How many players did Boston Red Stockings have in 2000?
SQL:
SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id_br WHERE T2.name  = 'Boston Red Stockings' AND T1.year  =  2000

Question: List the 3 highest salaries of the players in 2001?
SQL:
SELECT salary FROM salary WHERE YEAR  =  2001 ORDER BY salary DESC LIMIT 3;

Question: How much salary did the top 3 well-paid players get in 2001?
SQL:
SELECT salary FROM salary WHERE YEAR  =  2001 ORDER BY salary DESC LIMIT 3;

Question: What were all the salary values of players in 2010 and 2001?
SQL:
SELECT salary FROM salary WHERE YEAR  =  2010 UNION SELECT salary FROM salary WHERE YEAR  =  2001

Question: List all the salary values players received in 2010 and 2001.
SQL:
SELECT salary FROM salary WHERE YEAR  =  2010 UNION SELECT salary FROM salary WHERE YEAR  =  2001

Question: In which year did the least people enter hall of fame?
SQL:
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY count(*) ASC LIMIT 1;

Question: Find the year in which the least people enter hall of fame.
SQL:
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY count(*) ASC LIMIT 1;

Question: How many parks are there in Atlanta city?
SQL:
SELECT count(*) FROM park WHERE city = 'Atlanta';

Question: How many parks does Atlanta city have?
SQL:
SELECT count(*) FROM park WHERE city = 'Atlanta';

Question: How many games were played in park "Columbia Park" in 1907?
SQL:
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park';

Question: Count the number of games taken place in park "Columbia Park" in 1907.
SQL:
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park';

Question: How many games were played in city Atlanta in 2000?
SQL:
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year  =  2000 AND T2.city  =  'Atlanta';

Question: Find the number of games taken place in city Atlanta in 2000.
SQL:
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year  =  2000 AND T2.city  =  'Atlanta';

Question: What is the total home game attendance of team Boston Red Stockings from 2000 to 2010?
SQL:
SELECT sum(T1.attendance) 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 2000 AND 2010;

Question: How many games in total did team Boston Red Stockings attend from 2000 to 2010?
SQL:
SELECT sum(T1.attendance) 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 2000 AND 2010;

Question: How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total?
SQL:
SELECT sum(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first  =  'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990;

Question: Compute the total salary that the player with first name Len and last name Barker received between 1985 to 1990.
SQL:
SELECT sum(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first  =  'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990;

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;