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 "1973" ( "1973_democratic_initial_primary" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "What is the total number of records having the same percentage for each unique entry where Manhattan's count is 45,901, sorted in descending order based on percentage and limited to the top 5 records?". [/INST] SELECT "pct", COUNT(*) FROM "1973" WHERE "manhattan" ='45,901' GROUP BY "pct" ORDER BY COUNT(*) DESC, "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 "1973" ( "1973_democratic_initial_primary" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "Who were the top 5 candidates in the 1973 democratic initial primary for queens by total vote percentage?". [/INST] SELECT "1973_democratic_initial_primary", "pct" FROM "1973" WHERE "queens" = '19%' 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 "1973" ( "1973_democratic_initial_primary" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "What is the total count of unique '1973_democratic_initial_primary' for each Manhattan value when the Richmond rate is 35%, ordered by count in descending order, capped to 5 results?". [/INST] SELECT "manhattan", COUNT(DISTINCT "1973_democratic_initial_primary") AS count_primary FROM "1973" WHERE "richmond_staten_is"='35%' GROUP BY "manhattan" ORDER BY count_primary 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 "1973" ( "1973_democratic_initial_primary" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "What is the sum of total votes in queens where richmond staten is equal to or below 42%? Provide results in descending order, limit to top 10 entries.". [/INST] SELECT SUM("total") FROM "1973" WHERE "richmond_staten_is"<='42%' GROUP BY "queens" ORDER BY SUM("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 "1932" ( "1932_before_recount" text, "party" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "How many parties got more than 51.0% in Brooklyn and what was their average total votes?". [/INST] SELECT "party", AVG("total") FROM "1932" WHERE CAST(REPLACE("brooklyn", '%', '') AS REAL) > 51.0 GROUP BY "party";</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 "1932" ( "1932_before_recount" text, "party" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "Rank the top 3 parties in Brooklyn with a Queens value of '16.8%', according to their total votes.". [/INST] SELECT "party", "brooklyn", SUM("total") as total_votes FROM "1932" WHERE "queens"='16.8%' GROUP BY "party" ORDER BY total_votes 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 "1932" ( "1932_before_recount" text, "party" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "What is the minimum total for each party in each borough of New York City?". [/INST] SELECT "party", "manhattan", "the_bronx", "brooklyn", "queens", "richmond_staten_is", MIN("total") FROM "1932" GROUP BY "party", "manhattan", "the_bronx", "brooklyn", "queens", "richmond_staten_is";</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 "1932" ( "1932_before_recount" text, "party" text, "manhattan" text, "the_bronx" text, "brooklyn" text, "queens" text, "richmond_staten_is" text, "total" real, "pct" text );. Question: "What is the average total for all parties where the % in Queens is above 6.8% and grouped by the party, with the highest average total shown first, limited to 5 parties.". [/INST] SELECT "party", AVG("total") FROM "1932" WHERE "queens" > '6.8%' GROUP BY "party" ORDER BY AVG("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 "kensington_lakes_activities_association" ( "team" text, "location" text, "joined" real, "conference" text, "division" text, "previous_conference" text );. Question: "Show the number of times each team in the central division and located in Livonia has previously joined this conference, sort the results in descending order and limit the results to top 3.". [/INST] SELECT "team", COUNT("joined") FROM "kensington_lakes_activities_association" WHERE "division"='Central' AND "location"='Livonia' GROUP BY "team" ORDER BY COUNT("joined") 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 "kensington_lakes_activities_association" ( "team" text, "location" text, "joined" real, "conference" text, "division" text, "previous_conference" text );. Question: "How many teams from each conference are located in Highland Township, and what's the earliest and the latest year they joined?". [/INST] SELECT "conference", COUNT("team"), MIN("joined"), MAX("joined") FROM "kensington_lakes_activities_association" WHERE "location"='Highland Township' GROUP BY "conference";</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 "kensington_lakes_activities_association" ( "team" text, "location" text, "joined" real, "conference" text, "division" text, "previous_conference" text );. Question: "How many teams are part of each conference that the 'Churchill Chargers' team has previously been part of, ordered by the count in descending technique and limit the result to the top 5?". [/INST] SELECT "previous_conference", COUNT("team") FROM "kensington_lakes_activities_association" WHERE "previous_conference" IN (SELECT "previous_conference" FROM "kensington_lakes_activities_association" WHERE "team"='Churchill Chargers') GROUP BY "previous_conference" ORDER BY COUNT("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 "table1_11111116_7" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "For each episode's title, determine the average number in the season and in the series, only for those which are written by Ken LaZebnik and order them by number in series.". [/INST] SELECT "title", AVG("no_in_season"), AVG("no_in_series") FROM "table1_11111116_7" WHERE "written_by"='Ken LaZebnik' GROUP BY "title" ORDER BY AVG("no_in_series") 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_11111116_7" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "List the directors and count of episodes they directed that exceeded 2.81 million U.S. viewers, in descending order with a limit of 10 directors.". [/INST] SELECT "directed_by", COUNT(*) AS "episode_count" FROM "table1_11111116_7" WHERE "u_s_viewers_million">'2.81' GROUP BY "directed_by" ORDER BY "episode_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 "table1_11111116_7" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What are the top five episodes with the highest number in series that had 3.02 million U.S. viewers, and who were they directed and written by?". [/INST] SELECT "title", "directed_by", "written_by", "no_in_series" FROM "table1_11111116_7" WHERE "u_s_viewers_million"='3.02' ORDER BY "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_11111116_7" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What was the maximum and minimum viewership in millions for all the episodes named "Winds of War" and who directed those episodes?". [/INST] SELECT "directed_by", MAX("u_s_viewers_million"), MIN("u_s_viewers_million") FROM "table1_11111116_7" WHERE "title"='\"Winds of War\"' GROUP BY "directed_by";</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_11111116_7" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the average number of episodes directed by each director for shows that had 2.61 million U.S. viewers, sorted in descending order, with the top 5 results?". [/INST] SELECT "directed_by", AVG("no_in_series") FROM "table1_11111116_7" WHERE "u_s_viewers_million"='2.61' GROUP BY "directed_by" ORDER BY AVG("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_11111116_8" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the average number of U.S. viewers, in millions, for the episodes directed by the same director as "Brace for Impact", ordered by least viewers to most viewers, limiting the results to the top 5?". [/INST] SELECT AVG("u_s_viewers_million") FROM "table1_11111116_8" WHERE "directed_by" IN (SELECT "directed_by" FROM "table1_11111116_8" WHERE "title"='\"Brace for Impact\"') GROUP BY "directed_by" ORDER BY AVG("u_s_viewers_million") 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_11111116_8" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What was the maximum, minimum and average number of U.S viewers (in millions) who watched the episodes directed by a certain director, and list the results in descending order of maximum viewership.". [/INST] SELECT "directed_by", MAX("u_s_viewers_million"), MIN("u_s_viewers_million"), AVG("u_s_viewers_million") FROM "table1_11111116_8" GROUP BY "directed_by" ORDER BY MAX("u_s_viewers_million") 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_11111116_8" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the maximum and minimum number of episodes per year written by each writer that were viewed by less than or equal to 2.12 million viewers, and order the results by viewer count in descending order, limit to 5.". [/INST] SELECT "written_by", COUNT("title"), MAX("no_in_season"), MIN("no_in_season") FROM "table1_11111116_8" WHERE "u_s_viewers_million"<='2.12' GROUP BY "written_by", "original_air_date" ORDER BY "u_s_viewers_million" 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_11111116_6" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the average number of viewers, in millions, per season for the episodes written by Rebecca Dameron, and sort the results by season number in descending order, showing only the top 5 seasons.". [/INST] SELECT "no_in_season", AVG("u_s_viewers_million") FROM "table1_11111116_6" WHERE "written_by"='Rebecca Dameron' GROUP BY "no_in_season" ORDER BY "no_in_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_11111116_6" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the average number of viewers across all the episodes directed by the same director, which had at least one episode that attracted 3.6 million U.S. viewers, sorted in descending order with the one with maximum average at the top?". [/INST] SELECT "directed_by", AVG("u_s_viewers_million") as avg_viewers FROM "table1_11111116_6" WHERE "directed_by" IN (SELECT DISTINCT "directed_by" FROM "table1_11111116_6" WHERE "u_s_viewers_million" = '3.6') GROUP BY "directed_by" ORDER BY avg_viewers 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_11111116_6" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the average number of viewers for episodes written by different authors, ordered by air date, and display only the top 5 in descending order?". [/INST] SELECT "written_by", AVG("u_s_viewers_million") FROM "table1_11111116_6" GROUP BY "written_by" ORDER BY "original_air_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 "table1_11111116_6" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "Which episode written by the same author as episode 79 aired the most number of times, including the series number and number in the season?". [/INST] SELECT "title", "no_in_series", "no_in_season", COUNT("original_air_date") FROM "table1_11111116_6" WHERE "written_by" = (SELECT "written_by" FROM "table1_11111116_6" WHERE "no_in_series"=79) GROUP BY "title", "no_in_series", "no_in_season" ORDER BY COUNT("original_air_date") 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_11111116_6" ( "no_in_season" real, "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What was the average number of millions of views across all episodes directed by the same director as "Line of Departure", sorted by director and limited to the top 5?". [/INST] SELECT AVG("u_s_viewers_million"), "directed_by" FROM "table1_11111116_6" WHERE "directed_by" IN (SELECT "directed_by" FROM "table1_11111116_6" WHERE "title"='\"Line of Departure\"') GROUP BY "directed_by" ORDER BY AVG("u_s_viewers_million") 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_11148572_1" ( "season" real, "mls_cup_winner" text, "mls_cup_runner_up" text, "mls_supporters_shield_winner" text, "mls_supporters_shield_runner_up" text );. Question: "What is the number of times each shield runner up won when the mls cup runner up was 'Colorado Rapids' and then sort the results by the count in descending order?". [/INST] SELECT "mls_supporters_shield_runner_up", COUNT("mls_supporters_shield_winner") FROM "table1_11148572_1" WHERE "mls_cup_runner_up"='Colorado Rapids' GROUP BY "mls_supporters_shield_runner_up" ORDER BY COUNT("mls_supporters_shield_winner") 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_11148572_1" ( "season" real, "mls_cup_winner" text, "mls_cup_runner_up" text, "mls_supporters_shield_winner" text, "mls_supporters_shield_runner_up" text );. Question: "In which seasons has the same team 'Chivas USA' won the MLS Cup and finished as the runner-up in the Supporter's Shield competition the maximum number of times?". [/INST] SELECT "season", COUNT(*) as frequency FROM "table1_11148572_1" WHERE "mls_cup_winner"='Chivas USA' AND "mls_supporters_shield_runner_up"='Chivas USA' GROUP BY "season" ORDER BY frequency 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_11148572_1" ( "season" real, "mls_cup_winner" text, "mls_cup_runner_up" text, "mls_supporters_shield_winner" text, "mls_supporters_shield_runner_up" text );. Question: "How many times has each team been the shield runner up when the shield winner was the same team as the mls cup winner and the mls cup runner up was Real Salt Lake, sorted in descending order?". [/INST] SELECT "mls_supporters_shield_runner_up", COUNT("mls_supporters_shield_runner_up") FROM "table1_11148572_1" WHERE "mls_cup_winner" = "mls_supporters_shield_winner" AND "mls_cup_runner_up"='Real Salt Lake' GROUP BY "mls_supporters_shield_runner_up" ORDER BY COUNT("mls_supporters_shield_runner_up") 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_11148572_1" ( "season" real, "mls_cup_winner" text, "mls_cup_runner_up" text, "mls_supporters_shield_winner" text, "mls_supporters_shield_runner_up" text );. Question: "How many seasons the "mls_cup_runner_up" had been the "mls_supporters_shield_winner" for each team, considering only the seasons until 2000, and order it by the number of seasons in descending order, showing only the top 5.". [/INST] SELECT "mls_cup_runner_up", COUNT("season") AS "number_of_seasons" FROM "table1_11148572_1" WHERE "mls_cup_runner_up" = "mls_supporters_shield_winner" AND "season" <= 2000 GROUP BY "mls_cup_runner_up" ORDER BY "number_of_seasons" 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_career" ( "season" text, "division" text, "league_apps_sub" real, "league_goals" real, "fa_cup_apps_sub" text, "fa_cup_goals" real, "fl_cup_apps_sub" real, "fl_cup_goals" real, "other_apps" real, "other_goals" real, "total_apps_sub" text, "total_goals" real );. Question: "In which season Sheffield United has the maximum league apps (sub) and how many were there? Can you also tell me the minimum and average league apps (sub) across all seasons, sorted in descending order of league apps (sub) with a maximum of 5 records?". [/INST] SELECT season, MAX("league_apps_sub"), MIN("league_apps_sub"), AVG("league_apps_sub") FROM "sheffield_united_career" GROUP BY season ORDER BY MAX("league_apps_sub") 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_career" ( "season" text, "division" text, "league_apps_sub" real, "league_goals" real, "fa_cup_apps_sub" text, "fa_cup_goals" real, "fl_cup_apps_sub" real, "fl_cup_goals" real, "other_apps" real, "other_goals" real, "total_apps_sub" text, "total_goals" real );. Question: "What is the average number of league apps (sub) for each division when total goals is 11 or more, order them by average league apps (sub) in descending order and limit the result to top 5 divisions.". [/INST] SELECT "division", AVG("league_apps_sub") AS average_apps_sub FROM "sheffield_united_career" WHERE "total_goals" >=11 GROUP BY "division" ORDER BY average_apps_sub 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 "regional_auditions" ( "episode_air_date" text, "audition_city" text, "date" text, "first_audition_venue" text, "callback_date" text, "callback_venue" text, "golden_tickets" real );. Question: "In which five cities with the highest amounts of golden tickets, the Charleston Area Convention Center was noted as the callback venue, ordered in descending order of the total golden tickets given?". [/INST] SELECT "audition_city", SUM("golden_tickets") as total_golden_tickets FROM "regional_auditions" WHERE "callback_venue"='Charleston Area Convention Center' GROUP BY "audition_city" ORDER BY total_golden_tickets 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 "regional_auditions" ( "episode_air_date" text, "audition_city" text, "date" text, "first_audition_venue" text, "callback_date" text, "callback_venue" text, "golden_tickets" real );. Question: "How many golden tickets were given on each air date of the callbacks at Rancho Bernardo Inn, ordered by the air date?". [/INST] SELECT "episode_air_date", SUM("golden_tickets") FROM "regional_auditions" WHERE "callback_venue"='Rancho Bernardo Inn' GROUP BY "episode_air_date" ORDER BY "episode_air_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 "table1_11147852_1" ( "city_of_license_market" text, "station" text, "channel_tv_dt" text, "year_of_affiliation" text, "owned_since" text );. Question: "How many stations have existed in Albuquerque per year, ordered by year of affiliation?". [/INST] SELECT "year_of_affiliation", COUNT("station") FROM "table1_11147852_1" WHERE "city_of_license_market"='Albuquerque' GROUP BY "year_of_affiliation" ORDER BY "year_of_affiliation" 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 "table1_11147852_1" ( "city_of_license_market" text, "station" text, "channel_tv_dt" text, "year_of_affiliation" text, "owned_since" text );. Question: "How many stations per channel were affiliated in each year since 2002 and ordered by the number of stations, limit to the top 5?". [/INST] SELECT "year_of_affiliation", "channel_tv_dt", COUNT("station") FROM "table1_11147852_1" WHERE "year_of_affiliation">='2002' GROUP BY "year_of_affiliation", "channel_tv_dt" ORDER BY COUNT("station") 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_11147852_1" ( "city_of_license_market" text, "station" text, "channel_tv_dt" text, "year_of_affiliation" text, "owned_since" text );. Question: "How many different channels are there for each market where the station 'KTFK-DT' is located and ordered by the count of channels in descending order?". [/INST] SELECT "city_of_license_market", COUNT("channel_tv_dt") AS Channels FROM "table1_11147852_1" WHERE "station"='KTFK-DT' GROUP BY "city_of_license_market" ORDER BY Channels 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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "What is the maximum and minimum power and torque for each trim level where performance is 0–100km/h: 10.5s, VMax km/h (mph), and they use a turbo engine, ordered by trim level?". [/INST] SELECT "trim", MAX("power"), MIN("power"), MAX("torque"), MIN("torque") FROM "volvo_850_quick_information_by_trim_leve" WHERE "performance"='0–100km/h: 10.5s, VMax km/h (mph)' AND "turbo"='Yes' GROUP BY "trim" ORDER BY "trim";</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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "How many unique transmissions are available along with the count of each for trims with a turbo where trim is 2.0 20v?". [/INST] SELECT "transmission", COUNT(*) FROM "volvo_850_quick_information_by_trim_leve" WHERE "trim"='2.0 20v' AND "turbo" IS NOT NULL GROUP BY "transmission";</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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "What is the maximum and minimum power and the average torque where performance is "0–100km/h: 7.5s auto, VMax: km/h (mph)", grouped by the engine type and ordered by average torque in ascending order, limiting the results to the top 5?". [/INST] SELECT "engine", MAX("power"), MIN("power"), AVG("torque") FROM "volvo_850_quick_information_by_trim_leve" WHERE "performance"='0–100km/h: 7.5s auto, VMax: km/h (mph)' GROUP BY "engine" ORDER BY AVG("torque") 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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "How many different kinds of trims are associated with a 'Yes (Mitsubishi TD04-16t )' turbo type, ordered by power in descending order, and displaying only the top 5?". [/INST] SELECT "trim", COUNT("trim") FROM "volvo_850_quick_information_by_trim_leve" WHERE "turbo"='Yes (Mitsubishi TD04-16t )' GROUP BY "trim" ORDER BY "power" 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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "How many different types of engines are there for each type of fuel delivery where power is 'hp (kW) @6500 rpm', and rank them by their count in descending order. Show only the top 5.". [/INST] SELECT "fuel_delivery", COUNT(DISTINCT "engine") as engine_count FROM "volvo_850_quick_information_by_trim_leve" WHERE "power"='hp (kW) @6500 rpm' GROUP BY "fuel_delivery" ORDER BY engine_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 "volvo_850_quick_information_by_trim_leve" ( "trim" text, "engine" text, "turbo" text, "fuel_delivery" text, "power" text, "torque" text, "transmission" text, "performance" text );. Question: "What is the average power and total torque for each type of transmission for the engines with turbo, sorted by average power in descending order and limited to 5 results?". [/INST] SELECT "transmission", AVG("power"), SUM("torque") FROM "volvo_850_quick_information_by_trim_leve" WHERE "turbo"='Yes (Mitsubishi TD04-15g )' GROUP BY "transmission" ORDER BY AVG("power") 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 "highest_rating_drama_series_of_2007" ( "rank" real, "english_title" text, "chinese_title" text, "average" real, "peak" real, "premiere" real, "finale" real, "hk_viewers" text );. Question: "What are the top three English titles with the highest average ratings, whose finale rating is 33 and peak rating is 42? Also, provide the count of HK viewers for those series.". [/INST] SELECT "english_title", COUNT("hk_viewers"), MAX("average") FROM "highest_rating_drama_series_of_2007" WHERE "finale"=33 AND "peak"=42 GROUP BY "english_title" ORDER BY "average" 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 "highest_rating_drama_series_of_2007" ( "rank" real, "english_title" text, "chinese_title" text, "average" real, "peak" real, "premiere" real, "finale" real, "hk_viewers" text );. Question: "Provide the top 5 drama series with the highest average viewer count, where the premiere rating was less than 30.0 and the finale rating exceeded 36.0, along with their chinese and english titles.". [/INST] SELECT "english_title", "chinese_title", AVG("hk_viewers") AS average_viewers FROM "highest_rating_drama_series_of_2007" WHERE "premiere" < 30.0 AND "finale" > 36.0 GROUP BY "english_title", "chinese_title" ORDER BY average_viewers 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 "highest_rating_drama_series_of_2007" ( "rank" real, "english_title" text, "chinese_title" text, "average" real, "peak" real, "premiere" real, "finale" real, "hk_viewers" text );. Question: "What is the total viewership and the average rating for the drama series with the Chinese title 緣來自有機, and how does it rank in comparison to other drama series, sorted in descending order of viewership and average rating, limited to a top ten list?". [/INST] SELECT "chinese_title", SUM("hk_viewers"), AVG("average"), "rank" FROM "highest_rating_drama_series_of_2007" WHERE "chinese_title"='緣來自有機' GROUP BY "chinese_title" ORDER BY SUM("hk_viewers") DESC, AVG("average") 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 "highest_rating_drama_series_of_2007" ( "rank" real, "english_title" text, "chinese_title" text, "average" real, "peak" real, "premiere" real, "finale" real, "hk_viewers" text );. Question: "What was the highest, lowest and average number of hk viewers for each premiere year for the drama with chinese title '十兄弟', ordered by premiere year in ascending order?". [/INST] SELECT "premiere", MAX("hk_viewers"), MIN("hk_viewers"), AVG("hk_viewers") FROM "highest_rating_drama_series_of_2007" WHERE "chinese_title"='十兄弟' GROUP BY "premiere" ORDER BY "premiere" 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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "What was the highest and lowest weekly rank, the total number of episodes, and the average number of viewers for the shows that aired on November 12, 2007, grouped by the rating, and ordered in descending order by the total number of episodes, with a limit of 10 records?". [/INST] SELECT "rating", MAX("weekly_rank"), MIN("weekly_rank"), COUNT("episode"), AVG("viewers_m") FROM "u_s_ratings" WHERE "air_date"='November 12, 2007' GROUP BY "rating" ORDER BY COUNT("episode") 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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "How many viewers on average watched each rating category, ordered by the count of episodes in each rating, for episodes after 'Blowback' aired?". [/INST] SELECT "rating", AVG("viewers_m"), COUNT("episode") FROM "u_s_ratings" WHERE "air_date" > (SELECT "air_date" FROM "u_s_ratings" WHERE "episode"='\"Blowback\"') GROUP BY "rating" ORDER BY COUNT("episode") 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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "What are the two lowest weekly ranks for each aired episode with an air date of November 2007, sorted by viewers count in descending order?". [/INST] SELECT "episode", MIN("weekly_rank"), "viewers_m" FROM "u_s_ratings" WHERE "air_date" LIKE 'November%, 2007' GROUP BY "episode" ORDER BY "viewers_m" DESC LIMIT 2;</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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "What are the top 3 episodes with the highest share where 18-49 has a rating/share of 3.5/9, and how many viewers did these episodes obtain on average?". [/INST] SELECT "episode", AVG("viewers_m") FROM "u_s_ratings" WHERE "18_49_rating_share"='3.5/9' GROUP BY "episode" ORDER BY "share" 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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "What is the total number of viewers and the average share for the top 5 rated episodes where the rating is 5.3, grouped by episode?". [/INST] SELECT "episode", SUM("viewers_m"), AVG("share") FROM "u_s_ratings" WHERE "rating"='5.3' GROUP BY "episode" ORDER BY SUM("viewers_m") 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 "u_s_ratings" ( "num" real, "episode" text, "air_date" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "weekly_rank" real );. Question: "What is the average share and highest weekly rank for the top three episodes with the highest viewership that have an 18-49 rating/share equal or greater than the value of an episode with 5.61 viewers?". [/INST] SELECT AVG("share"), MAX("weekly_rank") FROM "u_s_ratings" WHERE "18_49_rating_share" >= (SELECT "18_49_rating_share" FROM "u_s_ratings" WHERE "viewers_m"='5.61') ORDER BY "viewers_m" 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the total capacity, highest, lowest, and average attendance for each team who played at Balmoor, sorted by highest attendance in descending order and limited to the top 5 results?". [/INST] SELECT "team", SUM("capacity"), MAX("highest"), MIN("lowest"), AVG("average") FROM "attendances" WHERE "stadium"='Balmoor' GROUP BY "team" ORDER BY MAX("highest") 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the highest and lowest capacity of each team's stadiums, and which team has the greatest difference between the highest and lowest capacity?". [/INST] SELECT "team", MAX("capacity"), MIN("capacity"), (MAX("capacity") - MIN("capacity")) as diff_capacity FROM "attendances" GROUP BY "team" ORDER BY diff_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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the stadium with minimum and maximum capacity for each team and how many stadiums per team have a lower average attendance than the highest attendance recorded?". [/INST] SELECT "team", MIN("capacity"), MAX("capacity"), COUNT("stadium") FROM "attendances" WHERE "average" < "highest" GROUP BY "team" ORDER BY "team" 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the maximum, minimum, and average attendance of the games held at the stadium of Alloa Athletic and list them in descending order based on the highest attendance with a limit of 5.". [/INST] SELECT "stadium", MAX("highest"), MIN("lowest"), AVG("average") FROM "attendances" WHERE "team"='Alloa Athletic' GROUP BY "stadium" ORDER BY MAX("highest") 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the maximum and minimum average attendance for each stadium of Ayr United sorted by the highest attendance in descending order and limit it to the top 5.". [/INST] SELECT "stadium", MAX("average"), MIN("average") FROM "attendances" WHERE "team"='Ayr United' GROUP BY "stadium" ORDER BY MAX("average") 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "For each team, what is the lowest and highest average attendances?". [/INST] SELECT "team", MIN("average"), MAX("average") FROM "attendances" GROUP BY "team" ORDER BY MIN("average") 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text, "position" text );. Question: "How many managers have been appointed for team Galway until a specific date, sorted in descending order?". [/INST] SELECT COUNT("replaced_by"), "date_of_appointment" FROM "managerial_changes" WHERE "team"='Galway' AND "date_of_appointment" <= '2022-12-31' GROUP BY "date_of_appointment" ORDER BY "date_of_appointment" 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text, "position" text );. Question: "How many times has each team had a managerial change due to different manners of departure for all positions where the outgoing manager was Damien Fox, ordered by the number of times in descending order and limit to the top 3?". [/INST] SELECT "team", "manner_of_departure", COUNT(*) as "Number of Changes" FROM "managerial_changes" WHERE "outgoing_manager"='Damien Fox' GROUP BY "team", "manner_of_departure" 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text, "position" text );. Question: "How many times has Davy Fitzgerald been appointed and what is the latest appointment date among these occurrences?". [/INST] SELECT COUNT(*), MAX("date_of_appointment") FROM "managerial_changes" WHERE "replaced_by"='Davy FitzGerald' GROUP BY "replaced_by";</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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text, "position" text );. Question: "What is the average position, maximum and minimum position per team when John Meyler was the outgoing manager, having the results ordered by maximum position in descending order, limited to the top 5 results?". [/INST] SELECT "team", AVG("position"), MAX("position"), MIN("position") FROM "managerial_changes" WHERE "outgoing_manager"='John Meyler' GROUP BY "team" ORDER BY MAX("position") 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 "see_also" ( "hand" text, "1_credit" real, "2_credits" real, "3_credits" real, "4_credits" real, "5_credits" text );. Question: "What is the maximum, minimum and average of 1 credit when 3 credits equals 180, grouped by the number of 1 credit and ordered in descending order, limited to top 5 records.". [/INST] SELECT "1_credit", MAX("1_credit"), MIN("1_credit"), AVG("1_credit") FROM "see_also" WHERE "3_credits"=180 GROUP BY "1_credit" ORDER BY "1_credit" 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 "see_also" ( "hand" text, "1_credit" real, "2_credits" real, "3_credits" real, "4_credits" real, "5_credits" text );. Question: "What is the minimum, maximum and average value of 3 credits for the hand that has 1600 for 4 credits and how many such hands are there?". [/INST] SELECT MIN("3_credits"), MAX("3_credits"), AVG("3_credits"), COUNT("hand") FROM "see_also" WHERE "4_credits"=1600 GROUP BY "hand";</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 "see_also" ( "hand" text, "1_credit" real, "2_credits" real, "3_credits" real, "4_credits" real, "5_credits" text );. Question: "What is the average 2 credits value for each distinct 1 credit value, where there are more than 3 instances of 3 credits with a 5 credits value of '5', ordered by the average 2 credits value in descending order, and limited to the top 5 results?". [/INST] SELECT "1_credit", AVG("2_credits") FROM "see_also" WHERE "3_credits" IN (SELECT "3_credits" FROM "see_also" WHERE "5_credits"='5' GROUP BY "3_credits" HAVING COUNT("3_credits") > 3) GROUP BY "1_credit" ORDER BY AVG("2_credits") 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 "see_also" ( "hand" text, "1_credit" real, "2_credits" real, "3_credits" real, "4_credits" real, "5_credits" text );. Question: "How many unique values of 1 credit, 2 credits, 3 credits, and 5 credits are there where the hand is 'Two pair', also list the minimum and maximum values for 4 credits under the same condition, order the results by the count of 4 credits, and return the top 5 results?". [/INST] SELECT "1_credit", "2_credits", "3_credits", "5_credits", COUNT("4_credits"), MIN("4_credits"), MAX("4_credits") FROM "see_also" WHERE "hand"='Two pair' GROUP BY "1_credit", "2_credits", "3_credits", "5_credits" ORDER BY COUNT("4_credits") 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 "law_enforcement" ( "character" text, "position" text, "actor" text, "first_episode" text, "final_episode" text, "duration" text, "final_episode_count" real );. Question: "What is the average final episode count for each position played by Christian de la Fuente?". [/INST] SELECT "position", AVG("final_episode_count") FROM "law_enforcement" WHERE "actor"='Christian de la Fuente' 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 "law_enforcement" ( "character" text, "position" text, "actor" text, "first_episode" text, "final_episode" text, "duration" text, "final_episode_count" real );. Question: "How many actors played the role of a DEA Agent and what is the count of their final episodes, ordered by the count in descending order and limited to the top 5.". [/INST] SELECT "actor", COUNT("final_episode") FROM "law_enforcement" WHERE "position"='DEA Agent' GROUP BY "actor" ORDER BY COUNT("final_episode") 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "How many times has each team had a vacant position, and what was the latest date of vacancy? Order the result by the count in descending order and limit to the top 5.". [/INST] SELECT "team", COUNT("date_of_vacancy"), MAX("date_of_vacancy") FROM "managerial_changes" GROUP BY "team" ORDER BY COUNT("date_of_vacancy") 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "For each team, what is the earliest and latest date of appointment when Colin Hendry was the outgoing manager, and how many times did this occur?". [/INST] SELECT "team", MIN("date_of_appointment"), MAX("date_of_appointment"), COUNT(*) FROM "managerial_changes" WHERE "outgoing_manager"='Colin Hendry' GROUP BY "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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "What are the top 3 most recent teams that 'Jim McInally' has managed, sorted by date of vacancy?". [/INST] SELECT "team", MAX("date_of_vacancy") FROM "managerial_changes" WHERE "outgoing_manager"='Jim McInally' GROUP BY "team" ORDER BY MAX("date_of_vacancy") 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "How many times has each team had a vacancy on given dates that were later replaced by John Brown, and list them in descending order by count?". [/INST] SELECT "team", COUNT("date_of_vacancy") FROM "managerial_changes" WHERE "replaced_by"='John Brown' GROUP BY "team" ORDER BY COUNT("date_of_vacancy") 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "How many teams faced managerial changes with an appointment date on or after 13 March 2008 categorized by manner of departure?". [/INST] SELECT "manner_of_departure", COUNT("team") FROM "managerial_changes" WHERE "date_of_appointment" >= '13 March 2008' GROUP BY "manner_of_departure";</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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text );. Question: "How many outgoing managers each team has had and what is the earliest and latest date of appointment for each team (order the result by the number of outgoing managers in descending order and limit it to 10 rows)?". [/INST] SELECT "team", COUNT("outgoing_manager") as num_outgoing_managers, MIN("date_of_appointment") AS earliest_appointment, MAX("date_of_appointment") AS latest_appointment FROM "managerial_changes" GROUP BY "team" ORDER BY num_outgoing_managers 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the lowest and highest average attendance, and for how many teams, for each stadium, while showing only the top 5 results based on the highest average attendance?". [/INST] SELECT "stadium", MIN("average") AS min_average, MAX("average") AS max_average, COUNT(DISTINCT "team") AS total_teams FROM "attendances" GROUP BY "stadium" ORDER BY max_average 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the average and maximum capacity of stadiums per team whose stadium is not Palmerston Park, ordered by the average capacity and limited to top 5?". [/INST] SELECT "team", AVG("capacity"), MAX("capacity") FROM "attendances" WHERE "stadium"<>'Palmerston Park' GROUP BY "team" ORDER BY AVG("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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the team with the lowest average attendance recorded at Cappielow and how many was it?". [/INST] SELECT "team", MIN("average") AS minimum_average FROM "attendances" WHERE "stadium"='Cappielow' GROUP BY "team" ORDER BY minimum_average 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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What is the highest and lowest attendance at a game played by St. Johnstone, ordered by the stadium capacity in descending order and limit the result to top 5 records?". [/INST] SELECT MAX("highest"), MIN("lowest") FROM "attendances" WHERE "team"='St. Johnstone' GROUP BY "stadium" ORDER BY "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 "attendances" ( "team" text, "stadium" text, "capacity" real, "highest" real, "lowest" real, "average" real );. Question: "What's the highest, lowest, and average attendance at Hamilton Academical games group by stadiums? Can you list the results in descending order by highest attendance? And limit the results to top 10.". [/INST] SELECT "stadium", MAX("highest"), MIN("lowest"), AVG("average") FROM "attendances" WHERE "team"='Hamilton Academical' GROUP BY "stadium" ORDER BY MAX("highest") 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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "How many times each champion has won when semi-finalist #2 is not available and the matches were held at different locations, display the results in descending order of wins with a limit of top 5". [/INST] SELECT "champion", COUNT(*) AS "number_of_wins" FROM "division_i" WHERE "semi_finalist_num2"='NA' GROUP BY "champion" ORDER BY "number_of_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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "What was the average score for each year, and what year had the highest average score?". [/INST] SELECT AVG("score"), "year" FROM "division_i" GROUP BY "year" ORDER BY AVG("score") 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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "What is the total count of different locations where the runner-up was East Carolina, sorted by the number of semi-finalist #2 in descending order and limit the result to top 5.". [/INST] SELECT "location", COUNT(DISTINCT "semi_finalist_num2") FROM "division_i" WHERE "runner_up"='East Carolina' GROUP BY "location" ORDER BY COUNT(DISTINCT "semi_finalist_num2") 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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "How many times each semi-finalist #1 has been in a game where the runner-up was Elon University, and order the result by the number of appearances in descending order.". [/INST] SELECT "semi_finalist_num1", COUNT(*) as "Number of Appearances" FROM "division_i" WHERE "runner_up"='Elon University' GROUP BY "semi_finalist_num1" ORDER BY 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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "In how many championships, considering only the top 5 occurring locations, has North Carolina State emerged as champion from 2000 to 2010 and who were the respective runner-ups?". [/INST] SELECT COUNT("year"), "runner_up" FROM "division_i" WHERE "champion"='North Carolina State' AND "year" BETWEEN '2000' AND '2010' AND "location" IN (SELECT "location" FROM "division_i" GROUP BY "location" ORDER BY COUNT(*) DESC LIMIT 5) GROUP BY "runner_up" ORDER BY COUNT("year") 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 "division_i" ( "year" text, "champion" text, "score" text, "runner_up" text, "location" text, "semi_finalist_num1" text, "semi_finalist_num2" text );. Question: "How many times each runner-up has reached the semi-finals in 2004 in Ellenton, FL location ordered by the number of times in descending order.". [/INST] SELECT "runner_up", COUNT(*) FROM "division_i" WHERE "location"='Ellenton, FL' AND "year"='2004' AND ("runner_up" = "semi_finalist_num1" OR "runner_up" = "semi_finalist_num2") GROUP BY "runner_up" ORDER BY 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 "population_and_distribution" ( "year" real, "numer_of_jamaicans_granted_british_citizenship" real, "naturalisation_by_residence" real, "naturalisation_by_marriage" real, "registration_of_a_minor_child" real, "registration_by_other_means" real );. Question: "What are the maximum, minimum and average values of naturalisation by marriage, grouping by each year, where the number of Jamaicans granted British citizenship is more than 3165, arranged by year in ascending order, and only showing the top 5 years?". [/INST] SELECT "year", MAX("naturalisation_by_marriage"), MIN("naturalisation_by_marriage"), AVG("naturalisation_by_marriage") FROM "population_and_distribution" WHERE "numer_of_jamaicans_granted_british_citizenship" > 3165 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 "population_and_distribution" ( "year" real, "numer_of_jamaicans_granted_british_citizenship" real, "naturalisation_by_residence" real, "naturalisation_by_marriage" real, "registration_of_a_minor_child" real, "registration_by_other_means" real );. Question: "What is the number of years where the number of Jamaicans granted British citizenship exceeds 500 with naturalisation by marriage limited to top 10 years by maximum registrations?". [/INST] SELECT "year" FROM "population_and_distribution" WHERE "numer_of_jamaicans_granted_british_citizenship">500 AND "naturalisation_by_marriage"=1060 ORDER BY "registration_by_other_means" 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 "population_and_distribution" ( "year" real, "numer_of_jamaicans_granted_british_citizenship" real, "naturalisation_by_residence" real, "naturalisation_by_marriage" real, "registration_of_a_minor_child" real, "registration_by_other_means" real );. Question: "What is the average number of times naturalisation by marriage occurs for each unique count of registration of a minor child, where the minor child registration count is less than 200, sorted by this average value in descending order, and limited to the top 5 results?". [/INST] SELECT AVG("naturalisation_by_marriage"), "registration_of_a_minor_child" FROM "population_and_distribution" WHERE "registration_of_a_minor_child"<200 GROUP BY "registration_of_a_minor_child" ORDER BY AVG("naturalisation_by_marriage") 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 "population_and_distribution" ( "year" real, "numer_of_jamaicans_granted_british_citizenship" real, "naturalisation_by_residence" real, "naturalisation_by_marriage" real, "registration_of_a_minor_child" real, "registration_by_other_means" real );. Question: "What is the highest number of Jamaicans granted British citizenship per year when considering only the years where the naturalisation by residence was more than 927?". [/INST] SELECT MAX("numer_of_jamaicans_granted_british_citizenship"), "year" FROM "population_and_distribution" WHERE "naturalisation_by_residence" > 927 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 "population_and_distribution" ( "year" real, "numer_of_jamaicans_granted_british_citizenship" real, "naturalisation_by_residence" real, "naturalisation_by_marriage" real, "registration_of_a_minor_child" real, "registration_by_other_means" real );. Question: "What is the maximum and minimum years where the registration of a minor child is 281 and what is the total naturalisation by residence and by marriage for these years". [/INST] SELECT MAX("year"), MIN("year"), SUM("naturalisation_by_residence"), SUM("naturalisation_by_marriage") FROM "population_and_distribution" WHERE "registration_of_a_minor_child"=281 GROUP BY "registration_of_a_minor_child";</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_11220799_2" ( "episode_titles" text, "first_air_date" text, "reward" text, "immunity" text, "exiled" text, "eliminated" text, "vote" text, "finish" text );. Question: "What was the episode with the highest rewards count that first aired on March 6, 2008 and what were the voting details for that episode?". [/INST] SELECT "episode_titles", MAX("reward"), "vote" FROM "table1_11220799_2" WHERE "first_air_date"='March 6, 2008' GROUP BY "episode_titles", "vote" ORDER BY "reward" 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_11220799_2" ( "episode_titles" text, "first_air_date" text, "reward" text, "immunity" text, "exiled" text, "eliminated" text, "vote" text, "finish" text );. Question: "What was the highest and lowest vote count for each unique reward type for episodes with a first air date of March 6, 2008, and what is the average finish status per these categories, ordered by vote count in descending order and limited to the top 5?". [/INST] SELECT "reward", MAX("vote"), MIN("vote"), AVG("finish") FROM "table1_11220799_2" WHERE "first_air_date"='March 6, 2008' GROUP BY "reward" ORDER BY MAX("vote") 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_11230937_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, maximum and minimum number of US viewers in millions for the top 10 episodes with the highest number of viewers in a particular season?". [/INST] SELECT AVG("u_s_viewers_millions"), MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions") FROM (SELECT * FROM "table1_11230937_2" WHERE "no_in_season"=15 ORDER BY "u_s_viewers_millions" DESC LIMIT 10) AS top_episodes;</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_11230937_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 was the average number of U.S viewers in millions and how many episodes directed by each director for all episodes titled "Throwing Heat" and aired before 2010?". [/INST] SELECT AVG("u_s_viewers_millions"), COUNT("title"), "directed_by" FROM "table1_11230937_2" WHERE "title" = 'Throwing Heat' AND CAST(SUBSTR("original_air_date",LENGTH("original_air_date")-3,4) AS INTEGER) < 2010 GROUP BY "directed_by";</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_11230937_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, maximum, and minimum number of viewers in millions who watched the episodes directed by Anthony Hemingway, sorted by the number of viewers in descending order and limit the results to top 5?". [/INST] SELECT AVG("u_s_viewers_millions"), MAX("u_s_viewers_millions"), MIN("u_s_viewers_millions") FROM "table1_11230937_2" WHERE "directed_by"='Anthony Hemingway' GROUP BY "directed_by" 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 "official_callanetics_videos" ( "year" real, "title" text, "format" text, "studio" text, "release_date" text, "copyright_information" text, "catalog_number" text );. Question: "Can you list the count of different formats of videos for each title, where catalog number is 80809, sorted by count in descending order and showing only top 5?". [/INST] SELECT "title", COUNT("format") as "count_format" FROM "official_callanetics_videos" WHERE "catalog_number"='80809' GROUP BY "title" ORDER BY "count_format" 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 "official_callanetics_videos" ( "year" real, "title" text, "format" text, "studio" text, "release_date" text, "copyright_information" text, "catalog_number" text );. Question: "How many each type of format has been released for the videos with titles starting with 'Callanetics', grouped by each studio, sorted by the total formats in descending order and limit the result to 5?". [/INST] SELECT "studio", "format", COUNT("format") AS "format_count" FROM "official_callanetics_videos" WHERE "title" LIKE 'Callanetics%' GROUP BY "studio", "format" ORDER BY "format_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 "official_callanetics_videos" ( "year" real, "title" text, "format" text, "studio" text, "release_date" text, "copyright_information" text, "catalog_number" text );. Question: "List the count of different formats for each studio where the catalog number is 81258, and order the result by the count in descending order.". [/INST] SELECT "studio", COUNT("format") AS format_count FROM "official_callanetics_videos" WHERE "catalog_number"='81258' GROUP BY "studio" ORDER BY format_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 "official_callanetics_videos" ( "year" real, "title" text, "format" text, "studio" text, "release_date" text, "copyright_information" text, "catalog_number" text );. Question: "Count the number of unique formats available for the title 'AM/PM Callanetics', grouped by studio for the top 5 studios with the earliest release dates. Also, display the respective earliest and latest copyright information for these studios.". [/INST] SELECT "studio", COUNT(DISTINCT "format"), MIN("copyright_information"), MAX("copyright_information") FROM "official_callanetics_videos" WHERE "title"='AM/PM Callanetics' GROUP BY "studio" ORDER BY MIN("release_date") 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 "1908_1994_new_south_wales_rugby_league" ( "season" real, "grand_final_date" text, "winning_team" text, "score" text, "losing_team" text, "location" text, "gf_attendance" real, "clive_churchill_medal" text );. Question: "What was the minimum, maximum and average GF attendance at the location of Sydney Football Stadium, Sydney (6) for each winning team over the seasons?". [/INST] SELECT "winning_team", MIN("gf_attendance"), MAX("gf_attendance"), AVG("gf_attendance") FROM "1908_1994_new_south_wales_rugby_league" WHERE "location"='Sydney Football Stadium, Sydney (6)' GROUP BY "winning_team" ORDER BY AVG("gf_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 "1908_1994_new_south_wales_rugby_league" ( "season" real, "grand_final_date" text, "winning_team" text, "score" text, "losing_team" text, "location" text, "gf_attendance" real, "clive_churchill_medal" text );. Question: "How many times each losing team with a score of 24-12 has won the Clive Churchill Medal, displayed in descending order by number of times won, and limit the output to top 5". [/INST] SELECT "losing_team", COUNT("clive_churchill_medal") AS Medals_Won FROM "1908_1994_new_south_wales_rugby_league" WHERE "score"='24-12' GROUP BY "losing_team" ORDER BY Medals_Won DESC LIMIT 5;</s>