SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING count(*) >= 1
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the name and country of origin for all artists who have release at least one song of resolution above 900.
|
SELECT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING count(*) >= 1
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is the name and country of origin for each artist who has released a song with a resolution higher than 900?
|
SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the names and number of works of the three artists who have produced the most songs.
|
SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the names of the three artists who have produced the most songs, and how many works did they produce?
|
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the country of origin for the artist who made the least number of songs?
|
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What country is the artist who made the fewest songs from?
|
SELECT song_name FROM song WHERE rating < (SELECT min(rating) FROM song WHERE languages = 'english')
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the names of the songs whose rating is below the rating of all songs in English?
|
SELECT song_name FROM song WHERE rating < (SELECT min(rating) FROM song WHERE languages = 'english')
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the song names for every song whose rating is less than the minimum rating for English songs?
|
SELECT f_id FROM song WHERE resolution > (SELECT max(resolution) FROM song WHERE rating < 8)
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
|
SELECT f_id FROM song WHERE resolution > (SELECT max(resolution) FROM song WHERE rating < 8)
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is the id of every song that has a resolution higher than that of a song with a rating below 8?
|
SELECT f_id FROM song WHERE resolution > (SELECT avg(resolution) FROM song WHERE genre_is = "modern")
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
|
SELECT f_id FROM song WHERE resolution > (SELECT avg(resolution) FROM song WHERE genre_is = "modern")
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the ids of all songs that have higher resolution of the average resolution in the modern genre?
|
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "bangla" GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the top 3 artists who have the largest number of songs works whose language is Bangla.
|
SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = "bangla" GROUP BY T2.artist_name ORDER BY count(*) DESC LIMIT 3
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the top 3 artists with the largest number of songs in the language Bangla?
|
SELECT f_id , genre_is , artist_name FROM song WHERE languages = "english" ORDER BY rating
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. List the id, genre and artist name of English songs ordered by rating.
|
SELECT f_id , genre_is , artist_name FROM song WHERE languages = "english" ORDER BY rating
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is the id, genre, and name of the artist for every English song ordered by ascending rating?
|
SELECT T1.duration , T1.file_size , T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = "pop" ORDER BY T2.song_name
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. List the duration, file size and format of songs whose genre is pop, ordered by title?
|
SELECT T1.duration , T1.file_size , T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = "pop" ORDER BY T2.song_name
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What is the duration, file size, and song format for every pop song, ordered by title alphabetically?
|
SELECT DISTINCT artist_name FROM song WHERE languages = "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the names of the artists who have produced English songs but have never received rating higher than 8.
|
SELECT DISTINCT artist_name FROM song WHERE languages = "english" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 8
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the names of the different artists that have produced a song in English but have never receieved a rating higher than 8?
|
SELECT DISTINCT artist_name FROM artist WHERE country = "Bangladesh" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. Find the names of the artists who are from Bangladesh and have never received rating higher than 7.
|
SELECT DISTINCT artist_name FROM artist WHERE country = "Bangladesh" EXCEPT SELECT DISTINCT artist_name FROM song WHERE rating > 7
|
Given the Table genre having columns as g_name has datatype text, rating has datatype text, most_popular_in has datatype text which has g_name and Given the Table artist having columns as artist_name has datatype text, country has datatype text, gender has datatype text, preferred_genre has datatype text which has artist_name and Given the Table files having columns as f_id has datatype number, artist_name has datatype text, file_size has datatype text, duration has datatype text, formats has datatype text which has f_id and Given the Table song having columns as song_name has datatype text, artist_name has datatype text, country has datatype text, f_id has datatype number, genre_is has datatype text, rating has datatype number, languages has datatype text, releasedate has datatype time, resolution has datatype number which has song_name. Answer the question by writing the appropriate SQL code. What are the names of the different artists from Bangladesh who never received a rating higher than a 7?
|
SELECT T1.name_full , T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;
|
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. what is the full name and id of the college with the largest number of baseball players?
|
SELECT T1.name_full , T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.college_id ORDER BY count(*) DESC LIMIT 1;
|
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 the full name and id of the college that has the most baseball players.
|
SELECT avg(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
|
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. What is average salary of the players in the team named 'Boston Red Stockings' ?
|
SELECT avg(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
|
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. Compute the average salary of the players in the team called 'Boston Red Stockings'.
|
SELECT name_first , name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998
|
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. What are first and last names of players participating in all star game in 1998?
|
SELECT name_first , name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE YEAR = 1998
|
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. List the first and last name for players who participated in all star game in 1998.
|
SELECT T1.name_first , T1.name_last , T1.player_id , count(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 1;
|
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. What are the first name, last name and id of the player with the most all star game experiences? Also list the count.
|
SELECT T1.name_first , T1.name_last , T1.player_id , count(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 1;
|
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 player has the most all star game experiences? Give me the first name, last name and id of the player, as well as the number of times the player participated in all star game.
|
SELECT yearid , count(*) FROM hall_of_fame GROUP BY yearid;
|
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. How many players enter hall of fame each year?
|
SELECT yearid , count(*) FROM hall_of_fame GROUP BY yearid;
|
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. Count the number of players who enter hall of fame for each year.
|
SELECT YEAR , avg(attendance) FROM home_game GROUP BY YEAR;
|
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. What is the average number of attendance at home games for each year?
|
SELECT YEAR , avg(attendance) FROM home_game GROUP BY YEAR;
|
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. For each year, return the year and the average number of attendance at home games.
|
SELECT T2.team_id , T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;
|
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. In 2014, what are the id and rank of the team that has the largest average number of attendance?
|
SELECT T2.team_id , T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id WHERE T1.year = 2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;
|
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 the id and rank of the team that has the highest average attendance rate in 2014.
|
SELECT T1.name_first , T1.name_last , T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY count(*) DESC LIMIT 1;
|
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. What are the manager's first name, last name and id who won the most manager award?
|
SELECT T1.name_first , T1.name_last , T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T2.player_id ORDER BY count(*) DESC LIMIT 1;
|
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 manager won the most manager award? Give me the manager's first name, last name and id.
|
SELECT count(*) FROM park WHERE state = 'NY';
|
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. How many parks are there in the state of NY?
|
SELECT count(*) FROM park WHERE state = 'NY';
|
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. Show me the number of parks the state of NY has.
|
SELECT T1.name_first , T1.name_last , T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 3;
|
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 3 players won the most player awards? List their full name and id.
|
SELECT T1.name_first , T1.name_last , T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 3;
|
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 the first name, last name and id for the top three players won the most player awards.
|
SELECT birth_country FROM player GROUP BY birth_country ORDER BY count(*) ASC LIMIT 3;
|
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. List three countries which are the origins of the least players.
|
SELECT birth_country FROM player GROUP BY birth_country ORDER BY count(*) ASC LIMIT 3;
|
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. What are the three countries that the least players are from?
|
SELECT name_first , name_last FROM player WHERE death_year = '';
|
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 players' first name and last name who have empty death record.
|
SELECT name_first , name_last FROM player WHERE death_year = '';
|
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. What are the first name and last name of the players whose death record is empty?
|
SELECT count(*) FROM player WHERE birth_country = 'USA' AND bats = 'R';
|
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. How many players born in USA are right-handed batters? That is, have the batter value 'R'.
|
SELECT count(*) FROM player WHERE birth_country = 'USA' AND bats = 'R';
|
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. Count the number of players who were born in USA and have bats information 'R'.
|
SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University';
|
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. What is the average height of the players from the college named 'Yale University'?
|
SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University';
|
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 the average height of the players who belong to the college called 'Yale University'.
|
SELECT T1.name , T1.team_id , max(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id;
|
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. What is the highest salary among each team? List the team name, id and maximum salary.
|
SELECT T1.name , T1.team_id , max(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id;
|
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. For each team, return the team name, id and the maximum salary among the team.
|
SELECT T1.name , T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY avg(T2.salary) ASC LIMIT 1;
|
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. What are the name and id of the team offering the lowest average salary?
|
SELECT T1.name , T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id ORDER BY avg(T2.salary) ASC LIMIT 1;
|
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 team offers the lowest average salary? Give me the name and id of the team.
|
SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1961
|
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 the players' first name and last name who won award both in 1960 and in 1961.
|
SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1961
|
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 players won awards in both 1960 and 1961? Return their first names and last names.
|
SELECT name_first , name_last FROM player WHERE weight > 220 OR height < 75
|
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. List players' first name and last name who have weight greater than 220 or height shorter than 75.
|
SELECT name_first , name_last FROM player WHERE weight > 220 OR height < 75
|
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. What are the first name and last name of the players who have weight above 220 or height below 75?
|
SELECT max(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings';
|
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. List the maximum scores of the team Boston Red Stockings when the team won in postseason?
|
SELECT max(T1.wins) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings';
|
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. What are the maximum scores the team Boston Red Stockings got when the team won in postseason?
|
SELECT count(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009;
|
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. How many times did Boston Red Stockings lose in 2009 postseason?
|
SELECT count(*) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2009;
|
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. Count the number of times the team "Boston Red Stockings" lost in 2009 postseason.
|
SELECT T2.name , T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;
|
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. What are the name and id of the team with the most victories in 2008 postseason?
|
SELECT T2.name , T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;
|
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 the name and id of the team that won the most times in 2008 postseason.
|
SELECT count(*) , T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year
|
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. What is the number of wins the team Boston Red Stockings got in the postseasons each year in history?
|
SELECT count(*) , T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year
|
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. For each year, return the year and the number of times the team Boston Red Stockings won in the postseasons.
|
SELECT count(*) FROM ( SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' );
|
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. What is the total number of postseason games that team Boston Red Stockings participated in?
|
SELECT count(*) FROM ( SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' );
|
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. How many times in total did the team Boston Red Stockings participate in postseason games?
|
SELECT count(*) FROM postseason WHERE YEAR = 1885 AND ties = 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. How many games in 1885 postseason resulted in ties (that is, the value of "ties" is '1')?
|
SELECT count(*) FROM postseason WHERE YEAR = 1885 AND ties = 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. Find the number of tied games (the value of "ties" is '1') in 1885 postseason.
|
SELECT sum(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010
|
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. What is the total salary paid by team Boston Red Stockings in 2010?
|
SELECT sum(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2010
|
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. What is the total salary expenses of team Boston Red Stockings in 2010?
|
SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000
|
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. How many players were in the team Boston Red Stockings in 2000?
|
SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000
|
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. How many players did Boston Red Stockings have in 2000?
|
SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3;
|
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. List the 3 highest salaries of the players in 2001?
|
SELECT salary FROM salary WHERE YEAR = 2001 ORDER BY salary DESC LIMIT 3;
|
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. How much salary did the top 3 well-paid players get in 2001?
|
SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001
|
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. What were all the salary values of players in 2010 and 2001?
|
SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001
|
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. List all the salary values players received in 2010 and 2001.
|
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY count(*) ASC 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. In which year did the least people enter hall of fame?
|
SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY count(*) ASC 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. Find the year in which the least people enter hall of fame.
|
SELECT count(*) FROM park WHERE city = 'Atlanta';
|
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. How many parks are there in Atlanta city?
|
SELECT count(*) FROM park WHERE city = 'Atlanta';
|
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. How many parks does Atlanta city have?
|
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park';
|
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. How many games were played in park "Columbia Park" in 1907?
|
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 1907 AND T2.park_name = 'Columbia Park';
|
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. Count the number of games taken place in park "Columbia Park" in 1907.
|
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta';
|
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. How many games were played in city Atlanta in 2000?
|
SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta';
|
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 the number of games taken place in city Atlanta in 2000.
|
SELECT sum(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010;
|
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. What is the total home game attendance of team Boston Red Stockings from 2000 to 2010?
|
SELECT sum(T1.attendance) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 2000 AND 2010;
|
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. How many games in total did team Boston Red Stockings attend from 2000 to 2010?
|
SELECT sum(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990;
|
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. How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total?
|
SELECT sum(T1.salary) FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1.year BETWEEN 1985 AND 1990;
|
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. Compute the total salary that the player with first name Len and last name Barker received between 1985 to 1990.
|
SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'
|
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. List players' first name and last name who received salary from team Washington Nationals in both 2005 and 2007.
|
SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals'
|
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. What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
|
SELECT sum(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000;
|
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. How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?
|
SELECT sum(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000;
|
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. Count the total number of games the team Boston Red Stockings attended from 1990 to 2000.
|
SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;
|
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 team had the least number of attendances in home games in 1980?
|
SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;
|
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 the team that attended the least number of home games in 1980.
|
SELECT state FROM park GROUP BY state HAVING count(*) > 2;
|
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. List the names of states that have more than 2 parks.
|
SELECT state FROM park GROUP BY state HAVING count(*) > 2;
|
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 states have more than 2 parks?
|
SELECT count(*) FROM team_franchise WHERE active = 'Y';
|
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. How many team franchises are active, with active value 'Y'?
|
SELECT count(*) FROM team_franchise WHERE active = 'Y';
|
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 the number of team franchises that are active (have 'Y' as "active" information).
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.