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 "table1_1067134_1" ( "dvd_name" text, "num_of_ep" real, "region_1" text, "region_2" text, "region_4" text );. Question: "What is the average number of episodes for the DVDs that came out in region 2 and order the results by the number of episodes limiting to the top 5.". [/INST] SELECT AVG("num_of_ep") FROM "table1_1067134_1" WHERE "region_2" IS NOT NULL GROUP BY "dvd_name" ORDER BY "num_of_ep" 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_1067134_1" ( "dvd_name" text, "num_of_ep" real, "region_1" text, "region_2" text, "region_4" text );. Question: "What is the least and maximum amount of season episodes for each region?". [/INST] SELECT "region_1", MIN("num_of_ep"), MAX("num_of_ep") FROM "table1_1067134_1" GROUP BY "region_1" UNION SELECT "region_2", MIN("num_of_ep"), MAX("num_of_ep") FROM "table1_1067134_1" GROUP BY "region_2" UNION SELECT "region_4", MIN("num_of_ep"), MAX("num_of_ep") FROM "table1_1067134_1" GROUP BY "region_4" ORDER BY "region_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_1067134_1" ( "dvd_name" text, "num_of_ep" real, "region_1" text, "region_2" text, "region_4" text );. Question: "For each unique DVD season/name that was released in region 2 on August 22, 2010, provide a count of how many episodes they have?". [/INST] SELECT "dvd_name", COUNT("num_of_ep") FROM "table1_1067134_1" WHERE "region_2"='August 22, 2010' GROUP BY "dvd_name";</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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "What is the total points, lowest point, highest point, average points for each team in 2005 season?". [/INST] SELECT "team_name", SUM("points"), MIN("points"), MAX("points"), AVG("points") FROM "career_summary" WHERE "season"='2005' GROUP BY "team_name" ORDER BY SUM("points") 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "What is the total score, average score per season, and highest and lowest score achieved by the team "DAMS", sorted by number of wins in descending order and display only top 5 seasons?". [/INST] SELECT SUM("points"), AVG("points"), MAX("points"), MIN("points"), "season" FROM "career_summary" WHERE "team_name"='DAMS' GROUP BY "season" ORDER BY "wins" 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "What was the highest number of wins a team had in 2009, and in which race did they achieve it?". [/INST] SELECT MAX("wins"), "races" FROM "career_summary" WHERE "season"='2009' GROUP BY "team_name" ORDER BY "wins" 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "What is the least number of poles achieved by each team per season, sorted in ascending order by team and then by season? Return only the top 10 results.". [/INST] SELECT "team_name", "season", MIN("poles") as MinPoles FROM "career_summary" GROUP BY "team_name", "season" ORDER BY "team_name", "season", MinPoles 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "For each team, show the series with the most points, along with the number of races and wins, but only display the top 5 teams.". [/INST] SELECT "team_name", "series", MAX("points"), "races", "wins" FROM "career_summary" GROUP BY "team_name" ORDER BY MAX("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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "poles" real, "wins" real, "points" real, "position" text );. Question: "What is the total number of points scored by the top 10 teams for each season?". [/INST] SELECT "season", "team_name", SUM("points") FROM "career_summary" WHERE "position"='10th' GROUP BY "season", "team_name" ORDER BY SUM("points") 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "What is the maximum number of races held at the same circuit on October 16, and which circuit was it?". [/INST] SELECT "circuit", COUNT("report") as RaceCount FROM "races" WHERE "date" = 'October 16' GROUP BY "circuit" ORDER BY RaceCount 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "What are the top three circuits where the race named 'Long Beach Grand Prix' has taken place most frequently, and give a count of those occurrences?". [/INST] SELECT "circuit", COUNT(*) AS "frequency" FROM "races" WHERE "race_name"='Long Beach Grand Prix' GROUP BY "circuit" ORDER BY "frequency" 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "What are the top 3 race names with the most occurrence where the circuit took place at the Nazareth Speedway, sorted by their occurrence in descending order?". [/INST] SELECT "race_name", COUNT(*) as cn FROM "races" WHERE "circuit"='Nazareth Speedway' GROUP BY "race_name" ORDER BY cn DESC LIMIT 3 <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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "Which circuit hosted the most number of races won by Newman/Haas Racing when Rick Mears had pole position, also list down the count of such races per circuit in descending order of count and limit the list to top 5 circuits?". [/INST] SELECT "circuit", COUNT("race_name") FROM "races" WHERE "winning_team"='Newman/Haas Racing' AND "pole_position"='Rick Mears' GROUP BY "circuit" ORDER BY COUNT("race_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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "What is the most occurrences of races held at the Meadowlands Sports Complex circuit, grouped by each city/location ordered by count, and give me the top 3.". [/INST] SELECT "city_location", COUNT(*) FROM "races" WHERE "circuit"='Meadowlands Sports Complex' GROUP BY "city_location" 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 "statistics" ( "religious_group" text, "population_pct" text, "growth_1991_2001" text, "sex_ratio_total" real, "literacy_pct" text, "work_participation_pct" text, "sex_ratio_rural" real, "sex_ratio_urban" real, "sex_ratio_child" real );. Question: "What is the average sex ratio (total, rural, and urban) and the maximum and minimum work participation percentage for distinct religious groups that experienced growth between 90% and 115% from 1991 to 2001, and have a literacy percentage greater than 80%, grouped by the religious group and ordered by the average sex ratio in a descending order? Limit your response to 10 records.". [/INST] SELECT "religious_group", AVG("sex_ratio_total"), AVG("sex_ratio_rural"), AVG("sex_ratio_urban"), MAX("work_participation_pct"), MIN("work_participation_pct") FROM "statistics" WHERE "growth_1991_2001" BETWEEN '90%' AND '115%' AND "literacy_pct" > '80%' GROUP BY "religious_group" ORDER BY AVG("sex_ratio_total") 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 "statistics" ( "religious_group" text, "population_pct" text, "growth_1991_2001" text, "sex_ratio_total" real, "literacy_pct" text, "work_participation_pct" text, "sex_ratio_rural" real, "sex_ratio_urban" real, "sex_ratio_child" real );. Question: "What is the lowest sex ratio among religious groups in rural areas, listed in ascending order of their population percentage?". [/INST] SELECT "religious_group", MIN("sex_ratio_rural") FROM "statistics" GROUP BY "religious_group" ORDER BY "population_pct" 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 "statistics" ( "religious_group" text, "population_pct" text, "growth_1991_2001" text, "sex_ratio_total" real, "literacy_pct" text, "work_participation_pct" text, "sex_ratio_rural" real, "sex_ratio_urban" real, "sex_ratio_child" real );. Question: "What is the lowest and the highest child sex ratio in religious groups where employment is 31.3%, group them by the level of literacy, and limit to the top 5 groups ordered by the lowest child sex ratio?". [/INST] SELECT "religious_group", MIN("sex_ratio_child"), MAX("sex_ratio_child") FROM "statistics" WHERE "work_participation_pct"='31.3%' GROUP BY "literacy_pct" ORDER BY MIN("sex_ratio_child") 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 "statistics" ( "religious_group" text, "population_pct" text, "growth_1991_2001" text, "sex_ratio_total" real, "literacy_pct" text, "work_participation_pct" text, "sex_ratio_rural" real, "sex_ratio_urban" real, "sex_ratio_child" real );. Question: "What is the average of the total sex ratio and the percentage of work participation for the top 5 religious groups with the highest percentage of population where the rural sex ratio is 953?". [/INST] SELECT AVG("sex_ratio_total"), AVG("work_participation_pct") FROM "statistics" WHERE "sex_ratio_rural"=953 GROUP BY "religious_group" ORDER BY "population_pct" 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_10715317_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "Who are the directors who has directed the least and the most number of episodes, along with the number of episodes they directed, in the top 5 seasons with the most number of viewers (in millions)?". [/INST] SELECT "directed_by", COUNT("title"), MIN("no_in_season"), MAX("no_in_season") FROM "table1_10715317_2" WHERE "no_in_season" IN (SELECT "no_in_season" FROM "table1_10715317_2" ORDER BY "u_s_viewers_millions" DESC LIMIT 5) GROUP BY "directed_by" ORDER BY COUNT("title") 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 "table1_10715317_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What are the top five episodes with the most viewers, directed by Peter Markle and written by Jerry Stahl, ordered by the number of viewers?". [/INST] SELECT "title", MAX("u_s_viewers_millions") FROM "table1_10715317_2" WHERE "directed_by"='Peter Markle' AND "written_by"='Jerry Stahl' GROUP BY "title" ORDER BY "u_s_viewers_millions" 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_10715317_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "Who are the directors and how many episodes titled "Identity Crisis" each of them have directed?". [/INST] SELECT "directed_by", COUNT("title") FROM "table1_10715317_2" WHERE "title"='\"Identity Crisis\"' GROUP BY "directed_by" ORDER BY COUNT("title") 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 "television_broadcasters" ( "year" real, "network" text, "host" text, "pre_race_analyst" text, "lap_by_lap" text, "color_commentator_s" text, "pit_reporters" text );. Question: "What is the count of different hosts who did the lap-by-lap each year, ordered by the count's descending order and limit the results to 5 records?". [/INST] SELECT "year", "host", COUNT("lap_by_lap") FROM "television_broadcasters" WHERE "year" >= 2011 GROUP BY "year", "host" ORDER BY COUNT("lap_by_lap") 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 "television_broadcasters" ( "year" real, "network" text, "host" text, "pre_race_analyst" text, "lap_by_lap" text, "color_commentator_s" text, "pit_reporters" text );. Question: "In which years and for how many times was Marty Reid both the host and the lap-by-lap broadcaster for each network?". [/INST] SELECT "year", "network", COUNT(*) FROM "television_broadcasters" WHERE "lap_by_lap"='Marty Reid' AND "host"='Marty Reid' GROUP BY "year", "network" ORDER BY "year" ASC, 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 "television_broadcasters" ( "year" real, "network" text, "host" text, "pre_race_analyst" text, "lap_by_lap" text, "color_commentator_s" text, "pit_reporters" text );. Question: "In each year, how many different pre-race analysts were involved when Allen Bestwick was doing the lap-by-lap, and show the top 5 years with the most analysts?". [/INST] SELECT "year", COUNT(DISTINCT "pre_race_analyst") AS num_of_analysts FROM "television_broadcasters" WHERE "lap_by_lap"='Allen Bestwick' GROUP BY "year" ORDER BY num_of_analysts 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_10718192_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "How many episodes are there per director in each season, and what's the highest and lowest number of viewers in millions for these episodes, sorted by viewer number in descending order and limit to 5 records for each season?". [/INST] SELECT "no_in_season", "directed_by", COUNT("title"), MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions") FROM "table1_10718192_2" GROUP BY "no_in_season", "directed_by" ORDER BY "no_in_season", MAX("u_s_viewers_millions") 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_10718192_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "Who are the directors who directed more than two episodes and what are the minimum, maximum and average viewers (in millions) for these episodes, considering only those episodes with a title containing the word 'Strike'? Order by the average viewers in descending order and limit the result to the top 3.". [/INST] SELECT "directed_by", MIN("u_s_viewers_millions") as Min_Viewers, MAX("u_s_viewers_millions") as Max_Viewers, AVG("u_s_viewers_millions") as Avg_Viewers FROM "table1_10718192_2" WHERE "title" LIKE '%Strike%' GROUP BY "directed_by" HAVING COUNT("title") > 2 ORDER BY Avg_Viewers 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_10718192_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What were the top 3 most viewed episodes written by the writer of the episode titled "One Hit Wonder", and how many viewers did they have in the USA?". [/INST] SELECT "title", "u_s_viewers_millions" FROM "table1_10718192_2" WHERE "written_by"= (SELECT "written_by" FROM "table1_10718192_2" WHERE "title"='\"One Hit Wonder\"') ORDER BY "u_s_viewers_millions" 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_10718192_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "Count the number of episodes per director for the episodes from series number 63 to 70, sorted by the count in descending order and limit it to top 5 directors.". [/INST] SELECT "directed_by", COUNT("title") AS "no_of_episodes" FROM "table1_10718192_2" WHERE "no_in_series" BETWEEN 63 AND 70 GROUP BY "directed_by" ORDER BY "no_of_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 "table1_10718525_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What were the top five episodes with the highest viewership and who were the corresponding directors?". [/INST] SELECT "title", "directed_by" FROM "table1_10718525_2" WHERE "u_s_viewers_millions"='26.53' ORDER BY "u_s_viewers_millions" 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_10718525_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What is the average number of viewers in millions, maximum and minimum number of viewers who tuned into the top 3 shows (based on number of viewers) directed by Matt Earl Beesley?". [/INST] SELECT AVG("u_s_viewers_millions"), MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions") FROM (SELECT "u_s_viewers_millions" FROM "table1_10718525_2" WHERE "directed_by"='Matt Earl Beesley' ORDER BY "u_s_viewers_millions" DESC LIMIT 3) AS sub;</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_10718631_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "How many episodes each writer has been credited for, sorted in descending order, limiting to the top 5 writers?". [/INST] SELECT "written_by", COUNT("title") as "number_of_episodes" FROM "table1_10718631_2" GROUP BY "written_by" ORDER BY COUNT("title") 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_10718631_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "How many different directors for the trilogy each directed for the 10th episode in every season, order this by the count of episodes they have directed, and limit to the top 5.". [/INST] SELECT "directed_by", COUNT("no_in_series") FROM "table1_10718631_2" WHERE "no_in_season"=10 GROUP BY "directed_by" ORDER BY COUNT("no_in_series") 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_10718631_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What is the maximum, minimum and average number of viewers in millions for each season in which the episode "Crow's Feet" was aired, ordered by the number of viewers in descending order and limited to 5 records?". [/INST] SELECT "no_in_season", MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions"), AVG("u_s_viewers_millions") FROM "table1_10718631_2" WHERE "title"='\"Crow''s Feet\"' GROUP BY "no_in_season" ORDER BY AVG("u_s_viewers_millions") 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_10718631_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "How many episodes were directed by each director, and when did their most and least viewed episode air, considering only the first 100 aired episodes?". [/INST] SELECT "directed_by", COUNT("no_in_series"), MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions") FROM "table1_10718631_2" WHERE "no_in_series"<=100 GROUP BY "directed_by" ORDER BY COUNT("no_in_series") DESC, "u_s_viewers_millions" 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 "table1_10718631_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What is the maximum number of viewers (in millions) for the episodes directed by each director with a limit of 113 episodes sorted by maximum viewers in descending order?". [/INST] SELECT "directed_by", MAX("u_s_viewers_millions") FROM "table1_10718631_2" WHERE "no_in_series"<=113 GROUP BY "directed_by" ORDER BY MAX("u_s_viewers_millions") 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 "table1_10718984_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "What is the average number in the season for episodes written by Marlene Meyer that were watched by at least 20 million viewers, sorted by original airdates in descending order, displaying only the top 10 results?". [/INST] SELECT AVG("no_in_season") FROM "table1_10718984_2" WHERE "written_by"='Marlene Meyer' AND CAST("u_s_viewers_millions" as REAL) >= 20.0 GROUP BY "original_air_date" ORDER BY "original_air_date" 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 "table1_10718984_2" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_millions" text );. Question: "Count the number of shows per director for the original air dates in the first 20 episodes in ascending order". [/INST] SELECT "directed_by", COUNT("title") FROM "table1_10718984_2" WHERE "no_in_season" BETWEEN 1 and 20 GROUP BY "directed_by" ORDER BY COUNT("title") ASC LIMIT 20;</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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "On which dates, ordered ascendingly, were there races on each circuit and what is the count of such occasions, with results limited to top 5 circuits where races were held most frequently?". [/INST] SELECT "date", COUNT("circuit") FROM "races" WHERE "circuit" IN ( SELECT "circuit" FROM "races" GROUP BY "circuit" ORDER BY COUNT(*) DESC LIMIT 5 ) GROUP BY "date", "circuit" ORDER BY "date" 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "On what dates and cities did Michael Andretti have the pole position and Galles-Kraco Racing was the winning team, sorted by city location and limited to the top 5 records?". [/INST] SELECT "date", "city_location", COUNT(*) FROM "races" WHERE "pole_position"='Michael Andretti' AND "winning_team"='Galles-Kraco Racing' GROUP BY "date", "city_location" ORDER BY "city_location" 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "How many rounds of the Bosch Spark Plug Grand Prix was each winning team victorious in, and what was the team with maximum victories?". [/INST] SELECT "winning_team", COUNT("rnd") as count_rnds FROM "races" WHERE "race_name"='Bosch Spark Plug Grand Prix' GROUP BY "winning_team" ORDER BY count_rnds 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "Count how many races have been held per circuit on a given date ordered ascending by count and providing only top 5 results.". [/INST] SELECT "circuit", COUNT("rnd") as race_count FROM "races" WHERE "date"='August 9' GROUP BY "circuit" ORDER BY race_count 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 "races" ( "rnd" text, "race_name" text, "circuit" text, "city_location" text, "date" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "What is the maximum count of races held by Michigan International Speedway in a single year ordered by year in descending order and limit the result to 5 records?". [/INST] SELECT COUNT("date"), SUBSTR("date", 7) as Year FROM "races" WHERE "circuit"='Michigan International Speedway' GROUP BY Year ORDER BY COUNT("date") 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 "record_by_conference" ( "conference" text, "num_of_bids" real, "record" text, "win_pct" text, "round_of_32" real, "sweet_sixteen" real, "elite_eight" real, "final_four" real, "championship_game" real );. Question: "What is the least and most number of bids made by each distinct conference, and order them by the most bids?". [/INST] SELECT "conference", MIN("num_of_bids"), MAX("num_of_bids") FROM "record_by_conference" GROUP BY "conference" ORDER BY COUNT("num_of_bids") 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 "record_by_conference" ( "conference" text, "num_of_bids" real, "record" text, "win_pct" text, "round_of_32" real, "sweet_sixteen" real, "elite_eight" real, "final_four" real, "championship_game" real );. Question: "What is the maximum and minimum number of bids and the average win percentage for each conference that has made it to the round of 32 more than 5 times, ordered by the number of bids and limited to the top 10?". [/INST] SELECT "conference", MAX("num_of_bids"), MIN("num_of_bids"), AVG("win_pct") FROM "record_by_conference" WHERE "round_of_32" > 5 GROUP BY "conference" ORDER BY MAX("num_of_bids") 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 "record_by_conference" ( "conference" text, "num_of_bids" real, "record" text, "win_pct" text, "round_of_32" real, "sweet_sixteen" real, "elite_eight" real, "final_four" real, "championship_game" real );. Question: "What is the maximum number of bids and corresponding win percentage for each conference when round of 32 is 0, ordered by number of bids in descending order, and display only the top 5?". [/INST] SELECT "conference", MAX("num_of_bids"), "win_pct" FROM "record_by_conference" WHERE "round_of_32"=0 GROUP BY "conference" ORDER BY MAX("num_of_bids") 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 "record_by_conference" ( "conference" text, "num_of_bids" real, "record" text, "win_pct" text, "round_of_32" real, "sweet_sixteen" real, "elite_eight" real, "final_four" real, "championship_game" real );. Question: "What is the maximum number of bids a conference has with elite eight larger than 1.0, and sort them in a descending way with a limit of 5 results?". [/INST] SELECT "conference", MAX("num_of_bids") FROM "record_by_conference" WHERE "elite_eight">1.0 GROUP BY "conference" ORDER BY MAX("num_of_bids") 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_10749143_2" ( "series_num" real, "season_num" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "production_code" text, "u_s_viewers_millions" text );. Question: "What is the average viewership in millions and how many episodes have been directed by the director who directed the episode with production code '7AFF03', also list these directors in ascending order and limit the output to top 5.". [/INST] SELECT "directed_by", AVG("u_s_viewers_millions"), COUNT(*) FROM "table1_10749143_2" WHERE "directed_by" IN (SELECT "directed_by" FROM "table1_10749143_2" WHERE "production_code"='7AFF03') GROUP BY "directed_by" ORDER BY "directed_by" 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_10749143_2" ( "series_num" real, "season_num" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "production_code" text, "u_s_viewers_millions" text );. Question: "For each director, what is the count of episodes they have directed which had more than 10 million U.S viewers, list the top 3". [/INST] SELECT "directed_by", COUNT("title") FROM "table1_10749143_2" WHERE "u_s_viewers_millions" > '10' GROUP BY "directed_by" ORDER BY COUNT("title") 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "How many pole positions and wins each team has achieved that has completed more than 6 races and finished in the top 3 positions, order the teams based on their number of wins in descending order.". [/INST] SELECT "team_name", COUNT("poles"), COUNT("wins") FROM "career_summary" WHERE "races" > 6 AND "position" IN ('1', '2', '3') GROUP BY "team_name" ORDER BY COUNT("wins") 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "What is the sum of points scored by the "Fortec Motorsport" team in the "British Formula Three" series and how many podium finishes they had in each season, sorted by season in descending order and limited to the top 5 records?". [/INST] SELECT "season", SUM("points"), COUNT("podiums") FROM "career_summary" WHERE "series"='British Formula Three' AND "team_name"='Fortec Motorsport' GROUP BY "season" ORDER BY "season" 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "What was the maximum, minimum and average number of podium finishes for teams that participated in races in 2009, where these teams had zero wins?". [/INST] SELECT MAX("podiums"), MIN("podiums"), AVG("podiums") FROM "career_summary" WHERE "season"='2009' AND "wins"=0 GROUP BY "team_name" ORDER BY AVG("podiums") 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "What is the average number of wins and the total points earned each year by "ART Grand Prix", ordered by season with limit to the top 3 seasons?". [/INST] SELECT "season", AVG("wins"), SUM("points") FROM "career_summary" WHERE "team_name"='ART Grand Prix' GROUP BY "season" ORDER BY "season" 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "List the top 5 seasons with the most wins, along with the corresponding team names and number of races, for the team that scored 9 points in a particular season. If there is a tie in the number of wins, sort the result by the number of races in a descending order.". [/INST] SELECT "season", "team_name", "races" FROM "career_summary" WHERE "team_name" = (SELECT "team_name" FROM "career_summary" WHERE "points"='9') ORDER BY "wins" DESC, "races" 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 "career_summary" ( "season" text, "series" text, "team_name" text, "races" real, "wins" real, "poles" real, "f_laps" real, "podiums" real, "points" text, "position" text );. Question: "For each season, what is the greatest number of wins and the team that achieved it in the 'Japanese Formula Three' series, and rank them in descending order of wins?". [/INST] SELECT "season", MAX("wins"), "team_name" FROM "career_summary" WHERE "series"='Japanese Formula Three' GROUP BY "season" ORDER BY MAX("wins") 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 "episodes" ( "num" real, "air_date" text, "challenge" text, "winner" text, "test_taker" text, "passed" text );. Question: "How many tests has each test taker passed, and who has passed the most tests?". [/INST] SELECT "test_taker", COUNT("num") as total_passed_tests FROM "episodes" WHERE "passed"='yes' GROUP BY "test_taker" ORDER BY total_passed_tests 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 "episodes" ( "num" real, "air_date" text, "challenge" text, "winner" text, "test_taker" text, "passed" text );. Question: "What are the TOP 5 earliest episodes by air date that had the highest number of wins?". [/INST] SELECT "num", COUNT("winner") FROM "episodes" GROUP BY "num" ORDER BY "air_date" ASC, COUNT("winner") 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 "episodes" ( "num" real, "air_date" text, "challenge" text, "winner" text, "test_taker" text, "passed" text );. Question: "Count the challenges of night driving passed by each test taker and sort in descending order, limit to 5 records". [/INST] SELECT "test_taker", COUNT("challenge") as ChallengeCount FROM "episodes" WHERE "challenge"='Night Driving' AND "passed"='yes' GROUP BY "test_taker" ORDER BY ChallengeCount 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_10798928_1" ( "year_ceremony" text, "film_title_used_in_nomination" text, "original_title" text, "director" text, "result" text );. Question: "What is the maximum number of films directed by a single director, related to the film 'Course Completed', broken down by year of ceremony?". [/INST] SELECT "year_ceremony", COUNT("film_title_used_in_nomination") AS "Number of Films" FROM "table1_10798928_1" WHERE "film_title_used_in_nomination"='Course Completed' GROUP BY "year_ceremony", "director" ORDER BY "Number of Films" 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_10798928_1" ( "year_ceremony" text, "film_title_used_in_nomination" text, "original_title" text, "director" text, "result" text );. Question: "List the number of movies directed by each director who directed 'El Nido', ordered by the number of their movies in descending order and limit the result to the top 5.". [/INST] SELECT "director", COUNT("original_title") as movie_count FROM "table1_10798928_1" WHERE "director" IN (SELECT "director" FROM "table1_10798928_1" WHERE "original_title"='El nido') GROUP BY "director" ORDER BY movie_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_10798928_1" ( "year_ceremony" text, "film_title_used_in_nomination" text, "original_title" text, "director" text, "result" text );. Question: "How many films each director, who has directed a film titled 'Dulcinea', has been nominated for in total?". [/INST] SELECT "director", COUNT("film_title_used_in_nomination") FROM "table1_10798928_1" WHERE "director" IN (SELECT "director" FROM "table1_10798928_1" WHERE "original_title"='Dulcinea') GROUP BY "director";</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" ( "village_german" text, "village_slovenian" text, "number_of_people_1991" real, "percent_of_slovenes_1991" text, "percent_of_slovenes_1951" text );. Question: "What are the top 3 slovenian villages in terms of population in 1991, that had over 65.9% of slovenes in 1951, and provide the totals for each of these villages?". [/INST] SELECT "village_slovenian", SUM("number_of_people_1991") as total_population FROM "references" WHERE "percent_of_slovenes_1951" > '65.9%' GROUP BY "village_slovenian" ORDER BY total_population 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 "references" ( "village_german" text, "village_slovenian" text, "number_of_people_1991" real, "percent_of_slovenes_1991" text, "percent_of_slovenes_1951" text );. Question: "What are the slovenian names of the top 3 villages with the highest population in 1991, which had 16.7% of slovenes?". [/INST] SELECT "village_slovenian", MAX("number_of_people_1991") AS population FROM "references" WHERE "percent_of_slovenes_1991"='16.7%' GROUP BY "village_slovenian" ORDER BY population 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 "references" ( "village_german" text, "village_slovenian" text, "number_of_people_1991" real, "percent_of_slovenes_1991" text, "percent_of_slovenes_1951" text );. Question: "What was the average population in 1991 for the top 10 villages with the highest percentage of Slovenes in 1991?". [/INST] SELECT AVG("number_of_people_1991") FROM "references" WHERE "percent_of_slovenes_1991" IN (SELECT "percent_of_slovenes_1991" FROM "references" ORDER BY CAST(REPLACE("percent_of_slovenes_1991", '%', '') AS REAL) 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" ( "village_german" text, "village_slovenian" text, "number_of_people_1991" real, "percent_of_slovenes_1991" text, "percent_of_slovenes_1951" text );. Question: "What was the average percent of Slovenes and the smallest and largest percent of Slovenes in all villages that had the same number of people as Čahorče in 1991 and sort the result ascending by the average percent?". [/INST] SELECT AVG("percent_of_slovenes_1991"), MIN("percent_of_slovenes_1991"), MAX("percent_of_slovenes_1991") FROM "references" WHERE "number_of_people_1991"=(SELECT "number_of_people_1991" FROM "references" WHERE "village_slovenian"='Čahorče') GROUP BY "number_of_people_1991" ORDER BY AVG("percent_of_slovenes_1991") 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 "references" ( "village_german" text, "village_slovenian" text, "number_of_people_1991" real, "percent_of_slovenes_1991" text, "percent_of_slovenes_1951" text );. Question: "What is the number of people in 1991 for the top 3 Slovenian villages that have the highest percentage of Slovenes in 1991, listed in descending order by population, and where the German name for one of the villages is 'St.Margarethen'?". [/INST] SELECT "village_slovenian", "number_of_people_1991" FROM "references" WHERE "village_german"='St.Margarethen' ORDER BY "percent_of_slovenes_1991" DESC,"number_of_people_1991" 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 "game_log" ( "game" real, "date" text, "team" text, "score" text, "high_points" text, "high_rebounds" text, "high_assists" text, "location_attendance" text, "record" text );. Question: "For games on December 20, find out the game with the highest scoring leader, the average points scored by the leaders, and the total number of teams that played while also limiting the results to the top 5.". [/INST] SELECT MAX("high_points"), AVG("high_points"), COUNT(DISTINCT "team") FROM "game_log" WHERE "date"='December 20' GROUP BY "team" ORDER BY "high_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 "game_log" ( "game" real, "date" text, "team" text, "score" text, "high_points" text, "high_rebounds" text, "high_assists" text, "location_attendance" text, "record" text );. Question: "What's the total attendance, the highest and lowest scores, and the average points per team for games held on December 23?". [/INST] SELECT "team", SUM("location_attendance"), MAX("score"), MIN("score"), AVG("high_points") FROM "game_log" WHERE "date"='December 23' GROUP BY "team" ORDER BY SUM("location_attendance") 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 "round_three" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "List top 3 highest pick numbers for the position 'DE' and group them by 'college'.". [/INST] SELECT "college", MAX("pick_num") FROM "round_three" WHERE "position"='DE' GROUP BY "college" ORDER BY "pick_num" 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_three" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "Find the amount of players from each unique position that went to Saint Mary's College, with the results sorted by the positions in ascending order.". [/INST] SELECT "position", COUNT("player") FROM "round_three" WHERE "college"='Saint Mary''s' GROUP BY "position" ORDER BY "position" 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_three" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players for each position were picked by Winnipeg blue bombers and what college do the most and least players come from for each position?". [/INST] SELECT "position", COUNT("player"), MAX("college"), MIN("college") FROM "round_three" WHERE "cfl_team"='Winnipeg Blue Bombers' 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_three" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players per each position from each CFL team have attended Laval college, and list them sorted by descending order based on the number of players?". [/INST] SELECT "position", "cfl_team", COUNT("player") as player_count FROM "round_three" WHERE "college"='Laval' GROUP BY "position", "cfl_team" 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_three" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "Count the number of different positions with a distinct player from the college that produced the most players for the cfl team 'Edmonton Eskimos (via Calgary)', order the count in descending order and only display the top three.". [/INST] SELECT "college", "position", COUNT(DISTINCT "player") FROM "round_three" WHERE "cfl_team"='Edmonton Eskimos (via Calgary)' GROUP BY "college", "position" ORDER BY COUNT(DISTINCT "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 "round_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players from each position did the teams pick from St. Francis Xavier College? List the teams in descending order based on the number of players.". [/INST] SELECT "cfl_team", "position", COUNT("player") FROM "round_five" WHERE "college"='St. Francis Xavier' GROUP BY "cfl_team", "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_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the name of the top 5 players from Montreal Alouettes CFl team who played the most games, grouped by their positions, and ordered by the number of games they played?". [/INST] SELECT "player", "position", COUNT(*) as games_played FROM "round_five" WHERE "cfl_team"='Montreal Alouettes' GROUP BY "player", "position" ORDER BY games_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 "round_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players did each college produce who were picked by Toronto Argonauts, sorted from highest to lowest and only showing the top 5?". [/INST] SELECT "college", COUNT("player") as players_count FROM "round_five" WHERE "cfl_team"='Toronto Argonauts' GROUP BY "college" ORDER BY players_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_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What are the top three picks with the highest number where players' position is 'CB', grouped by the 'cfl_team' and ordered by the pick number in a descending order?". [/INST] SELECT "cfl_team", MAX("pick_num") FROM "round_five" WHERE "position"='CB' GROUP BY "cfl_team" ORDER BY MAX("pick_num") 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_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What's the highest and lowest pick number of the player from each college, and how many players from New Mexico have been picked?". [/INST] SELECT "college", MAX("pick_num"), MIN("pick_num"), COUNT(*) FROM "round_five" WHERE "college"='New Mexico' GROUP BY "college";</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_five" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players from each position went to Ohio State and were selected in the round five, sorted by position count, with limit of 10 results?". [/INST] SELECT "position", COUNT("player") FROM "round_five" WHERE "college"='Ohio State' GROUP BY "position" ORDER BY COUNT("player") 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 "br_railbuses" ( "number_range" text, "builder" text, "introduced" real, "no_built" real, "region" text, "withdrawn" real );. Question: "What is the minimum and maximum value of "introduced" for each "builder" in the Departmental region, and how many railbuses were built per builder, ordering the result by the number of railbuses in descending order and limiting the result to ten records?". [/INST] SELECT "builder", MIN("introduced"), MAX("introduced"), SUM("no_built") FROM "br_railbuses" WHERE "region"='Departmental' GROUP BY "builder" ORDER BY SUM("no_built") 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 "br_railbuses" ( "number_range" text, "builder" text, "introduced" real, "no_built" real, "region" text, "withdrawn" real );. Question: "What is the smallest introduced value for each builder in each region?". [/INST] SELECT builder, region, MIN("introduced") FROM "br_railbuses" GROUP BY builder, region ORDER BY MIN("introduced") 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_four" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the maximum pick number for each CFL team that drafted an OL in 2006, sorted in descending order and limited to top 5 teams?". [/INST] SELECT "cfl_team", MAX("pick_num") FROM "round_four" WHERE "position"='OL' GROUP BY "cfl_team" ORDER BY MAX("pick_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 "round_four" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players from each unique college have been picked by the Saskatchewan Roughriders, ordered by the count in descending order, limit to the top 5?". [/INST] SELECT "college", COUNT("player") as count FROM "round_four" WHERE "cfl_team"='Saskatchewan Roughriders' GROUP BY "college" 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 "round_four" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the count of unique colleges for each position picked by the Hamilton Tiger-Cats (via Ottawa) in the 2006 Draft, and what is the most frequently picked position?". [/INST] SELECT "position", COUNT(DISTINCT "college") FROM "round_four" WHERE "cfl_team"='Hamilton Tiger-Cats (via Ottawa)' GROUP BY "position" ORDER BY COUNT("college") 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 "round_four" ( "pick_num" real, "cfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the earliest pick listed in the table for each position.". [/INST] SELECT "position", MIN("pick_num") FROM "round_four" GROUP BY "position" ORDER BY MIN("pick_num") 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_10842344_1" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "production_code" text, "u_s_viewers_millions" text );. Question: "Find the maximum, minimum and average number of viewers in millions for episodes with production code 'E4423', grouped by the director and ordered by average viewers in descending order, limiting the result to the top 3.". [/INST] SELECT "directed_by", MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions"), AVG("u_s_viewers_millions") FROM "table1_10842344_1" WHERE "production_code"='E4423' GROUP BY "directed_by" ORDER BY AVG("u_s_viewers_millions") 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_10842344_1" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "production_code" text, "u_s_viewers_millions" text );. Question: "What's the title of the first three episodes directed by the most frequent director for the seasons where U.S. viewers exceeded 14 million?". [/INST] SELECT "director", "title" FROM "table1_10842344_1" WHERE "u_s_viewers_millions">'14' AND "directed_by"= (SELECT "directed_by" FROM "table1_10842344_1" GROUP BY "directed_by" ORDER BY COUNT("directed_by") DESC LIMIT 1) ORDER BY "no_in_season" 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 "table1_10842344_1" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "production_code" text, "u_s_viewers_millions" text );. Question: "How many episodes each director has directed and order the result by director name, taking only the top 5 directors with the most episodes.". [/INST] SELECT "directed_by", COUNT("title") AS "episode_count" FROM "table1_10842344_1" GROUP BY "directed_by" ORDER BY "episode_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_10819266_8" ( "season" real, "episodes" real, "time_slot_est" text, "season_premiere" text, "season_finale" text, "tv_season" text, "rank" text, "viewers_in_millions" text );. Question: "How many episodes were there in each time slot for seasons that had their season finale on May 26, 2010 and rank the time slots in descending order based on the number of episodes, limit the results to top 3?". [/INST] SELECT "time_slot_est", COUNT("episodes") FROM "table1_10819266_8" WHERE "season_finale"='May 26, 2010' GROUP BY "time_slot_est" ORDER BY COUNT("episodes") 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_10819266_8" ( "season" real, "episodes" real, "time_slot_est" text, "season_premiere" text, "season_finale" text, "tv_season" text, "rank" text, "viewers_in_millions" text );. Question: "What seasons have the maximum, minimum and average number of episodes and also how many TV shows have their season premiere on 'September 23, 2009'? Then list the top 5 seasons based on the count of the TV shows, in descending order.". [/INST] SELECT MAX("episodes"), MIN("episodes"), AVG("episodes"), COUNT("tv_season") FROM "table1_10819266_8" WHERE "season_premiere"='September 23, 2009' GROUP BY "season" ORDER BY COUNT("tv_season") 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_10819266_8" ( "season" real, "episodes" real, "time_slot_est" text, "season_premiere" text, "season_finale" text, "tv_season" text, "rank" text, "viewers_in_millions" text );. Question: "Which seasons had the highest and lowest number of viewers for their respective season finales?". [/INST] SELECT MAX("viewers_in_millions"), MIN("viewers_in_millions"), "season" FROM "table1_10819266_8" WHERE "season_finale" IN (SELECT "season_finale" FROM "table1_10819266_8" WHERE "season"=4) GROUP BY "season" ORDER BY "season" 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 "table1_10819266_8" ( "season" real, "episodes" real, "time_slot_est" text, "season_premiere" text, "season_finale" text, "tv_season" text, "rank" text, "viewers_in_millions" text );. Question: "What is the average number of episodes per time slot for season premieres that have a rank of #21, ordered by viewers in millions?". [/INST] SELECT "time_slot_est", AVG("episodes") FROM "table1_10819266_8" WHERE "rank"='#21' GROUP BY "time_slot_est" ORDER BY "viewers_in_millions" 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 "table1_10819266_8" ( "season" real, "episodes" real, "time_slot_est" text, "season_premiere" text, "season_finale" text, "tv_season" text, "rank" text, "viewers_in_millions" text );. Question: "What are the top 5 seasons with the highest number of episodes, where 'September 26, 2007' is the season premiere and 'May 21, 2008' is the season finale?". [/INST] SELECT "tv_season", COUNT("episodes") AS total_episodes FROM "table1_10819266_8" WHERE "season_premiere"='September 26, 2007' AND "season_finale" = 'May 21, 2008' GROUP BY "tv_season" ORDER BY total_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 "table1_10818465_1" ( "model" text, "ru" real, "max_processors" text, "processor_frequency" text, "max_memory" text, "max_disk_capacity" text, "ga_date" text );. Question: "What is the highest frequency of a processor model that has a maximum memory of 256 GB, and what is the GA date of the model with the highest disk capacity, grouped by the number of maximum processors?". [/INST] SELECT MAX("processor_frequency"), "ga_date" FROM "table1_10818465_1" WHERE "max_memory"='256 GB' GROUP BY "max_processors" ORDER BY "max_disk_capacity" 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_10818465_1" ( "model" text, "ru" real, "max_processors" text, "processor_frequency" text, "max_memory" text, "max_disk_capacity" text, "ga_date" text );. Question: "What is the maximum, minimum and average Disk Capacity for all the models whose Maximum Memory is not less than that of the model 'T5120', group the data by Maximum Processors and order the results by Maximum Disk Capacity in descending order?". [/INST] SELECT "max_processors", MAX("max_disk_capacity"), MIN("max_disk_capacity"), AVG("max_disk_capacity") FROM "table1_10818465_1" WHERE "max_memory" >= (SELECT "max_memory" FROM "table1_10818465_1" WHERE "model" = 'T5120') GROUP BY "max_processors" ORDER BY MAX("max_disk_capacity") 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 "table1_10818465_1" ( "model" text, "ru" real, "max_processors" text, "processor_frequency" text, "max_memory" text, "max_disk_capacity" text, "ga_date" text );. Question: "What is the lowest ru for each model and what is the maximum processer frequency for those models with the lowest ru?". [/INST] SELECT "model", MIN("ru"), MAX("processor_frequency") FROM "table1_10818465_1" GROUP BY "model" HAVING MIN("ru") ORDER BY MIN("ru") 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 "table1_10818465_1" ( "model" text, "ru" real, "max_processors" text, "processor_frequency" text, "max_memory" text, "max_disk_capacity" text, "ga_date" text );. Question: "Which is the earliest and latest ga date for each unique max memory where models have the processor frequencies of 1.0, 1.2, or 1.4GHz? And how many such models exist?". [/INST] SELECT "max_memory", MIN("ga_date"), MAX("ga_date"), COUNT("model") FROM "table1_10818465_1" WHERE "processor_frequency" IN ('1.0GHz', '1.2GHz', '1.4GHz') GROUP BY "max_memory" ORDER BY COUNT("model") 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_10818465_1" ( "model" text, "ru" real, "max_processors" text, "processor_frequency" text, "max_memory" text, "max_disk_capacity" text, "ga_date" text );. Question: "What is the average ru, maximum processors and maximum memory of the top five models sorted by maximum disk capacity, and what are their respective ga dates?". [/INST] SELECT AVG("ru"), MAX("max_processors"), MAX("max_memory"), "ga_date" FROM "table1_10818465_1" GROUP BY "model", "ga_date" ORDER BY "max_disk_capacity" 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 "top_10_in_total_attendance" ( "league" text, "sport" text, "country" text, "season" text, "games" real, "average_attendance" real, "total_attendance" real );. Question: "What are the top three seasons with the highest average attendance for the sport played by the La Liga league, and how many games were played in those seasons?". [/INST] SELECT "season", "games", MAX("average_attendance") FROM "top_10_in_total_attendance" WHERE "league"='La Liga' GROUP BY "season" ORDER BY "average_attendance" 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 "top_10_in_total_attendance" ( "league" text, "sport" text, "country" text, "season" text, "games" real, "average_attendance" real, "total_attendance" real );. Question: "Which season had the minimum total attendance for the Premier League association football, and how many games were played during that season?". [/INST] SELECT "season", "games" FROM "top_10_in_total_attendance" WHERE "sport"='Association football' AND "league"='Premier League' AND "total_attendance"= (SELECT MIN("total_attendance") FROM "top_10_in_total_attendance" WHERE "sport"='Association football' AND "league"='Premier League') 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 "top_10_in_total_attendance" ( "league" text, "sport" text, "country" text, "season" text, "games" real, "average_attendance" real, "total_attendance" real );. Question: "What's the maximum, minimum, and average of the total attendance for each sport in the league during 2013 season, and return the results in descending order of average. Limit the results to the top 5.". [/INST] SELECT "sport", MAX("total_attendance"), MIN("total_attendance"), AVG("total_attendance") FROM "top_10_in_total_attendance" WHERE "season"='2013' GROUP BY "sport" ORDER BY AVG("total_attendance") DESC LIMIT 5;</s>