SQL
stringlengths
18
577
question
stringlengths
317
11.5k
SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;
Given the Table all star having columns as player_id has datatype text, year has datatype number, game_num has datatype number, game_id has datatype text, team_id has datatype text, league_id has datatype text, gp has datatype number, starting_pos has datatype number which has NO_PRIMARY_KEY and Given the Table appearances having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, g_all has datatype number, gs has datatype number, g_batting has datatype number, g_defense has datatype number, g_p has datatype number, g_c has datatype number, g_1b has datatype number, g_2b has datatype number, g_3b has datatype number, g_ss has datatype number, g_lf has datatype number, g_cf has datatype number, g_rf has datatype number, g_of has datatype number, g_dh has datatype number, g_ph has datatype number, g_pr has datatype number which has NO_PRIMARY_KEY and Given the Table manager award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype number which has NO_PRIMARY_KEY and Given the Table player award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype text which has NO_PRIMARY_KEY and Given the Table manager award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table player award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table batting having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table batting postseason having columns as year has datatype number, round has datatype text, player_id has datatype text, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table player college having columns as player_id has datatype text, college_id has datatype text, year has datatype number which has NO_PRIMARY_KEY and Given the Table fielding having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, pb has datatype number, wp has datatype number, sb has datatype number, cs has datatype number, zr has datatype number which has NO_PRIMARY_KEY and Given the Table fielding outfield having columns as player_id has datatype text, year has datatype number, stint has datatype number, glf has datatype number, gcf has datatype number, grf has datatype number which has NO_PRIMARY_KEY and Given the Table fielding postseason having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, round has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, tp has datatype number, pb has datatype number, sb has datatype number, cs has datatype number which has NO_PRIMARY_KEY and Given the Table hall of fame having columns as player_id has datatype text, yearid has datatype number, votedby has datatype text, ballots has datatype number, needed has datatype number, votes has datatype number, inducted has datatype text, category has datatype text, needed_note has datatype text which has NO_PRIMARY_KEY and Given the Table home game having columns as year has datatype number, league_id has datatype text, team_id has datatype text, park_id has datatype text, span_first has datatype text, span_last has datatype text, games has datatype number, openings has datatype number, attendance has datatype number which has NO_PRIMARY_KEY and Given the Table manager having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number, plyr_mgr has datatype text which has NO_PRIMARY_KEY and Given the Table manager half having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, half has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number which has NO_PRIMARY_KEY and Given the Table player having columns as player_id has datatype text, birth_year has datatype number, birth_month has datatype number, birth_day has datatype number, birth_country has datatype text, birth_state has datatype text, birth_city has datatype text, death_year has datatype number, death_month has datatype number, death_day has datatype number, death_country has datatype text, death_state has datatype text, death_city has datatype text, name_first has datatype text, name_last has datatype text, name_given has datatype text, weight has datatype number, height has datatype number, bats has datatype text, throws has datatype text, debut has datatype text, final_game has datatype text, retro_id has datatype text, bbref_id has datatype text which has NO_PRIMARY_KEY and Given the Table park having columns as park_id has datatype text, park_name has datatype text, park_alias has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table pitching having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype number, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table pitching postseason having columns as player_id has datatype text, year has datatype number, round has datatype text, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype text, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table salary having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, salary has datatype number which has NO_PRIMARY_KEY and Given the Table college having columns as college_id has datatype text, name_full has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table postseason having columns as year has datatype number, round has datatype text, team_id_winner has datatype text, league_id_winner has datatype text, team_id_loser has datatype text, league_id_loser has datatype text, wins has datatype number, losses has datatype number, ties has datatype number which has NO_PRIMARY_KEY and Given the Table team having columns as year has datatype number, league_id has datatype text, team_id has datatype text, franchise_id has datatype text, div_id has datatype text, rank has datatype number, g has datatype number, ghome has datatype number, w has datatype number, l has datatype number, div_win has datatype text, wc_win has datatype text, lg_win has datatype text, ws_win has datatype text, r has datatype number, ab has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, bb has datatype number, so has datatype number, sb has datatype number, cs has datatype number, hbp has datatype number, sf has datatype number, ra has datatype number, er has datatype number, era has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, ha has datatype number, hra has datatype number, bba has datatype number, soa has datatype number, e has datatype number, dp has datatype number, fp has datatype number, name has datatype text, park has datatype text, attendance has datatype number, bpf has datatype number, ppf has datatype number, team_id_br has datatype text, team_id_lahman45 has datatype text, team_id_retro has datatype text which has NO_PRIMARY_KEY and Given the Table team franchise having columns as franchise_id has datatype text, franchise_name has datatype text, active has datatype text, na_assoc has datatype text which has NO_PRIMARY_KEY and Given the Table team half having columns as year has datatype number, league_id has datatype text, team_id has datatype text, half has datatype number, div_id has datatype text, div_win has datatype text, rank has datatype number, g has datatype number, w has datatype number, l has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which cities have 2 to 4 parks?
SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;
Given the Table all star having columns as player_id has datatype text, year has datatype number, game_num has datatype number, game_id has datatype text, team_id has datatype text, league_id has datatype text, gp has datatype number, starting_pos has datatype number which has NO_PRIMARY_KEY and Given the Table appearances having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, g_all has datatype number, gs has datatype number, g_batting has datatype number, g_defense has datatype number, g_p has datatype number, g_c has datatype number, g_1b has datatype number, g_2b has datatype number, g_3b has datatype number, g_ss has datatype number, g_lf has datatype number, g_cf has datatype number, g_rf has datatype number, g_of has datatype number, g_dh has datatype number, g_ph has datatype number, g_pr has datatype number which has NO_PRIMARY_KEY and Given the Table manager award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype number which has NO_PRIMARY_KEY and Given the Table player award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype text which has NO_PRIMARY_KEY and Given the Table manager award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table player award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table batting having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table batting postseason having columns as year has datatype number, round has datatype text, player_id has datatype text, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table player college having columns as player_id has datatype text, college_id has datatype text, year has datatype number which has NO_PRIMARY_KEY and Given the Table fielding having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, pb has datatype number, wp has datatype number, sb has datatype number, cs has datatype number, zr has datatype number which has NO_PRIMARY_KEY and Given the Table fielding outfield having columns as player_id has datatype text, year has datatype number, stint has datatype number, glf has datatype number, gcf has datatype number, grf has datatype number which has NO_PRIMARY_KEY and Given the Table fielding postseason having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, round has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, tp has datatype number, pb has datatype number, sb has datatype number, cs has datatype number which has NO_PRIMARY_KEY and Given the Table hall of fame having columns as player_id has datatype text, yearid has datatype number, votedby has datatype text, ballots has datatype number, needed has datatype number, votes has datatype number, inducted has datatype text, category has datatype text, needed_note has datatype text which has NO_PRIMARY_KEY and Given the Table home game having columns as year has datatype number, league_id has datatype text, team_id has datatype text, park_id has datatype text, span_first has datatype text, span_last has datatype text, games has datatype number, openings has datatype number, attendance has datatype number which has NO_PRIMARY_KEY and Given the Table manager having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number, plyr_mgr has datatype text which has NO_PRIMARY_KEY and Given the Table manager half having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, half has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number which has NO_PRIMARY_KEY and Given the Table player having columns as player_id has datatype text, birth_year has datatype number, birth_month has datatype number, birth_day has datatype number, birth_country has datatype text, birth_state has datatype text, birth_city has datatype text, death_year has datatype number, death_month has datatype number, death_day has datatype number, death_country has datatype text, death_state has datatype text, death_city has datatype text, name_first has datatype text, name_last has datatype text, name_given has datatype text, weight has datatype number, height has datatype number, bats has datatype text, throws has datatype text, debut has datatype text, final_game has datatype text, retro_id has datatype text, bbref_id has datatype text which has NO_PRIMARY_KEY and Given the Table park having columns as park_id has datatype text, park_name has datatype text, park_alias has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table pitching having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype number, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table pitching postseason having columns as player_id has datatype text, year has datatype number, round has datatype text, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype text, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table salary having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, salary has datatype number which has NO_PRIMARY_KEY and Given the Table college having columns as college_id has datatype text, name_full has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table postseason having columns as year has datatype number, round has datatype text, team_id_winner has datatype text, league_id_winner has datatype text, team_id_loser has datatype text, league_id_loser has datatype text, wins has datatype number, losses has datatype number, ties has datatype number which has NO_PRIMARY_KEY and Given the Table team having columns as year has datatype number, league_id has datatype text, team_id has datatype text, franchise_id has datatype text, div_id has datatype text, rank has datatype number, g has datatype number, ghome has datatype number, w has datatype number, l has datatype number, div_win has datatype text, wc_win has datatype text, lg_win has datatype text, ws_win has datatype text, r has datatype number, ab has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, bb has datatype number, so has datatype number, sb has datatype number, cs has datatype number, hbp has datatype number, sf has datatype number, ra has datatype number, er has datatype number, era has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, ha has datatype number, hra has datatype number, bba has datatype number, soa has datatype number, e has datatype number, dp has datatype number, fp has datatype number, name has datatype text, park has datatype text, attendance has datatype number, bpf has datatype number, ppf has datatype number, team_id_br has datatype text, team_id_lahman45 has datatype text, team_id_retro has datatype text which has NO_PRIMARY_KEY and Given the Table team franchise having columns as franchise_id has datatype text, franchise_name has datatype text, active has datatype text, na_assoc has datatype text which has NO_PRIMARY_KEY and Given the Table team half having columns as year has datatype number, league_id has datatype text, team_id has datatype text, half has datatype number, div_id has datatype text, div_win has datatype text, rank has datatype number, g has datatype number, w has datatype number, l has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find all the cities that have 2 to 4 parks.
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;
Given the Table all star having columns as player_id has datatype text, year has datatype number, game_num has datatype number, game_id has datatype text, team_id has datatype text, league_id has datatype text, gp has datatype number, starting_pos has datatype number which has NO_PRIMARY_KEY and Given the Table appearances having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, g_all has datatype number, gs has datatype number, g_batting has datatype number, g_defense has datatype number, g_p has datatype number, g_c has datatype number, g_1b has datatype number, g_2b has datatype number, g_3b has datatype number, g_ss has datatype number, g_lf has datatype number, g_cf has datatype number, g_rf has datatype number, g_of has datatype number, g_dh has datatype number, g_ph has datatype number, g_pr has datatype number which has NO_PRIMARY_KEY and Given the Table manager award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype number which has NO_PRIMARY_KEY and Given the Table player award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype text which has NO_PRIMARY_KEY and Given the Table manager award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table player award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table batting having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table batting postseason having columns as year has datatype number, round has datatype text, player_id has datatype text, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table player college having columns as player_id has datatype text, college_id has datatype text, year has datatype number which has NO_PRIMARY_KEY and Given the Table fielding having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, pb has datatype number, wp has datatype number, sb has datatype number, cs has datatype number, zr has datatype number which has NO_PRIMARY_KEY and Given the Table fielding outfield having columns as player_id has datatype text, year has datatype number, stint has datatype number, glf has datatype number, gcf has datatype number, grf has datatype number which has NO_PRIMARY_KEY and Given the Table fielding postseason having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, round has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, tp has datatype number, pb has datatype number, sb has datatype number, cs has datatype number which has NO_PRIMARY_KEY and Given the Table hall of fame having columns as player_id has datatype text, yearid has datatype number, votedby has datatype text, ballots has datatype number, needed has datatype number, votes has datatype number, inducted has datatype text, category has datatype text, needed_note has datatype text which has NO_PRIMARY_KEY and Given the Table home game having columns as year has datatype number, league_id has datatype text, team_id has datatype text, park_id has datatype text, span_first has datatype text, span_last has datatype text, games has datatype number, openings has datatype number, attendance has datatype number which has NO_PRIMARY_KEY and Given the Table manager having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number, plyr_mgr has datatype text which has NO_PRIMARY_KEY and Given the Table manager half having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, half has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number which has NO_PRIMARY_KEY and Given the Table player having columns as player_id has datatype text, birth_year has datatype number, birth_month has datatype number, birth_day has datatype number, birth_country has datatype text, birth_state has datatype text, birth_city has datatype text, death_year has datatype number, death_month has datatype number, death_day has datatype number, death_country has datatype text, death_state has datatype text, death_city has datatype text, name_first has datatype text, name_last has datatype text, name_given has datatype text, weight has datatype number, height has datatype number, bats has datatype text, throws has datatype text, debut has datatype text, final_game has datatype text, retro_id has datatype text, bbref_id has datatype text which has NO_PRIMARY_KEY and Given the Table park having columns as park_id has datatype text, park_name has datatype text, park_alias has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table pitching having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype number, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table pitching postseason having columns as player_id has datatype text, year has datatype number, round has datatype text, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype text, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table salary having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, salary has datatype number which has NO_PRIMARY_KEY and Given the Table college having columns as college_id has datatype text, name_full has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table postseason having columns as year has datatype number, round has datatype text, team_id_winner has datatype text, league_id_winner has datatype text, team_id_loser has datatype text, league_id_loser has datatype text, wins has datatype number, losses has datatype number, ties has datatype number which has NO_PRIMARY_KEY and Given the Table team having columns as year has datatype number, league_id has datatype text, team_id has datatype text, franchise_id has datatype text, div_id has datatype text, rank has datatype number, g has datatype number, ghome has datatype number, w has datatype number, l has datatype number, div_win has datatype text, wc_win has datatype text, lg_win has datatype text, ws_win has datatype text, r has datatype number, ab has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, bb has datatype number, so has datatype number, sb has datatype number, cs has datatype number, hbp has datatype number, sf has datatype number, ra has datatype number, er has datatype number, era has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, ha has datatype number, hra has datatype number, bba has datatype number, soa has datatype number, e has datatype number, dp has datatype number, fp has datatype number, name has datatype text, park has datatype text, attendance has datatype number, bpf has datatype number, ppf has datatype number, team_id_br has datatype text, team_id_lahman45 has datatype text, team_id_retro has datatype text which has NO_PRIMARY_KEY and Given the Table team franchise having columns as franchise_id has datatype text, franchise_name has datatype text, active has datatype text, na_assoc has datatype text which has NO_PRIMARY_KEY and Given the Table team half having columns as year has datatype number, league_id has datatype text, team_id has datatype text, half has datatype number, div_id has datatype text, div_win has datatype text, rank has datatype number, g has datatype number, w has datatype number, l has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which park had most attendances in 2008?
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;
Given the Table all star having columns as player_id has datatype text, year has datatype number, game_num has datatype number, game_id has datatype text, team_id has datatype text, league_id has datatype text, gp has datatype number, starting_pos has datatype number which has NO_PRIMARY_KEY and Given the Table appearances having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, g_all has datatype number, gs has datatype number, g_batting has datatype number, g_defense has datatype number, g_p has datatype number, g_c has datatype number, g_1b has datatype number, g_2b has datatype number, g_3b has datatype number, g_ss has datatype number, g_lf has datatype number, g_cf has datatype number, g_rf has datatype number, g_of has datatype number, g_dh has datatype number, g_ph has datatype number, g_pr has datatype number which has NO_PRIMARY_KEY and Given the Table manager award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype number which has NO_PRIMARY_KEY and Given the Table player award having columns as player_id has datatype text, award_id has datatype text, year has datatype number, league_id has datatype text, tie has datatype text, notes has datatype text which has NO_PRIMARY_KEY and Given the Table manager award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table player award vote having columns as award_id has datatype text, year has datatype number, league_id has datatype text, player_id has datatype text, points_won has datatype number, points_max has datatype number, votes_first has datatype number which has NO_PRIMARY_KEY and Given the Table batting having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table batting postseason having columns as year has datatype number, round has datatype text, player_id has datatype text, team_id has datatype text, league_id has datatype text, g has datatype number, ab has datatype number, r has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, rbi has datatype number, sb has datatype number, cs has datatype number, bb has datatype number, so has datatype number, ibb has datatype number, hbp has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table player college having columns as player_id has datatype text, college_id has datatype text, year has datatype number which has NO_PRIMARY_KEY and Given the Table fielding having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, pb has datatype number, wp has datatype number, sb has datatype number, cs has datatype number, zr has datatype number which has NO_PRIMARY_KEY and Given the Table fielding outfield having columns as player_id has datatype text, year has datatype number, stint has datatype number, glf has datatype number, gcf has datatype number, grf has datatype number which has NO_PRIMARY_KEY and Given the Table fielding postseason having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, round has datatype text, pos has datatype text, g has datatype number, gs has datatype number, inn_outs has datatype number, po has datatype number, a has datatype number, e has datatype number, dp has datatype number, tp has datatype number, pb has datatype number, sb has datatype number, cs has datatype number which has NO_PRIMARY_KEY and Given the Table hall of fame having columns as player_id has datatype text, yearid has datatype number, votedby has datatype text, ballots has datatype number, needed has datatype number, votes has datatype number, inducted has datatype text, category has datatype text, needed_note has datatype text which has NO_PRIMARY_KEY and Given the Table home game having columns as year has datatype number, league_id has datatype text, team_id has datatype text, park_id has datatype text, span_first has datatype text, span_last has datatype text, games has datatype number, openings has datatype number, attendance has datatype number which has NO_PRIMARY_KEY and Given the Table manager having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number, plyr_mgr has datatype text which has NO_PRIMARY_KEY and Given the Table manager half having columns as player_id has datatype text, year has datatype number, team_id has datatype text, league_id has datatype text, inseason has datatype number, half has datatype number, g has datatype number, w has datatype number, l has datatype number, rank has datatype number which has NO_PRIMARY_KEY and Given the Table player having columns as player_id has datatype text, birth_year has datatype number, birth_month has datatype number, birth_day has datatype number, birth_country has datatype text, birth_state has datatype text, birth_city has datatype text, death_year has datatype number, death_month has datatype number, death_day has datatype number, death_country has datatype text, death_state has datatype text, death_city has datatype text, name_first has datatype text, name_last has datatype text, name_given has datatype text, weight has datatype number, height has datatype number, bats has datatype text, throws has datatype text, debut has datatype text, final_game has datatype text, retro_id has datatype text, bbref_id has datatype text which has NO_PRIMARY_KEY and Given the Table park having columns as park_id has datatype text, park_name has datatype text, park_alias has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table pitching having columns as player_id has datatype text, year has datatype number, stint has datatype number, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype number, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table pitching postseason having columns as player_id has datatype text, year has datatype number, round has datatype text, team_id has datatype text, league_id has datatype text, w has datatype number, l has datatype number, g has datatype number, gs has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, h has datatype number, er has datatype number, hr has datatype number, bb has datatype number, so has datatype number, baopp has datatype text, era has datatype number, ibb has datatype number, wp has datatype number, hbp has datatype number, bk has datatype number, bfp has datatype number, gf has datatype number, r has datatype number, sh has datatype number, sf has datatype number, g_idp has datatype number which has NO_PRIMARY_KEY and Given the Table salary having columns as year has datatype number, team_id has datatype text, league_id has datatype text, player_id has datatype text, salary has datatype number which has NO_PRIMARY_KEY and Given the Table college having columns as college_id has datatype text, name_full has datatype text, city has datatype text, state has datatype text, country has datatype text which has NO_PRIMARY_KEY and Given the Table postseason having columns as year has datatype number, round has datatype text, team_id_winner has datatype text, league_id_winner has datatype text, team_id_loser has datatype text, league_id_loser has datatype text, wins has datatype number, losses has datatype number, ties has datatype number which has NO_PRIMARY_KEY and Given the Table team having columns as year has datatype number, league_id has datatype text, team_id has datatype text, franchise_id has datatype text, div_id has datatype text, rank has datatype number, g has datatype number, ghome has datatype number, w has datatype number, l has datatype number, div_win has datatype text, wc_win has datatype text, lg_win has datatype text, ws_win has datatype text, r has datatype number, ab has datatype number, h has datatype number, double has datatype number, triple has datatype number, hr has datatype number, bb has datatype number, so has datatype number, sb has datatype number, cs has datatype number, hbp has datatype number, sf has datatype number, ra has datatype number, er has datatype number, era has datatype number, cg has datatype number, sho has datatype number, sv has datatype number, ipouts has datatype number, ha has datatype number, hra has datatype number, bba has datatype number, soa has datatype number, e has datatype number, dp has datatype number, fp has datatype number, name has datatype text, park has datatype text, attendance has datatype number, bpf has datatype number, ppf has datatype number, team_id_br has datatype text, team_id_lahman45 has datatype text, team_id_retro has datatype text which has NO_PRIMARY_KEY and Given the Table team franchise having columns as franchise_id has datatype text, franchise_name has datatype text, active has datatype text, na_assoc has datatype text which has NO_PRIMARY_KEY and Given the Table team half having columns as year has datatype number, league_id has datatype text, team_id has datatype text, half has datatype number, div_id has datatype text, div_win has datatype text, rank has datatype number, g has datatype number, w has datatype number, l has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which park did the most people attend in 2008?
SELECT count(*) FROM camera_lens WHERE focal_length_mm > 15
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. How many camera lenses have a focal length longer than 15 mm?
SELECT brand , name FROM camera_lens ORDER BY max_aperture DESC
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
SELECT id , color , name FROM photos
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. List the id, color scheme, and name for all the photos.
SELECT max(height) , avg(height) FROM mountain
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the maximum and average height of the mountains?
SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the average prominence of the mountains in country 'Morocco'?
SELECT name , height , prominence FROM mountain WHERE range != 'Aberdare Range'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the id and name of the photos for mountains?
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
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the id and name of the mountains that have at least 2 photos?
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
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the names of the cameras that have taken picture of the most mountains?
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'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
SELECT count(DISTINCT brand) FROM camera_lens
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. How many different kinds of lens brands are there?
SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. How many camera lenses are not used in taking any photos?
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'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
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'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. 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'
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'
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
SELECT name FROM camera_lens WHERE name LIKE "%Digital%"
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. List the camera lens names containing substring "Digital".
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(*)
Given the Table mountain having columns as id has datatype number, name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has id and Given the Table camera lens having columns as id has datatype number, brand has datatype text, name has datatype text, focal_length_mm has datatype number, max_aperture has datatype number which has id and Given the Table photos having columns as id has datatype number, camera_lens_id has datatype number, mountain_id has datatype number, color has datatype text, name has datatype text which has id. Answer the question by writing the appropriate SQL code. What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
SELECT name FROM channel WHERE OWNER != 'CCTV'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Find the names of channels that are not owned by CCTV.
SELECT name FROM channel WHERE OWNER != 'CCTV'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which channels are not owned by CCTV? Give me the channel names.
SELECT name FROM channel ORDER BY rating_in_percent DESC
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. List all channel names ordered by their rating in percent from big to small.
SELECT name FROM channel ORDER BY rating_in_percent DESC
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Give me a list of all the channel names sorted by the channel rating in descending order.
SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What is the owner of the channel that has the highest rating ratio?
SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Show me the owner of the channel with the highest rating.
SELECT count(*) FROM program
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. how many programs are there?
SELECT count(*) FROM program
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Count the number of programs.
SELECT name FROM program ORDER BY launch
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. list all the names of programs, ordering by launch time.
SELECT name FROM program ORDER BY launch
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What is the list of program names, sorted by the order of launch date?
SELECT name , origin , OWNER FROM program
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. List the name, origin and owner of each program.
SELECT name , origin , OWNER FROM program
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What are the name, origin and owner of each program?
SELECT name FROM program ORDER BY launch DESC LIMIT 1
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. find the name of the program that was launched most recently.
SELECT name FROM program ORDER BY launch DESC LIMIT 1
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which program was launched most recently? Return the program name.
SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. find the total percentage share of all channels owned by CCTV.
SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What is the total share (in percent) of all the channels owned by CCTV?
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Find the names of the channels that are broadcast in the morning.
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which channels are broadcast in the morning? Give me the channel names.
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'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. what are the names of the channels that broadcast in both morning and night?
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'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which channels broadcast both in the morning and at night? Give me the channel names.
SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. how many programs are broadcast in each time section of the day?
SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Count the number of programs broadcast for each time section of a day.
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. find the number of different programs that are broadcast during night time.
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. How many distinct programs are broadcast at "Night" time?
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"
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Find the names of programs that are never broadcasted in the morning.
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"
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which programs are never broadcasted in the morning? Give me the names of the programs.
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"
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. find the program owners that have some programs in both morning and night time.
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"
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Who are the owners of the programs that broadcast both in the morning and at night?
SELECT origin FROM program ORDER BY origin
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. List all program origins in the alphabetical order.
SELECT origin FROM program ORDER BY origin
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What is the list of program origins ordered alphabetically?
SELECT count(DISTINCT OWNER) FROM channel
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. what is the number of different channel owners?
SELECT count(DISTINCT OWNER) FROM channel
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Count the number of distinct channel owners.
SELECT name FROM program WHERE origin != 'Beijing'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. find the names of programs whose origin is not in Beijing.
SELECT name FROM program WHERE origin != 'Beijing'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which programs' origins are not "Beijing"? Give me the program names.
SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What are the names of the channels owned by CCTV or HBS?
SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. List the names of all the channels owned by either CCTV or HBS
SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Find the total rating ratio for each channel owner.
SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. What is the total rating of channel for each channel owner?
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
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Find the name of the program that is broadcast most frequently.
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
Given the Table program having columns as Program_ID has datatype number, Name has datatype text, Origin has datatype text, Launch has datatype number, Owner has datatype text which has Program_ID and Given the Table channel having columns as Channel_ID has datatype number, Name has datatype text, Owner has datatype text, Share_in_percent has datatype number, Rating_in_percent has datatype number which has Channel_ID and Given the Table broadcast having columns as Channel_ID has datatype number, Program_ID has datatype number, Time_of_day has datatype text which has Channel_ID and Given the Table broadcast share having columns as Channel_ID has datatype number, Program_ID has datatype number, Date has datatype text, Share_in_percent has datatype number which has Channel_ID. Answer the question by writing the appropriate SQL code. Which program is broadcast most frequently? Give me the program name.
SELECT count(*) FROM COURSES
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many courses are there in total?
SELECT count(*) FROM COURSES
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the total number of courses offered.
SELECT course_description FROM COURSES WHERE course_name = "database"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the descriptions of the courses with name "database"?
SELECT course_description FROM COURSES WHERE course_name = "database"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Return the description for the courses named "database".
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the addresses of the course authors or tutors with personal name "Cathrine"
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Return the addresses of the course authors or tutors whose personal name is "Cathrine".
SELECT address_line_1 FROM Course_Authors_and_Tutors
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List the addresses of all the course authors or tutors.
SELECT address_line_1 FROM Course_Authors_and_Tutors
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the address of each course author or tutor?
SELECT login_name , family_name FROM Course_Authors_and_Tutors
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all the login names and family names of course author and tutors.
SELECT login_name , family_name FROM Course_Authors_and_Tutors
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the login names and family names of course author and tutors?
SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all the dates of enrollment and completion of students.
SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are all the dates of enrollment and completion in record?
SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many distinct students are enrolled in courses?
SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of distinct students enrolled in courses.
SELECT count(course_id) FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many distinct courses are enrolled in by students?
SELECT count(course_id) FROM Student_Course_Enrolment
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of distinct courses that have enrolled students.
SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the dates of the tests taken with result "Pass".
SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which tests have "Pass" results? Return the dates when the tests were taken.
SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many tests have result "Fail"?
SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Count the number of tests with "Fail" result.
SELECT login_name FROM Students WHERE family_name = "Ward"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the login names of the students with family name "Ward"?
SELECT login_name FROM Students WHERE family_name = "Ward"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Return the login names of the students whose family name is "Ward".
SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the dates of the latest logon of the students with family name "Jaskolski" or "Langosh"?
SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the latest logon date of the students whose family name is "Jaskolski" or "Langosh".
SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students have personal names that contain the word "son"?
SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the number of students who have the word "son" in their personal names.
SELECT subject_name FROM SUBJECTS
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all the subject names.
SELECT subject_name FROM SUBJECTS
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all the subjects.
SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all the information about course authors and tutors in alphabetical order of the personal name.
SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Sort the information about course authors and tutors in alphabetical order of the personal name.
SELECT personal_name , family_name FROM Students ORDER BY family_name
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List the personal names and family names of all the students in alphabetical order of family name.
SELECT personal_name , family_name FROM Students ORDER BY family_name
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the personal names and family names of the students? Sort the result in alphabetical order of the family name.
SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List each test result and its count in descending order of count.
SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For each distinct test result, find the number of students who got the result.
SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the login name of the course author that teaches the course with name "advanced database".
SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which course author teaches the "advanced database" course? Give me his or her login name.
SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the addresses of the course authors who teach the course with name "operating system" or "data structure".
SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure"
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the addresses of the course authors who teach either "operating system" or "data structure" course.
SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1
Given the Table course authors and tutors having columns as author_id has datatype number, author_tutor_ATB has datatype text, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text, gender_mf has datatype text, address_line_1 has datatype text which has author_id and Given the Table students having columns as student_id has datatype number, date_of_registration has datatype time, date_of_latest_logon has datatype time, login_name has datatype text, password has datatype text, personal_name has datatype text, middle_name has datatype text, family_name has datatype text which has student_id and Given the Table subjects having columns as subject_id has datatype number, subject_name has datatype text which has subject_id and Given the Table courses having columns as course_id has datatype number, author_id has datatype number, subject_id has datatype number, course_name has datatype text, course_description has datatype text which has course_id and Given the Table student course enrolment having columns as registration_id has datatype number, student_id has datatype number, course_id has datatype number, date_of_enrolment has datatype time, date_of_completion has datatype time which has registration_id and Given the Table student tests taken having columns as registration_id has datatype number, date_test_taken has datatype time, test_result has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the personal name, family name, and author ID of the course author that teaches the most courses.