db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### Question:
#
# List the names of states that have more than 2 parks.
#
### SQL:
#
# SELECT state FROM park GROUP BY state HAVING count(*) > 2;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### Question:
#
# Which states have more than 2 parks?
#
### SQL:
#
# SELECT state FROM park GROUP BY state HAVING count(*) > 2;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### Question:
#
# How many team franchises are active, with active value 'Y'?
#
### SQL:
#
# SELECT count(*) FROM team_franchise WHERE active = 'Y';
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### Question:
#
# Find the number of team franchises that are active (have 'Y' as "active" information).
#
### SQL:
#
# SELECT count(*) FROM team_franchise WHERE active = 'Y';
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### Question:
#
# Which cities have 2 to 4 parks?
#
### SQL:
#
# SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
baseball_1
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# all_star ( player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos )
# appearances ( year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr )
# manager_award ( player_id, award_id, year, league_id, tie, notes )
# player_award ( player_id, award_id, year, league_id, tie, notes )
# manager_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# player_award_vote ( award_id, year, league_id, player_id, points_won, points_max, votes_first )
# batting ( player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# batting_postseason ( year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp )
# player_college ( player_id, college_id, year )
# fielding ( player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr )
# fielding_outfield ( player_id, year, stint, glf, gcf, grf )
# fielding_postseason ( player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs )
# hall_of_fame ( player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note )
# home_game ( year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance )
# manager ( player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr )
# manager_half ( player_id, year, team_id, league_id, inseason, half, g, w, l, rank )
# player ( player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id )
# park ( park_id, park_name, park_alias, city, state, country )
# pitching ( player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# pitching_postseason ( player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp )
# salary ( year, team_id, league_id, player_id, salary )
# college ( college_id, name_full, city, state, country )
# postseason ( year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties )
# team ( year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro )
# team_franchise ( franchise_id, franchise_name, active, na_assoc )
# team_half ( year, league_id, team_id, half, div_id, div_win, rank, g, w, l )
#
# all_star.player_id can be joined with player.player_id
# appearances.player_id can be joined with player.player_id
# appearances.team_id can be joined with team.team_id
# manager_award.player_id can be joined with player.player_id
# player_award.player_id can be joined with player.player_id
# player_award_vote.player_id can be joined with player.player_id
# batting.player_id can be joined with player.player_id
# batting_postseason.team_id can be joined with team.team_id
# batting_postseason.player_id can be joined with player.player_id
# player_college.college_id can be joined with college.college_id
# player_college.player_id can be joined with player.player_id
# fielding.player_id can be joined with player.player_id
# fielding_outfield.player_id can be joined with player.player_id
# fielding_postseason.player_id can be joined with player.player_id
# hall_of_fame.player_id can be joined with player.player_id
# home_game.park_id can be joined with park.park_id
# home_game.team_id can be joined with team.team_id
# manager.team_id can be joined with team.team_id
# manager_half.team_id can be joined with team.team_id
#
### 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;
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# How many camera lenses have a focal length longer than 15 mm?
#
### SQL:
#
# SELECT count(*) FROM camera_lens WHERE focal_length_mm > 15
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
#
### SQL:
#
# SELECT brand , name FROM camera_lens ORDER BY max_aperture DESC
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# List the id, color scheme, and name for all the photos.
#
### SQL:
#
# SELECT id , color , name FROM photos
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the maximum and average height of the mountains?
#
### SQL:
#
# SELECT max(height) , avg(height) FROM mountain
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the average prominence of the mountains in country 'Morocco'?
#
### SQL:
#
# SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
#
### SQL:
#
# SELECT name , height , prominence FROM mountain WHERE range != 'Aberdare Range'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the id and name of the photos for mountains?
#
### SQL:
#
# SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the id and name of the mountains that have at least 2 photos?
#
### SQL:
#
# SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING count(*) >= 2
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the names of the cameras that have taken picture of the most mountains?
#
### SQL:
#
# SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
#
### SQL:
#
# SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# How many different kinds of lens brands are there?
#
### SQL:
#
# SELECT count(DISTINCT brand) FROM camera_lens
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# How many camera lenses are not used in taking any photos?
#
### SQL:
#
# SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
#
### SQL:
#
# SELECT count(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
#
### SQL:
#
# SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
#
### SQL:
#
# SELECT name , prominence FROM mountain EXCEPT SELECT T1.name , T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# List the camera lens names containing substring "Digital".
#
### SQL:
#
# SELECT name FROM camera_lens WHERE name LIKE "%Digital%"
#
### End.
|
mountain_photos
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# mountain ( id, name, Height, Prominence, Range, Country )
# camera_lens ( id, brand, name, focal_length_mm, max_aperture )
# photos ( id, camera_lens_id, mountain_id, color, name )
#
# photos.mountain_id can be joined with mountain.id
# photos.camera_lens_id can be joined with camera_lens.id
#
### Question:
#
# What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
#
### SQL:
#
# SELECT T1.name , count(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY count(*)
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Find the names of channels that are not owned by CCTV.
#
### SQL:
#
# SELECT name FROM channel WHERE OWNER != 'CCTV'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which channels are not owned by CCTV? Give me the channel names.
#
### SQL:
#
# SELECT name FROM channel WHERE OWNER != 'CCTV'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# List all channel names ordered by their rating in percent from big to small.
#
### SQL:
#
# SELECT name FROM channel ORDER BY rating_in_percent DESC
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Give me a list of all the channel names sorted by the channel rating in descending order.
#
### SQL:
#
# SELECT name FROM channel ORDER BY rating_in_percent DESC
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What is the owner of the channel that has the highest rating ratio?
#
### SQL:
#
# SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Show me the owner of the channel with the highest rating.
#
### SQL:
#
# SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# how many programs are there?
#
### SQL:
#
# SELECT count(*) FROM program
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Count the number of programs.
#
### SQL:
#
# SELECT count(*) FROM program
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# list all the names of programs, ordering by launch time.
#
### SQL:
#
# SELECT name FROM program ORDER BY launch
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What is the list of program names, sorted by the order of launch date?
#
### SQL:
#
# SELECT name FROM program ORDER BY launch
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# List the name, origin and owner of each program.
#
### SQL:
#
# SELECT name , origin , OWNER FROM program
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What are the name, origin and owner of each program?
#
### SQL:
#
# SELECT name , origin , OWNER FROM program
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# find the name of the program that was launched most recently.
#
### SQL:
#
# SELECT name FROM program ORDER BY launch DESC LIMIT 1
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which program was launched most recently? Return the program name.
#
### SQL:
#
# SELECT name FROM program ORDER BY launch DESC LIMIT 1
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# find the total percentage share of all channels owned by CCTV.
#
### SQL:
#
# SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What is the total share (in percent) of all the channels owned by CCTV?
#
### SQL:
#
# SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Find the names of the channels that are broadcast in the morning.
#
### SQL:
#
# SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which channels are broadcast in the morning? Give me the channel names.
#
### SQL:
#
# SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# what are the names of the channels that broadcast in both morning and night?
#
### SQL:
#
# SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which channels broadcast both in the morning and at night? Give me the channel names.
#
### SQL:
#
# SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# how many programs are broadcast in each time section of the day?
#
### SQL:
#
# SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Count the number of programs broadcast for each time section of a day.
#
### SQL:
#
# SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# find the number of different programs that are broadcast during night time.
#
### SQL:
#
# SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# How many distinct programs are broadcast at "Night" time?
#
### SQL:
#
# SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Find the names of programs that are never broadcasted in the morning.
#
### SQL:
#
# SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning"
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which programs are never broadcasted in the morning? Give me the names of the programs.
#
### SQL:
#
# SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning"
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# find the program owners that have some programs in both morning and night time.
#
### SQL:
#
# SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Night"
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Who are the owners of the programs that broadcast both in the morning and at night?
#
### SQL:
#
# SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Night"
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# List all program origins in the alphabetical order.
#
### SQL:
#
# SELECT origin FROM program ORDER BY origin
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What is the list of program origins ordered alphabetically?
#
### SQL:
#
# SELECT origin FROM program ORDER BY origin
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# what is the number of different channel owners?
#
### SQL:
#
# SELECT count(DISTINCT OWNER) FROM channel
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Count the number of distinct channel owners.
#
### SQL:
#
# SELECT count(DISTINCT OWNER) FROM channel
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# find the names of programs whose origin is not in Beijing.
#
### SQL:
#
# SELECT name FROM program WHERE origin != 'Beijing'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which programs' origins are not "Beijing"? Give me the program names.
#
### SQL:
#
# SELECT name FROM program WHERE origin != 'Beijing'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What are the names of the channels owned by CCTV or HBS?
#
### SQL:
#
# SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# List the names of all the channels owned by either CCTV or HBS
#
### SQL:
#
# SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Find the total rating ratio for each channel owner.
#
### SQL:
#
# SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# What is the total rating of channel for each channel owner?
#
### SQL:
#
# SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Find the name of the program that is broadcast most frequently.
#
### SQL:
#
# SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
program_share
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# program ( Program_ID, Name, Origin, Launch, Owner )
# channel ( Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent )
# broadcast ( Channel_ID, Program_ID, Time_of_day )
# broadcast_share ( Channel_ID, Program_ID, Date, Share_in_percent )
#
# broadcast.Program_ID can be joined with program.Program_ID
# broadcast.Channel_ID can be joined with channel.Channel_ID
# broadcast_share.Program_ID can be joined with program.Program_ID
# broadcast_share.Channel_ID can be joined with channel.Channel_ID
#
### Question:
#
# Which program is broadcast most frequently? Give me the program name.
#
### SQL:
#
# SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# How many courses are there in total?
#
### SQL:
#
# SELECT count(*) FROM COURSES
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the total number of courses offered.
#
### SQL:
#
# SELECT count(*) FROM COURSES
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the descriptions of the courses with name "database"?
#
### SQL:
#
# SELECT course_description FROM COURSES WHERE course_name = "database"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Return the description for the courses named "database".
#
### SQL:
#
# SELECT course_description FROM COURSES WHERE course_name = "database"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the addresses of the course authors or tutors with personal name "Cathrine"
#
### SQL:
#
# SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Return the addresses of the course authors or tutors whose personal name is "Cathrine".
#
### SQL:
#
# SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List the addresses of all the course authors or tutors.
#
### SQL:
#
# SELECT address_line_1 FROM Course_Authors_and_Tutors
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What is the address of each course author or tutor?
#
### SQL:
#
# SELECT address_line_1 FROM Course_Authors_and_Tutors
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List all the login names and family names of course author and tutors.
#
### SQL:
#
# SELECT login_name , family_name FROM Course_Authors_and_Tutors
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the login names and family names of course author and tutors?
#
### SQL:
#
# SELECT login_name , family_name FROM Course_Authors_and_Tutors
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List all the dates of enrollment and completion of students.
#
### SQL:
#
# SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are all the dates of enrollment and completion in record?
#
### SQL:
#
# SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# How many distinct students are enrolled in courses?
#
### SQL:
#
# SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the number of distinct students enrolled in courses.
#
### SQL:
#
# SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# How many distinct courses are enrolled in by students?
#
### SQL:
#
# SELECT count(course_id) FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the number of distinct courses that have enrolled students.
#
### SQL:
#
# SELECT count(course_id) FROM Student_Course_Enrolment
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the dates of the tests taken with result "Pass".
#
### SQL:
#
# SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Which tests have "Pass" results? Return the dates when the tests were taken.
#
### SQL:
#
# SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# How many tests have result "Fail"?
#
### SQL:
#
# SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Count the number of tests with "Fail" result.
#
### SQL:
#
# SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the login names of the students with family name "Ward"?
#
### SQL:
#
# SELECT login_name FROM Students WHERE family_name = "Ward"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Return the login names of the students whose family name is "Ward".
#
### SQL:
#
# SELECT login_name FROM Students WHERE family_name = "Ward"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the dates of the latest logon of the students with family name "Jaskolski" or "Langosh"?
#
### SQL:
#
# SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the latest logon date of the students whose family name is "Jaskolski" or "Langosh".
#
### SQL:
#
# SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# How many students have personal names that contain the word "son"?
#
### SQL:
#
# SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Find the number of students who have the word "son" in their personal names.
#
### SQL:
#
# SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List all the subject names.
#
### SQL:
#
# SELECT subject_name FROM SUBJECTS
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the names of all the subjects.
#
### SQL:
#
# SELECT subject_name FROM SUBJECTS
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List all the information about course authors and tutors in alphabetical order of the personal name.
#
### SQL:
#
# SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# Sort the information about course authors and tutors in alphabetical order of the personal name.
#
### SQL:
#
# SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# List the personal names and family names of all the students in alphabetical order of family name.
#
### SQL:
#
# SELECT personal_name , family_name FROM Students ORDER BY family_name
#
### End.
|
e_learning
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# Course_Authors_and_Tutors ( author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1 )
# Students ( student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name )
# Subjects ( subject_id, subject_name )
# Courses ( course_id, author_id, subject_id, course_name, course_description )
# Student_Course_Enrolment ( registration_id, student_id, course_id, date_of_enrolment, date_of_completion )
# Student_Tests_Taken ( registration_id, date_test_taken, test_result )
#
# Courses.subject_id can be joined with Subjects.subject_id
# Courses.author_id can be joined with Course_Authors_and_Tutors.author_id
# Student_Course_Enrolment.student_id can be joined with Students.student_id
# Student_Course_Enrolment.course_id can be joined with Courses.course_id
# Student_Tests_Taken.registration_id can be joined with Student_Course_Enrolment.registration_id
#
### Question:
#
# What are the personal names and family names of the students? Sort the result in alphabetical order of the family name.
#
### SQL:
#
# SELECT personal_name , family_name FROM Students ORDER BY family_name
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.