text
stringlengths
411
1.74k
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nascar_sprint_cup_series" ( "year" real, "starts" real, "wins" real, "top_5" real, "top_10" real, "poles" real, "avg_start" text, "avg_finish" text, "winnings" text, "position" text, "team_s" text );. Question: "What was the highest and lowest number of poles among the racers who had an average finish of 19.1, and what was the average number of poles these racers obtained? Also, provide this information separately for each year and limit the result to the top five years sorted by the average number of poles in descending order.". [/INST] SELECT "year", MAX("poles") as max_poles, MIN("poles") as min_poles, AVG("poles") as average_poles FROM "nascar_sprint_cup_series" WHERE "avg_finish"='19.1' GROUP BY "year" ORDER BY average_poles DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nascar_sprint_cup_series" ( "year" real, "starts" real, "wins" real, "top_5" real, "top_10" real, "poles" real, "avg_start" text, "avg_finish" text, "winnings" text, "position" text, "team_s" text );. Question: "What's the maximum, minimum, and average number of starts by Hendrick Motorsports each year, ordered by year and limit by 5?". [/INST] SELECT "year", MAX("starts"), MIN("starts"), AVG("starts") FROM "nascar_sprint_cup_series" WHERE "team_s"='Hendrick Motorsports' GROUP BY "year" ORDER BY "year" LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_ten" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "Count the number of unique nationalities of all centre players in Florida panthers, with the condition that each nationality should have at least two players, and list them in descending order.". [/INST] SELECT "nationality", COUNT(DISTINCT "player") AS "Player_count" FROM "round_ten" WHERE "position"='Centre' AND "nhl_team"='Florida Panthers' GROUP BY "nationality" HAVING COUNT(DISTINCT "player") > 1 ORDER BY "Player_count" DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_ten" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What are the distinct positions and count of players from United States playing for the NHL team "San Jose Sharks", displayed in decreasing order?". [/INST] SELECT "position", COUNT("player") FROM "round_ten" WHERE "nhl_team"='San Jose Sharks' AND "nationality"='United States' GROUP BY "position" ORDER BY COUNT("player") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_ten" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "Count the number of players by nationality who are in the same position with Mark Polak, showing top 5 nations with the maximum numbers.". [/INST] SELECT "nationality", COUNT("player") AS number_of_players FROM "round_ten" WHERE "position"=(SELECT "position" FROM "round_ten" WHERE "player"='Mark Polak') GROUP BY "nationality" ORDER BY number_of_players DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_ten" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "For each nationality, find out the maximum, minimum and the total number of picks for players in the position of 'Centre' in each NHL team, with pick value less than 243.0, and order the results by the total number of picks in ascending order. Also, limit the result set to 10 records.". [/INST] SELECT "nationality", "nhl_team", MAX("pick"), MIN("pick"), COUNT("pick") FROM "round_ten" WHERE "position"='Centre' AND "pick"<243.0 GROUP BY "nationality", "nhl_team" ORDER BY COUNT("pick") ASC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eleven" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What are the top 5 most common college/junior/club teams that players from the St. Louis Blues come from, and how many players come from each team?". [/INST] SELECT "college_junior_club_team", COUNT("player") as player_count FROM "round_eleven" WHERE "nhl_team"='St. Louis Blues' GROUP BY "college_junior_club_team" ORDER BY player_count DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eleven" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What are the top 5 teams with the most players from TPS (Finland) sorted in descending order?". [/INST] SELECT "nhl_team", COUNT("player") as player_count FROM "round_eleven" WHERE "college_junior_club_team"='TPS (Finland)' GROUP BY "nhl_team" ORDER BY player_count DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eleven" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many unique positions have players from each college junior club team who are members of same NHL team as Doug Nolan played for". [/INST] SELECT COUNT(DISTINCT "position") FROM "round_eleven" WHERE "nhl_team"= (SELECT "nhl_team" FROM "round_eleven" WHERE "player"='Doug Nolan') GROUP BY "college_junior_club_team";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eleven" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What are the different positions of players from each club team that Per Gustafsson has played for, sorted by the count of players in descending order and limited to 5 results?". [/INST] SELECT "college_junior_club_team", "position", COUNT("player") AS player_count FROM "round_eleven" WHERE "player"='Per Gustafsson' GROUP BY "college_junior_club_team", "position" ORDER BY player_count DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eleven" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What are the total numbers of each nationality of players in the round eleven?". [/INST] SELECT "nationality", COUNT(*) as total FROM "round_eleven" GROUP BY "nationality" ORDER BY total DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "voting" ( "song" text, "mobiles" real, "northern_ireland" real, "northern_england" real, "scotland" real, "southern_england" real, "wales" real, "total" real );. Question: "What is the average number of votes cast by Southern England when Northern Ireland cast more than 3 votes, limited to the 5 songs with the highest total votes?". [/INST] SELECT AVG("southern_england") FROM "voting" WHERE "northern_ireland">3 GROUP BY "song" ORDER BY "total" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "voting" ( "song" text, "mobiles" real, "northern_ireland" real, "northern_england" real, "scotland" real, "southern_england" real, "wales" real, "total" real );. Question: "What was the lowest number of votes Scotland cast for each song and sort them in ascending order by votes, but only show the top 5?". [/INST] SELECT "song", MIN("scotland") FROM "voting" GROUP BY "song" ORDER BY MIN("scotland") ASC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "voting" ( "song" text, "mobiles" real, "northern_ireland" real, "northern_england" real, "scotland" real, "southern_england" real, "wales" real, "total" real );. Question: "What are the top 5 songs in terms of total votes in regions where Scotland cast more than 35 votes, and how many votes each of these songs received in Scotland and Southern England". [/INST] SELECT "song", "scotland", "southern_england" FROM "voting" WHERE "scotland">35 ORDER BY "total" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "voting" ( "song" text, "mobiles" real, "northern_ireland" real, "northern_england" real, "scotland" real, "southern_england" real, "wales" real, "total" real );. Question: "What was the song that received the most votes from Northern Ireland, when the total votes for the song were 35 and ordered by votes in descending order?". [/INST] SELECT "song", MAX("northern_ireland") FROM "voting" WHERE "total"=35 GROUP BY "song" ORDER BY "northern_ireland" DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "voting" ( "song" text, "mobiles" real, "northern_ireland" real, "northern_england" real, "scotland" real, "southern_england" real, "wales" real, "total" real );. Question: "What is the average and total votes cast by Wales when Northern England cast no more than 6 votes, ordered by the number of votes in descending order and display only the top 5 rows?". [/INST] SELECT AVG("wales"), SUM("wales") FROM "voting" WHERE "northern_england"<=6 GROUP BY "song" ORDER BY "wales" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nascar_nationwide_series" ( "year" real, "starts" real, "wins" real, "top_5" real, "top_10" real, "poles" real, "avg_start" text, "avg_finish" text, "winnings" text, "position" text, "team_s" text );. Question: "How many times has each team made it to the top 5 and won at least once, and what is the sum and average of these winnings? Order it by the total winnings.". [/INST] SELECT "team_s", COUNT(*), SUM("winnings"), AVG("winnings") FROM "nascar_nationwide_series" WHERE "top_5" >= 9 AND "wins" >= 1 GROUP BY "team_s" ORDER BY SUM("winnings") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_one" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many unique teams has each player, including Vadim Sharifijanov, played for, and display the top 5 players who've played for the most number of teams, ordered in descending order.". [/INST] SELECT "player", COUNT(DISTINCT "college_junior_club_team") FROM "round_one" GROUP BY "player" ORDER BY COUNT(DISTINCT "college_junior_club_team") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_one" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many players per position does the Hartford Whalers NHL team have, list them in descending order? And what is the average pick per position - list this in ascending order.". [/INST] SELECT "position", COUNT("player"), AVG("pick") FROM "round_one" WHERE "nhl_team"='Hartford Whalers' GROUP BY "position" ORDER BY COUNT("player") DESC, AVG("pick") ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_one" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What is the smallest pick for each different position played by players from the same nationality as Brett Lindros, and order it by the pick in descending order, show only top 5 records.". [/INST] SELECT "position", MIN("pick") FROM "round_one" WHERE "nationality" IN (SELECT "nationality" FROM "round_one" WHERE "player"='Brett Lindros') GROUP BY "position" ORDER BY MIN("pick") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_one" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many players per position does the college/junior/club team, Molot Perm (Russia), have, and what are the top 3 positions with the most number of players?". [/INST] SELECT "position", COUNT("player") AS "number_of_players" FROM "round_one" WHERE "college_junior_club_team"='Molot Perm (Russia)' GROUP BY "position" ORDER BY "number_of_players" DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_one" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many players of each unique nationality have been picked by the New York Islanders, ordered by the number of players in descending order and limiting to the top 5?". [/INST] SELECT "nationality", COUNT("player") FROM "round_one" WHERE "nhl_team"='New York Islanders' GROUP BY "nationality" ORDER BY COUNT("player") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1013168_3" ( "district" text, "vacator" text, "reason_for_change" text, "successor" text, "date_successor_seated" text );. Question: "Count the total number of unique successors in the Louisiana 1st district, ordered by their seating date". [/INST] SELECT COUNT(DISTINCT "successor") FROM "table1_1013168_3" WHERE "district"='Louisiana 1st' GROUP BY "date_successor_seated" ORDER BY "date_successor_seated" ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "critical_temperature_t_c_crystal_structu" ( "formula" text, "notation" text, "t_c_k" real, "no_of_cu_o_planes_in_unit_cell" real, "crystal_structure" text );. Question: "What is the average critical temperature for each number of copper oxygen planes in the unit cell of crystals with a tetragonal structure and formula bi 2 sr 2 cacu 2 o 8, sorted from highest to lowest temperature. Limit the result to only include the top 10.". [/INST] SELECT AVG("t_c_k"), "no_of_cu_o_planes_in_unit_cell" FROM "critical_temperature_t_c_crystal_structu" WHERE "crystal_structure"='Tetragonal' AND "formula"='Bi 2 Sr 2 CaCu 2 O 8' GROUP BY "no_of_cu_o_planes_in_unit_cell" ORDER BY AVG("t_c_k") DESC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "critical_temperature_t_c_crystal_structu" ( "formula" text, "notation" text, "t_c_k" real, "no_of_cu_o_planes_in_unit_cell" real, "crystal_structure" text );. Question: "What is the average, minimum, and maximum number of Cu-O planes in unit cell for the formula 'Tl 2 Ba 2 CuO 6' grouped by crystal structure?". [/INST] SELECT "crystal_structure", AVG("no_of_cu_o_planes_in_unit_cell"), MIN("no_of_cu_o_planes_in_unit_cell"), MAX("no_of_cu_o_planes_in_unit_cell") FROM "critical_temperature_t_c_crystal_structu" WHERE "formula"='Tl 2 Ba 2 CuO 6' GROUP BY "crystal_structure";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "critical_temperature_t_c_crystal_structu" ( "formula" text, "notation" text, "t_c_k" real, "no_of_cu_o_planes_in_unit_cell" real, "crystal_structure" text );. Question: "What is the average critical temperature for each crystal structure for those formulas which contain less than or equal to 3 copper-oxygen planes in their unit cells, sorted in descending order by temperature and limited to the 5 highest results?". [/INST] SELECT "crystal_structure", AVG("t_c_k") AS average_temp FROM "critical_temperature_t_c_crystal_structu" WHERE "no_of_cu_o_planes_in_unit_cell"<=3 GROUP BY "crystal_structure" ORDER BY average_temp DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "critical_temperature_t_c_crystal_structu" ( "formula" text, "notation" text, "t_c_k" real, "no_of_cu_o_planes_in_unit_cell" real, "crystal_structure" text );. Question: "What is the count of unique crystal structures per notation for the given notation 'Tl-2212' and number of copper oxygen planes in the unit cell greater than 2, and also display the maximum, minimum and average of 't_c_k' for each unique crystal structure?". [/INST] SELECT "crystal_structure", COUNT(DISTINCT "crystal_structure"), MAX("t_c_k"), MIN("t_c_k"), AVG("t_c_k") FROM "critical_temperature_t_c_crystal_structu" WHERE "notation"='Tl-2212' AND "no_of_cu_o_planes_in_unit_cell" > 2 GROUP BY "crystal_structure" ORDER BY COUNT(DISTINCT "crystal_structure") DESC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "references" ( "num" real, "city" text, "1981_census" real, "1991_census" real, "2001_census" real, "2010_est" real, "region" text );. Question: "How many unique regions exist in records for each city, and what is the average, minimum, and maximum of the 2010 estimation done in each region, sorted by the maximum estimate in descending order, and limit the results to the top 5?". [/INST] SELECT "city", COUNT(DISTINCT "region"), AVG("2010_est"), MIN("2010_est"), MAX("2010_est") FROM "references" WHERE "city"='Cremona' GROUP BY "region" ORDER BY MAX("2010_est") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "references" ( "num" real, "city" text, "1981_census" real, "1991_census" real, "2001_census" real, "2010_est" real, "region" text );. Question: "Which region has the highest average census data in 2001 for cities where the 1981 census data are more than 51092.0, and what is the top 5 highest value?". [/INST] SELECT "region", AVG("2001_census") AS average_census FROM "references" WHERE "1981_census">51092.0 GROUP BY "region" ORDER BY average_census DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "references" ( "num" real, "city" text, "1981_census" real, "1991_census" real, "2001_census" real, "2010_est" real, "region" text );. Question: "In which region is Carpi located and what's the maximum, minimum, and average 1991's census for all cities in that region, ordered by the 1991 census in ascending order, and limit the results to the top 5 cities?". [/INST] SELECT "region", MAX("1991_census"), MIN("1991_census"), AVG("1991_census") FROM "references" WHERE "region"=(SELECT "region" FROM "references" WHERE "city"='Carpi') GROUP BY "city" ORDER BY "1991_census" ASC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "references" ( "num" real, "city" text, "1981_census" real, "1991_census" real, "2001_census" real, "2010_est" real, "region" text );. Question: "What is the average (mean) of the 2001 census grouped by different regions only for the references marked as number 13, display top 5 regions in the descending order of this average?". [/INST] SELECT "region", AVG("2001_census") as Mean_Census FROM "references" WHERE "num"=13 GROUP BY "region" ORDER BY Mean_Census DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "references" ( "num" real, "city" text, "1981_census" real, "1991_census" real, "2001_census" real, "2010_est" real, "region" text );. Question: "What is the average 1981 census for each region containing the city Livorno, ordered by the census in ascending order, limiting the results to the top 5?". [/INST] SELECT "region", AVG("1981_census") FROM "references" WHERE "city"='Livorno' GROUP BY "region" ORDER BY AVG("1981_census") ASC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eight" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "List the top three positions that the NHL players picked by the team of 'Mike Loach' have, ordered by their frequency.". [/INST] SELECT "position", COUNT(*) as count FROM "round_eight" WHERE "nhl_team" = (SELECT "nhl_team" FROM "round_eight" WHERE "player"='Mike Loach') GROUP BY "position" ORDER BY count DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eight" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many players from different positions does the NHL team that has Peter Strom have and order them according to the number of players in descending order and limit the result to the top 5?". [/INST] SELECT "position", COUNT("player") AS Qty FROM "round_eight" WHERE "nhl_team" IN (SELECT "nhl_team" FROM "round_eight" WHERE "player"='Peter Strom') GROUP BY "position" ORDER BY Qty DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eight" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "How many players per position are playing for the same team as Keith Mccambridge?". [/INST] SELECT "position", COUNT("player") FROM "round_eight" WHERE "college_junior_club_team"=(SELECT "college_junior_club_team" FROM "round_eight" WHERE "player"='Keith McCambridge') GROUP BY "position";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "round_eight" ( "pick" real, "player" text, "position" text, "nationality" text, "nhl_team" text, "college_junior_club_team" text );. Question: "What is the count of players per nationality with a pick number of 193 or less, sorted by the count in descending order, and list only the top 3?". [/INST] SELECT "nationality", COUNT("player") FROM "round_eight" WHERE "pick" <= 193 GROUP BY "nationality" ORDER BY COUNT("player") DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1013168_2" ( "state_class" text, "vacator" text, "reason_for_change" text, "successor" text, "date_of_successors_formal_installation" text );. Question: "Count the number of successors per vacator that were formally installed between 1960 and 1980, ordered by the number of successors from highest to lowest with a limit of 5 entries.". [/INST] SELECT "vacator", COUNT("successor") AS "Number of Successors" FROM "table1_1013168_2" WHERE DATE("date_of_successors_formal_installation") BETWEEN '1960-01-01' AND '1980-12-31' GROUP BY "vacator" ORDER BY "Number of Successors" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1014319_1" ( "week" real, "dance_song" text, "horwood" text, "goodman" text, "dixon" text, "tonioli" text, "total" text, "result" text );. Question: "What is the maximum number of songs that received a 10 from Goodman in any given week, that were also rated by Tonioli, and what are those songs?". [/INST] SELECT "week", COUNT("dance_song") as num_songs, GROUP_CONCAT("dance_song") as songs FROM "table1_1014319_1" WHERE "goodman"='10' AND "tonioli" IS NOT NULL GROUP BY "week" ORDER BY num_songs DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1014319_1" ( "week" real, "dance_song" text, "horwood" text, "goodman" text, "dixon" text, "tonioli" text, "total" text, "result" text );. Question: "What's the average score given by Goodman to all songs with safe results which received a 7 from Horwood and what's the maximum and minimum scores given?". [/INST] SELECT AVG("goodman"), MAX("goodman"), MIN("goodman") FROM "table1_1014319_1" WHERE "horwood"='7' AND "result"='Safe' GROUP BY "total" HAVING "total"='31';</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1014319_1" ( "week" real, "dance_song" text, "horwood" text, "goodman" text, "dixon" text, "tonioli" text, "total" text, "result" text );. Question: "What was the average score given by Dixon to the song "Samba / Young Hearts Run Free" across multiple weeks, and how many times was this song in second place?". [/INST] SELECT AVG("dixon"), COUNT("dance_song") FROM "table1_1014319_1" WHERE "dance_song"='Samba / Young Hearts Run Free' AND "result"='Second place' GROUP BY "week";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_1014319_1" ( "week" real, "dance_song" text, "horwood" text, "goodman" text, "dixon" text, "tonioli" text, "total" text, "result" text );. Question: "How many unique scores did each judge give to "samba / young hearts run free" on each week where its result was in the top two places and order the results by week descending?". [/INST] SELECT "week", "horwood", COUNT(DISTINCT "goodman"), COUNT(DISTINCT "dixon"), COUNT(DISTINCT "tonioli") FROM "table1_1014319_1" WHERE ("result"='First place' OR "result"='Second place') AND "dance_song"='Samba / Young Hearts Run Free' GROUP BY "week" ORDER BY "week" DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_fleet_details" ( "class" text, "operator" text, "no_built" real, "year_built" text, "cars_per_set" real, "unit_nos" text );. Question: "How many fleet are built by each operator for each year and what is the average number of cars per set for each year, sorted by the number of fleet in descending order, but only list the top 5 result?". [/INST] SELECT "operator", "year_built", COUNT("no_built"), AVG("cars_per_set") FROM "current_fleet_details" WHERE "no_built" >= 7 GROUP BY "operator", "year_built" ORDER BY COUNT("no_built") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "How many distinct 'you_two' values do we have for each 'we_two' when the 'case_suffix' is 'loc.'?". [/INST] SELECT "we_two", COUNT(DISTINCT "you_two") FROM "nominal_morphology" WHERE "case_suffix"='loc.' GROUP BY "we_two" ORDER BY COUNT(DISTINCT "you_two") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "How many 'you_and_i' and 'you_two' combinations are there for each unique 'them_two_the_two' when 'we_two' is 'ngalbelpa' and what is the least frequently occurring 'case_suffix' associated with each of these combinations?". [/INST] SELECT "them_two_the_two", COUNT(DISTINCT "you_and_i", "you_two"), MIN("case_suffix") FROM "nominal_morphology" WHERE "we_two"='ngalbelpa' GROUP BY "them_two_the_two" ORDER BY COUNT(DISTINCT "you_and_i", "you_two") ASC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "What is the count of unique 'case_suffix' when 'them_two_the_two' is given if 'you_and_i' equals 'ngœbalngu', ordered by 'case_suffix' and limit the result to top 3?". [/INST] SELECT "case_suffix", COUNT(DISTINCT "them_two_the_two") FROM "nominal_morphology" WHERE "you_and_i"='ngœbalngu' GROUP BY "case_suffix" ORDER BY "case_suffix" LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "How many distinct case suffixes are there for each 'who_two' value when 'you_and_i' is 'ngœban', sorted in descending order of the count?". [/INST] SELECT "who_two", COUNT(DISTINCT "case_suffix") FROM "nominal_morphology" WHERE "you_and_i"='ngœban' GROUP BY "who_two" ORDER BY COUNT(DISTINCT "case_suffix") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "What are the distinct case_suffix categories associated with we_two, and how many occurrences are there of each when you two is 'ngipen', ordered by number of occurrences from lowest to highest?". [/INST] SELECT "case_suffix", COUNT("case_suffix") FROM "nominal_morphology" WHERE "you_two"='ngipen' GROUP BY "case_suffix" ORDER BY COUNT("case_suffix") ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nominal_morphology" ( "case_suffix" text, "we_two" text, "you_and_i" text, "you_two" text, "them_two_the_two" text, "who_two" text );. Question: "What is the most frequent 'who_two' value when 'you_two' is either 'ngipelngu' or 'ngipera'?". [/INST] SELECT "who_two", COUNT(*) counts FROM "nominal_morphology" WHERE "you_two" IN ('ngipelngu', 'ngipera') GROUP BY "who_two" ORDER BY counts DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_results" ( "position" real, "driver" text, "points" real, "winnings" text, "series" text );. Question: "What's the maximum, minimum, average points and total winnings of driver Mark Martin grouped by series?". [/INST] SELECT "series", MAX("points"), MIN("points"), AVG("points"), SUM("winnings") FROM "race_results" WHERE "driver"='Mark Martin' GROUP BY "series";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_results" ( "position" real, "driver" text, "points" real, "winnings" text, "series" text );. Question: "What's the maximum, minimum and average points accumulated by Rusty Wallace across different series, and how many races has he won, ordered in descending order of average points per series.". [/INST] SELECT "series", MAX("points"), MIN("points"), AVG("points"), COUNT("driver") as wins FROM "race_results" WHERE "driver"='Rusty Wallace' GROUP BY "series" ORDER BY AVG("points") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_results" ( "position" real, "driver" text, "points" real, "winnings" text, "series" text );. Question: "What's the total number of positions, their average position and total points for each series for the driver Robby Gordon, ordered by total points in descending order, limited to the top 5 series?". [/INST] SELECT "series", COUNT("position"), AVG("position"), SUM("points") FROM "race_results" WHERE "driver"='Robby Gordon' GROUP BY "series" ORDER BY SUM("points") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_results" ( "position" real, "driver" text, "points" real, "winnings" text, "series" text );. Question: "What is the maximum position and how many drivers attained this position for each series where winnings are $50,000, ordered by series?". [/INST] SELECT MAX("position"), COUNT("driver"), "series" FROM "race_results" WHERE "winnings"='$50,000' GROUP BY "series" ORDER BY "series";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many actors from each country have been nominated for the film 'Anastasiya Slutskaya', ordered by the number of nominations in descending order?". [/INST] SELECT "country", COUNT("actors_name") as "number_of_nominations" FROM "stozhary_2003_prize_winners" WHERE "film_name"='Anastasiya Slutskaya' GROUP BY "country" ORDER BY "number_of_nominations" DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "What were the different nominations for each film directed by the director of the movie Falling Up, and how many times was each of their movies nominated?". [/INST] SELECT "director", "film_name", "nomination", COUNT("nomination") FROM "stozhary_2003_prize_winners" WHERE "director"=(SELECT "director" FROM "stozhary_2003_prize_winners" WHERE "film_name"='Falling Up') GROUP BY "film_name", "nomination" ORDER BY COUNT("nomination") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many films had each director directed that had an actress nominated for best actress in a leading role in the films, the top 3 directors with the most films directed, ordered from highest to lowest?". [/INST] SELECT "director", COUNT("film_name") AS num_films FROM "stozhary_2003_prize_winners" WHERE "nomination"='Best Actress in a Leading Role' GROUP BY "director" ORDER BY num_films DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many actors were nominated for each category from each country in films directed by a specific director, order the results by the count in descending order and limit the results to 5.". [/INST] SELECT "nomination", "country", COUNT("actors_name") as number_of_nominations FROM "stozhary_2003_prize_winners" WHERE "director"='Some Director' GROUP BY "nomination", "country" ORDER BY number_of_nominations DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "Provide maximum three films, their directors and countries where Alla Sergiyko was nominated, ordered by director's name in ascending order.". [/INST] SELECT "film_name", "director", "country" FROM "stozhary_2003_prize_winners" WHERE "actors_name"='Alla Sergiyko' ORDER BY "director" ASC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_2003_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many times was each country represented in the nominations for the film '27 Stolen Kisses' and who were the nominated actors from each country, in descending order of the number of nominations?". [/INST] SELECT "country", COUNT("nomination"), GROUP_CONCAT("actors_name") FROM "stozhary_2003_prize_winners" WHERE "film_name"='27 Stolen Kisses' GROUP BY "country" ORDER BY COUNT("nomination") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_99_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "List the top 3 film names and directors for which the most number of actors from Serbia were nominated for best actor in a supporting role, and sort them by the count of nominations in descending order.". [/INST] SELECT "film_name", "director", COUNT("actors_name") as num_actors FROM "stozhary_99_prize_winners" WHERE "nomination"='Best Actor in a Supporting Role' AND "country"='Serbia' GROUP BY "film_name", "director" ORDER BY num_actors DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_99_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "List the countries and the number of nominations their actors have had, sorted alphabetically, including only those countries where Vsevolod Shilovskiy has been nominated.". [/INST] SELECT "country", COUNT("nomination") FROM "stozhary_99_prize_winners" WHERE "actors_name"='Vsevolod Shilovskiy' GROUP BY "country" ORDER BY "country" ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_99_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many different actors per nomination are related to the film 'Totalitarian Romance' and order them according to the number of actors in descending order with a limit of 3.". [/INST] SELECT "nomination", COUNT("actors_name") as num_actors FROM "stozhary_99_prize_winners" WHERE "film_name"='Totalitarian Romance' GROUP BY "nomination" ORDER BY num_actors DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_99_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many nominations did all the films from each country directed by Srdjan Dragojevic receive, and what was the most recent film?". [/INST] SELECT "country", COUNT("nomination"), MAX("film_name") FROM "stozhary_99_prize_winners" WHERE "director"='Srdjan Dragojevic' GROUP BY "country";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_99_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many actors per film from Ukraine have been nominated?". [/INST] SELECT "film_name", COUNT("actors_name") FROM "stozhary_99_prize_winners" WHERE "country"='Ukraine' GROUP BY "film_name" ORDER BY COUNT("actors_name") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many actors from each country worked on films directed by Vadim Ilyenko, sorted by the number of actors in descending order, and limit the results to the top 5?". [/INST] SELECT "country", COUNT("actors_name") FROM "stozhary_95_prize_winners" WHERE "director"='Vadim Ilyenko' GROUP BY "country" ORDER BY COUNT("actors_name") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "List the top 5 actors that Vadim Ilyenko directed and sort them by the number of nominations per country in descending order". [/INST] SELECT "actors_name", COUNT("nomination") AS "Number_of_Nominations", "country" FROM "stozhary_95_prize_winners" WHERE "director"='Vadim Ilyenko' GROUP BY "actors_name", "country" ORDER BY "Number_of_Nominations" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "Which country has the highest number of nominations for the 'Best Non-Professional Actor' category, and what is the maximum number of nominations for a single film in that category?". [/INST] SELECT "country", COUNT("nomination") as "Number_of_Nominations", MAX("film_name") FROM "stozhary_95_prize_winners" WHERE "nomination"='Best Non-Professional Actor' GROUP BY "country" ORDER BY "Number_of_Nominations" DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "For each country, what is the count of films directed by Michaylo Ilyenko where an actor won the 'Best Actor in a Supporting Role' nomination, ordered by count in descending order with a cap of 10 results?". [/INST] SELECT "country", COUNT("film_name") AS count_of_films FROM "stozhary_95_prize_winners" WHERE "director"='Michaylo Ilyenko' AND "nomination"='Best Actor in a Supporting Role' GROUP BY "country" ORDER BY count_of_films DESC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "How many films have each actor been nominated for in the 'Best Debut' category, and order them from the actor with the most nominations to the least?". [/INST] SELECT COUNT("film_name"), "actors_name" FROM "stozhary_95_prize_winners" WHERE "nomination"='Best Debut' GROUP BY "actors_name" ORDER BY COUNT("film_name") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "stozhary_95_prize_winners" ( "nomination" text, "actors_name" text, "film_name" text, "director" text, "country" text );. Question: "What were the top 5 countries where Natalia Raskokoha was nominated the most, and how many nominations she received from each of these countries?". [/INST] SELECT "country", COUNT("nomination") as nomination_count FROM "stozhary_95_prize_winners" WHERE "actors_name"='Natalia Raskokoha' GROUP BY "country" ORDER BY nomination_count DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "barnsley" ( "season" text, "division" text, "league_apps" real, "league_goals" real, "fa_cup_apps" real, "fa_cup_goals" real, "total_apps" real, "total_goals" real );. Question: "What is the highest value of total goals per season, and order them in descending order, what are the top 5 seasons?". [/INST] SELECT "season", MAX("total_goals") FROM "barnsley" GROUP BY "season" ORDER BY MAX("total_goals") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "barnsley" ( "season" text, "division" text, "league_apps" real, "league_goals" real, "fa_cup_apps" real, "fa_cup_goals" real, "total_apps" real, "total_goals" real );. Question: "What is the smallest and the highest number of FA Cup Goals for each season where FA Cup Apps is 9, ordered by season?". [/INST] SELECT "season", MIN("fa_cup_goals"), MAX("fa_cup_goals") FROM "barnsley" WHERE "fa_cup_apps"=9 GROUP BY "season" ORDER BY "season";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "barnsley" ( "season" text, "division" text, "league_apps" real, "league_goals" real, "fa_cup_apps" real, "fa_cup_goals" real, "total_apps" real, "total_goals" real );. Question: "What is the smallest number of Total Goals for each division and display top 5 divisions that had the least total goals in descending order?". [/INST] SELECT "division", MIN("total_goals") as smallest_goals FROM "barnsley" GROUP BY "division" ORDER BY smallest_goals DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_calendar_and_results" ( "round" real, "circuit" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text );. Question: "How many times did each circuit appear as the race location where Hideki Mutoh had the fastest lap, sorted by occurrence and limited to top 5?". [/INST] SELECT "circuit", COUNT(*) FROM "race_calendar_and_results" WHERE "fastest_lap"='Hideki Mutoh' GROUP BY "circuit" ORDER BY COUNT(*) DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10269427_3" ( "episode_num" real, "production_code" real, "title" text, "directed_by" text, "written_by" text, "airdate" text );. Question: "What is the average production code for each director who worked on episodes with the title "foreign exchange problem / turn about", sorted by the average in ascending order and limited to 5 records?". [/INST] SELECT "directed_by", AVG("production_code") FROM "table1_10269427_3" WHERE "title"='\"Foreign Exchange Problem / Turn About\"' GROUP BY "directed_by" ORDER BY AVG("production_code") ASC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10269427_3" ( "episode_num" real, "production_code" real, "title" text, "directed_by" text, "written_by" text, "airdate" text );. Question: "What are the top 5 most frequently written episodes and their corresponding production codes, written by the same author as the episode titled "\"The Yindianapolis 500 / Personality Problem\""?". [/INST] SELECT "title", "production_code", COUNT("written_by") FROM "table1_10269427_3" WHERE "written_by" IN (SELECT "written_by" FROM "table1_10269427_3" WHERE "title"='\"The Yindianapolis 500 / Personality Problem\"') GROUP BY "title", "production_code" ORDER BY COUNT("written_by") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10269427_3" ( "episode_num" real, "production_code" real, "title" text, "directed_by" text, "written_by" text, "airdate" text );. Question: "What is the maximum and minimum episode number directed by each director for production codes greater than or equal to 227, and display results in descending order of max episode number. Only display the top 5 results.". [/INST] SELECT "directed_by", MAX("episode_num"), MIN("episode_num") FROM "table1_10269427_3" WHERE "production_code">=227 GROUP BY "directed_by" ORDER BY MAX("episode_num") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10269427_3" ( "episode_num" real, "production_code" real, "title" text, "directed_by" text, "written_by" text, "airdate" text );. Question: "How many episodes were directed by each director for the titles written by Sib Ventress / Aydrea ten Bosch, order them by count and limit to the top 5". [/INST] SELECT "directed_by", COUNT("episode_num") FROM "table1_10269427_3" WHERE "written_by"='Sib Ventress / Aydrea ten Bosch' GROUP BY "directed_by" ORDER BY COUNT("episode_num") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10269427_3" ( "episode_num" real, "production_code" real, "title" text, "directed_by" text, "written_by" text, "airdate" text );. Question: "Count the episodes written by each writer with a production code greater than a certain value and order the result by the count in descending order, limit the output to the top 5.". [/INST] SELECT "written_by", COUNT("episode_num") AS num_episodes FROM "table1_10269427_3" WHERE "production_code" > some_value GROUP BY "written_by" ORDER BY num_episodes DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "sheffield_united" ( "season" text, "division" text, "league_apps" real, "league_goals" real, "fa_cup_apps" real, "fa_cup_goals" real, "total_apps" real, "total_goals" real );. Question: "What is the maximum and minimum number of total goals scored by Sheffield United in a season for each division, top five with the highest number of league appearances?". [/INST] SELECT "division", MAX("total_goals"), MIN("total_goals"), MAX("league_apps") FROM "sheffield_united" GROUP BY "division" ORDER BY MAX("league_apps") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "technology_overview" ( "assembly_type" text, "adhesive_type" text, "time_sec" text, "temp_c" text, "pressure" text );. Question: "What is the maximum, minimum, and average temperature used and how often each temperature is used for 'Acryl' sorted by frequency of usage in descending order?". [/INST] SELECT "temp_c", MAX("temp_c"), MIN("temp_c"), AVG("temp_c"), COUNT("temp_c") as Frequency FROM "technology_overview" WHERE "adhesive_type"='Acryl' GROUP BY "temp_c" ORDER BY Frequency DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "In which year Jim Pugh played the most matches and how many were they, and sort this information based on the number of matches.". [/INST] SELECT "year", COUNT("opponents") AS Number_of_Matches FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "partner"='Jim Pugh' GROUP BY "year" ORDER BY Number_of_Matches DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "What is the average year of Jim Pugh partnership outcomes sorted by championship and limited to top 5?". [/INST] SELECT AVG("year"), "championship", "outcome" FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "partner"='Jim Pugh' GROUP BY "championship", "outcome" ORDER BY AVG("year") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "Determine the number of different partners and opponents in matches which scored 3–6, 7–6(5), 6–3, grouped by year and sorted by partner's name.". [/INST] SELECT "partner", COUNT(DISTINCT "opponents") FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "score"='3–6, 7–6(5), 6–3' GROUP BY "year", "partner" ORDER BY "partner";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "What is the maximum and minimum year in which Jim Pugh participated, also count the number of different championships he took part in and sort the results based on the year in ascending order". [/INST] SELECT MAX("year"), MIN("year"), COUNT(DISTINCT "championship") FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "partner"='Jim Pugh' GROUP BY "year" ORDER BY "year" ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "Count the number of championships won per year in Wimbledon (2), ordered by year in descending order and present the top 5 results.". [/INST] SELECT "year", COUNT("championship") as "Number of Championships" FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "championship"='Wimbledon (2)' AND "outcome"='winner' GROUP BY "year" ORDER BY "Number of Championships" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "mixed_doubles_6_3_titles_3_runner_ups" ( "outcome" text, "year" real, "championship" text, "surface" text, "partner" text, "opponents" text, "score" text );. Question: "How many matches have been played against each opponent and what is the highest and lowest score in these matches against Gretchen Magers Kelly Jones?". [/INST] SELECT "opponents", COUNT(*), MIN("score"), MAX("score") FROM "mixed_doubles_6_3_titles_3_runner_ups" WHERE "opponents" LIKE '%Gretchen Magers Kelly Jones%' GROUP BY "opponents" ORDER BY COUNT(*) DESC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "historical" ( "begin_date" text, "end_date" text, "representative" text, "date_of_birth" text, "house_term" text, "state_served" text, "party" text, "age_years_days" text );. Question: "What is the minimum, maximum, and average number of years as a representative for all people in the 'historical' table, grouped by their party, and only considering parties which have had at least 5 representatives, ordered by the average number of years in ascending order and limiting to the top 5 results?". [/INST] SELECT "party", MIN("house_term"), MAX("house_term"), AVG("house_term"), COUNT(*) FROM "historical" GROUP BY "party" HAVING COUNT(*) >= 5 ORDER BY AVG("house_term") LIMIT 5 <complete;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "historical" ( "begin_date" text, "end_date" text, "representative" text, "date_of_birth" text, "house_term" text, "state_served" text, "party" text, "age_years_days" text );. Question: "What is the youngest and oldest age of politicians serving the same party, who were born on November 10, 1880, and have served the state in different terms? Show the results in descending order of age.". [/INST] SELECT "party", MIN("age_years_days"), MAX("age_years_days") FROM "historical" WHERE "date_of_birth"='November 10, 1880' GROUP BY "party", "house_term" ORDER BY MAX("age_years_days") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "historical" ( "begin_date" text, "end_date" text, "representative" text, "date_of_birth" text, "house_term" text, "state_served" text, "party" text, "age_years_days" text );. Question: "How many states did each party have representatives for who had their birthday on January 31, 1866, grouped by party? And which party had the maximum number of representatives?". [/INST] SELECT "party", COUNT("state_served") FROM "historical" WHERE "date_of_birth"='January 31, 1866' GROUP BY "party" ORDER BY COUNT("state_served") DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_team" ( "player" text, "current_singles_ranking" text, "current_doubles_ranking" text, "first_year_played" real, "ties_played" real, "total_w_l" text, "singles_w_l" text, "doubles_w_l" text );. Question: "How many players have the same singles W-L and what is the last played year for each one from the team where the player named Laurynas Grigelis also plays?". [/INST] SELECT COUNT("player"), MAX("first_year_played") FROM "current_team" WHERE "singles_w_l" IN (SELECT "singles_w_l" FROM "current_team" WHERE "player"='Laurynas Grigelis') GROUP BY "singles_w_l" ORDER BY "first_year_played" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_team" ( "player" text, "current_singles_ranking" text, "current_doubles_ranking" text, "first_year_played" real, "ties_played" real, "total_w_l" text, "singles_w_l" text, "doubles_w_l" text );. Question: "What is the average of first year played for players who have the same current singles ranking as that of Mantas Bugailiškis, sorted by the total number of ties they've played in descending order and limited to top 5?". [/INST] SELECT AVG("first_year_played") FROM "current_team" WHERE "current_singles_ranking" = (SELECT "current_singles_ranking" FROM "current_team" WHERE "player" = 'Mantas Bugailiškis') GROUP BY "current_singles_ranking" ORDER BY "ties_played" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "cast_of_major_productions_1954_1999" ( "character" text, "1954_broadway" text, "1955_broadcast" text, "1960_broadcast" text, "1979_broadway" text, "1990_broadway" text, "1991_broadway" text, "1998_broadway" text, "1999_broadway" text );. Question: "Who were the top 5 characters that were played by the most actors in all productions from 1954 to 1999?". [/INST] SELECT "character", COUNT("1954_broadway")+COUNT("1955_broadcast")+COUNT("1960_broadcast")+COUNT("1979_broadway")+COUNT("1990_broadway")+COUNT("1991_broadway")+COUNT("1998_broadway")+COUNT("1999_broadway") as total FROM "cast_of_major_productions_1954_1999" GROUP BY "character" ORDER BY total DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "cast_of_major_productions_1954_1999" ( "character" text, "1954_broadway" text, "1955_broadcast" text, "1960_broadcast" text, "1979_broadway" text, "1990_broadway" text, "1991_broadway" text, "1998_broadway" text, "1999_broadway" text );. Question: "What are the top 3 characters that are played by the most number of actors across all broadway broadcasts from 1954 to 1999?". [/INST] SELECT "character", COUNT(DISTINCT "1954_broadway", "1955_broadcast", "1960_broadcast", "1979_broadway", "1990_broadway", "1991_broadway", "1998_broadway","1999_broadway") as Actor_Sum FROM "cast_of_major_productions_1954_1999" GROUP BY "character" ORDER BY Actor_Sum DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "cast_of_major_productions_1954_1999" ( "character" text, "1954_broadway" text, "1955_broadcast" text, "1960_broadcast" text, "1979_broadway" text, "1990_broadway" text, "1991_broadway" text, "1998_broadway" text, "1999_broadway" text );. Question: "For each character, count the number of distinct performances from 1954 to 1999 and show the first and last actors who played the role, ordered by the character's name.". [/INST] SELECT "character", COUNT(DISTINCT "1954_broadway", "1955_broadcast", "1960_broadcast", "1979_broadway", "1990_broadway", "1991_broadway", "1998_broadway", "1999_broadway") as total_performances, MIN("1954_broadway") as first_actor, MAX("1999_broadway") as last_actor FROM "cast_of_major_productions_1954_1999" GROUP BY "character" ORDER BY "character" ASC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "cast_of_major_productions_1954_1999" ( "character" text, "1954_broadway" text, "1955_broadcast" text, "1960_broadcast" text, "1979_broadway" text, "1990_broadway" text, "1991_broadway" text, "1998_broadway" text, "1999_broadway" text );. Question: "What are the three most frequently played roles in 1990 Broadway, after Tom Halloran played a character in the 1955 broadcast?". [/INST] SELECT "character", COUNT("1990_broadway") FROM "cast_of_major_productions_1954_1999" WHERE "1955_broadcast"='Tom Halloran' GROUP BY "character" ORDER BY COUNT("1990_broadway") DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "cast_of_major_productions_1954_1999" ( "character" text, "1954_broadway" text, "1955_broadcast" text, "1960_broadcast" text, "1979_broadway" text, "1990_broadway" text, "1991_broadway" text, "1998_broadway" text, "1999_broadway" text );. Question: "How many unique characters did Drake English play across all Broadway productions?". [/INST] SELECT COUNT(DISTINCT "character") FROM "cast_of_major_productions_1954_1999" WHERE "1954_broadway"='Drake English' OR "1979_broadway"='Drake English' OR "1990_broadway"='Drake English' OR "1991_broadway"='Drake English' OR "1998_broadway"='Drake English' OR "1999_broadway"='Drake English';</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "tv_ratings" ( "year" real, "broadcast_date" text, "bbc_one_total_viewing" real, "bbc_one_rank" text, "bbc_two_total_viewing" text, "bbc_two_rank" text );. Question: "What was the date and rank when BBC One had the maximum viewing and how many dates were BBC One total viewing greater than 11616996.338225884, ordered by the broadcast dates?". [/INST] SELECT broadcast_date, bbc_one_rank FROM tv_ratings WHERE bbc_one_total_viewing=(SELECT MAX(bbc_one_total_viewing) FROM tv_ratings WHERE bbc_one_total_viewing>11616996.338225884) UNION ALL SELECT COUNT(broadcast_date) FROM tv_ratings WHERE bbc_one_total_viewing>11616996.338225884 GROUP BY broadcast_date ORDER BY broadcast_date LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "tv_ratings" ( "year" real, "broadcast_date" text, "bbc_one_total_viewing" real, "bbc_one_rank" text, "bbc_two_total_viewing" text, "bbc_two_rank" text );. Question: "What was the average total viewing for BBC One in the years it ranked 20th, and how does this compare to the year with the lowest and highest average viewing?". [/INST] SELECT AVG("bbc_one_total_viewing"), MIN("bbc_one_total_viewing"), MAX("bbc_one_total_viewing") FROM "tv_ratings" WHERE "bbc_one_rank"='20th' GROUP BY "year" ORDER BY AVG("bbc_one_total_viewing") DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "tv_ratings" ( "year" real, "broadcast_date" text, "bbc_one_total_viewing" real, "bbc_one_rank" text, "bbc_two_total_viewing" text, "bbc_two_rank" text );. Question: "What were the minimum and maximum broadcast dates where BBC two total viewing was 7,530,000 per year, ordered by year in ascending order, limit to 5 records?". [/INST] SELECT MIN("broadcast_date"), MAX("broadcast_date"), "year" FROM "tv_ratings" WHERE "bbc_two_total_viewing"='7,530,000' GROUP BY "year" ORDER BY "year" ASC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nomenclature_of_t3_ss_proteins" ( "function_genus" text, "shigella" text, "salmonella" text, "yersinia" text, "escherichia" text );. Question: "What is the total count of each 'function_genus' where 'escherichia' is 'EspD', 'salmonella' is 'SipA' and 'shigella' is 'IpaB', sorted in descending order of the count and limited to the first 10 results?". [/INST] SELECT "function_genus", COUNT("function_genus") as total_count FROM "nomenclature_of_t3_ss_proteins" WHERE "escherichia"='EspD' AND "salmonella"='SipA' AND "shigella"='IpaB' GROUP BY "function_genus" ORDER BY total_count DESC LIMIT 10;</s>