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 "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 losing team with the highest grand final attendance in the seasons between 1990 and 2000 with the count of their losses sorted in descending order?". [/INST] SELECT "losing_team", COUNT("losing_team"), MAX("gf_attendance") FROM "1908_1994_new_south_wales_rugby_league" WHERE "season" BETWEEN 1990 AND 2000 GROUP BY "losing_team" ORDER BY COUNT("losing_team") 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 "specifications_for_different_r_985_wasp_" ( "engine" text, "power_continuous" text, "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details" text, "power_takeoff" text, "compression_ratio" text, "supercharger_gear_ratio" text, "octane_rating" text, "dry_weight" text );. Question: "What is the average compression ratio and total dry weight for each unique octane rating used in the Wasp Jr. T1B2 engines, order them by octane rating in descending order and show only the top 5.". [/INST] SELECT "octane_rating", AVG("compression_ratio"), SUM("dry_weight") FROM "specifications_for_different_r_985_wasp_" WHERE "engine"='Wasp Jr. T1B2' GROUP BY "octane_rating" ORDER BY "octane_rating" 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 "specifications_for_different_r_985_wasp_" ( "engine" text, "power_continuous" text, "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details" text, "power_takeoff" text, "compression_ratio" text, "supercharger_gear_ratio" text, "octane_rating" text, "dry_weight" text );. Question: "What is the average dry weight and the maximum and minimum critical altitude for each unique compression ratio when the continuous power is 'hp (kW) at 2,200 RPM', and the octane rating is '80/87', grouped by the supercharger gear ratio and ordered by the compression ratio?". [/INST] SELECT "compression_ratio", AVG("dry_weight"), MAX("critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details"), MIN("critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details") FROM "specifications_for_different_r_985_wasp_" WHERE "power_continuous"='hp (kW) at 2,200 RPM' AND "octane_rating"='80/87' GROUP BY "supercharger_gear_ratio" ORDER BY "compression_ratio";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "specifications_for_different_r_985_wasp_" ( "engine" text, "power_continuous" text, "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details" text, "power_takeoff" text, "compression_ratio" text, "supercharger_gear_ratio" text, "octane_rating" text, "dry_weight" text );. Question: "What is the dry weight and count of engine types for each unique combination of compression ratio and power when the continuous power is greater than 'hp (kW) at 2,200 RPM' and the critical altitude is at sea level, grouped by supercharger gear ratio, and only for the top 5 combinations with the highest octane rating?". [/INST] SELECT "dry_weight", "engine", COUNT("engine") as "engine_count", "compression_ratio", "power_continuous", "supercharger_gear_ratio", "octane_rating" FROM "specifications_for_different_r_985_wasp_" WHERE "power_continuous">'hp (kW) at 2,200 RPM' AND "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details"='sea level' GROUP BY "compression_ratio", "power_continuous", "supercharger_gear_ratio" ORDER BY "octane_rating" 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 "specifications_for_different_r_985_wasp_" ( "engine" text, "power_continuous" text, "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details" text, "power_takeoff" text, "compression_ratio" text, "supercharger_gear_ratio" text, "octane_rating" text, "dry_weight" text );. Question: "How many unique compression ratios are there for each dry weight, specifically for the 'Wasp Jr. T1B2' engine, ordered by the dry weight in ascending order?". [/INST] SELECT "dry_weight", COUNT(DISTINCT "compression_ratio") FROM "specifications_for_different_r_985_wasp_" WHERE "engine"='Wasp Jr. T1B2' GROUP BY "dry_weight" ORDER BY "dry_weight" 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 "specifications_for_different_r_985_wasp_" ( "engine" text, "power_continuous" text, "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details" text, "power_takeoff" text, "compression_ratio" text, "supercharger_gear_ratio" text, "octane_rating" text, "dry_weight" text );. Question: "What is the maximum and minimum continuous power for different engine types at sea level having supercharger gear ratio of 7:1 grouped by octane rating?". [/INST] SELECT "engine", MAX("power_continuous"), MIN("power_continuous") FROM "specifications_for_different_r_985_wasp_" WHERE "critical_altitude_this_is_the_highest_altitude_at_which_the_engine_can_achieve_its_full_continuous_power_rating_above_this_altitude_power_falls_off_with_height_as_with_a_naturally_aspirated_engine_see_superchargernum_altitude_effects_for_details"='sea level' AND "supercharger_gear_ratio"='7:1' GROUP BY "octane_rating" ORDER BY "octane_rating" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot" text, "viewers" text, "weekly_rank_for_living" text );. Question: "What was the maximum number of viewers per timeslot for episodes that aired on October 27, 2008?". [/INST] SELECT "timeslot", MAX("viewers") FROM "weekly_ratings" WHERE "air_date"='October 27, 2008' GROUP BY "timeslot" ORDER BY MAX("viewers") 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot" text, "viewers" text, "weekly_rank_for_living" text );. Question: "How many times each timeslot has been used for the 5 episodes with the highest weekly rank for the episode "Chapter Five: Dressed to Kill"?". [/INST] SELECT "timeslot", COUNT(*) FROM "weekly_ratings" WHERE "episode"='\"Chapter Five: Dressed to Kill\"' GROUP BY "timeslot" ORDER BY "weekly_rank_for_living" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot" text, "viewers" text, "weekly_rank_for_living" text );. Question: "What are the top three episodes with the most number of viewers that aired on specific timeslots on September 29, 2008, and how many viewers did each have?". [/INST] SELECT "episode", "viewers" FROM "weekly_ratings" WHERE "air_date"='September 29, 2008' AND "timeslot" IS NOT NULL ORDER BY "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 "1998_present_national_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: "In which seasons did the Canterbury Bulldogs (8) win and what were the total attendance for those matches, sorted in descending order of attendance?". [/INST] SELECT "season", SUM("gf_attendance") AS TotalAttendance FROM "1998_present_national_rugby_league" WHERE "winning_team"='Canterbury Bulldogs (8)' GROUP BY "season" ORDER BY TotalAttendance 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 "1998_present_national_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 is the maximum and minimum attendance for each season at the Sydney Football Stadium, Sydney (11) and how many unique teams have lost there, ordered by seasons?". [/INST] SELECT "season", MAX("gf_attendance"), MIN("gf_attendance"), COUNT(DISTINCT "losing_team") FROM "1998_present_national_rugby_league" WHERE "location"='Sydney Football Stadium, Sydney (11)' GROUP BY "season" ORDER BY "season" 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 "1998_present_national_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 has the St. George-Illawarra Dragons lost and who were the Clive Churchill Medalists in those matches?". [/INST] SELECT COUNT("losing_team"), "clive_churchill_medal" FROM "1998_present_national_rugby_league" WHERE "losing_team"='St. George-Illawarra Dragons' GROUP BY "clive_churchill_medal";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "1998_present_national_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 were the seasons, in descending order, when Brett Kimmorley was chosen for the Clive Churchill Medal, and how many audience attended those games, in average?". [/INST] SELECT "season", AVG("gf_attendance") FROM "1998_present_national_rugby_league" WHERE "clive_churchill_medal"='Brett Kimmorley' GROUP BY "season" ORDER BY "season" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "time_slot_est" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_overall" text );. Question: "What are the top 5 time slots with the maximum number of episodes having ratings equal to or higher than 6.3, and how many such episodes are there for each of these slots?". [/INST] SELECT "time_slot_est", COUNT("episode") as episode_count FROM "weekly_ratings" WHERE "rating">='6.3' GROUP BY "time_slot_est" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "time_slot_est" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_overall" text );. Question: "What is the average share and total number of viewers for each unique time slot for episodes like "The Way We Weren't" and rank them according to the average share in descending order?". [/INST] SELECT "time_slot_est", AVG("share"), SUM("viewers_m") FROM "weekly_ratings" WHERE "episode" LIKE '%The Way We Weren''t%' GROUP BY "time_slot_est" ORDER BY AVG("share") 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "time_slot_est" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_overall" text );. Question: "What is the average share and total viewers count for all the episodes that aired in the same time slot as the episode "Who's Your Daddy", ordered by increasing air date, and limit the result to just the top 5 records.". [/INST] SELECT AVG("share"), SUM("viewers_m"), "air_date" FROM "weekly_ratings" WHERE "time_slot_est"=(SELECT "time_slot_est" FROM "weekly_ratings" WHERE "episode"='\"Who''s Your Daddy\"') GROUP BY "air_date" ORDER BY "air_date" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "time_slot_est" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_overall" text );. Question: "What was the highest number of viewers and the corresponding air date, for every unique rating with a share over 11, ordered in descending order of viewers, limit to 5 entries.". [/INST] SELECT MAX("viewers_m"), "air_date" FROM "weekly_ratings" WHERE "share" > 11 GROUP BY "rating" ORDER BY MAX("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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "time_slot_est" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_overall" text );. Question: "List the top 5 air dates with their corresponding episodes that had an 18-49 rating/share of '3.3/9', grouped by the air date and ordered by their share in a descending manner.". [/INST] SELECT "air_date", "episode", MAX("share") FROM "weekly_ratings" WHERE "18_49_rating_share"='3.3/9' GROUP BY "air_date", "episode" ORDER BY "share" 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_11240028_3" ( "character" text, "portrayed_by" text, "relationship" text, "first_appearance" text, "last_appearance" text );. Question: "How many characters made their first appearance in each episode and what is the maximum and minimum appearances made by characters in a particular episode, with a restriction to only show the top 5 episodes with the maximum character appearances?". [/INST] SELECT "first_appearance", COUNT("character"), MAX("character"), MIN("character") FROM "table1_11240028_3" GROUP BY "first_appearance" ORDER BY COUNT("character") 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_11240028_3" ( "character" text, "portrayed_by" text, "relationship" text, "first_appearance" text, "last_appearance" text );. Question: "How many distinct relationships were portrayed by each actor?". [/INST] SELECT "portrayed_by", COUNT(DISTINCT "relationship") FROM "table1_11240028_3" GROUP BY "portrayed_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_11240028_3" ( "character" text, "portrayed_by" text, "relationship" text, "first_appearance" text, "last_appearance" text );. Question: "How many appearances per relationship type were there for characters portrayed by Reed Garrett, and what was the max duration of a character from first to last appearance in descending order?". [/INST] SELECT "relationship", COUNT("character"), MAX("last_appearance" - "first_appearance") FROM "table1_11240028_3" WHERE "portrayed_by"='Reed Garrett' GROUP BY "relationship" ORDER BY COUNT("character") 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_11240028_3" ( "character" text, "portrayed_by" text, "relationship" text, "first_appearance" text, "last_appearance" text );. Question: "Which actors portrayed most and least characters as an 'Informant of Don Flack' and how many characters they portrayed in descending order?". [/INST] SELECT "portrayed_by", COUNT("character") as character_count FROM "table1_11240028_3" WHERE "relationship"='Informant of Don Flack' GROUP BY "portrayed_by" ORDER BY character_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 "table1_11240028_3" ( "character" text, "portrayed_by" text, "relationship" text, "first_appearance" text, "last_appearance" text );. Question: "What was the last episode each character appeared in, and how many total appearances did they have? Order by the character name alphabetically and show only top 5 characters.". [/INST] SELECT "character", "last_appearance", COUNT(*) as "total_appearances" FROM "table1_11240028_3" GROUP BY "character" ORDER BY "character" 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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "How many main characters did actress Sela Ward play, and in which episodes did these characters appear the most and the least? Order this by the number of episodes, starting with the character with the most episodes.". [/INST] SELECT "character", MIN("first_appearance"), MAX("last_appearance"), COUNT("episodes") FROM "main_characters" WHERE "portrayed_by"='Sela Ward' GROUP BY "character" ORDER BY COUNT("episodes") 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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "Count the number of unique actors who first appeared in "Zoo York", ordered by the number of episodes they starred in and limit the query to top 5.". [/INST] SELECT COUNT(DISTINCT "portrayed_by") AS Actors_Count, "episodes" FROM "main_characters" WHERE "first_appearance"='Zoo York' GROUP BY "episodes" ORDER BY "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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "What's the average number of episodes Vanessa Ferlito has appeared in per character she portrayed, listing the top three characters with the most episodes in descending order?". [/INST] SELECT AVG("episodes"), "character" FROM "main_characters" WHERE "portrayed_by"='Vanessa Ferlito' GROUP BY "character" ORDER BY AVG("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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "Which are the three actors who appeared for the least amount of episodes and first appeared in episode "Blink" 1, 2, 3, sorted by their first appearance?". [/INST] SELECT "portrayed_by", MIN("duration"), "first_appearance" FROM "main_characters" WHERE "first_appearance"='\"Blink\" 1, 2, 3' GROUP BY "portrayed_by" ORDER BY "first_appearance" 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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "What was the total number of episodes and the duration of characters portrayed by Robert Joy? Please list from the longest duration to the shortest, limiting the result to the top 5.". [/INST] SELECT "character", SUM("episodes"), SUM("duration") FROM "main_characters" WHERE "portrayed_by"='Robert Joy' GROUP BY "character" ORDER BY SUM("duration") 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 "main_characters" ( "character" text, "portrayed_by" text, "first_appearance" text, "last_appearance" text, "duration" text, "episodes" text );. Question: "Count the total number of episodes where each actor last appeared and show the results with the highest count at the top and a limit of 5.". [/INST] SELECT "portrayed_by", COUNT("last_appearance") FROM "main_characters" GROUP BY "portrayed_by" ORDER BY COUNT("last_appearance") 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 "clubs" ( "club" text, "position_in_2012_13" text, "first_season_in_top_division" text, "number_of_seasons_in_top_division" real, "number_of_seasons_in_the_premier_league" real, "first_season_of_current_spell_in_top_division" text, "top_division_titles" real, "last_top_division_title" text );. Question: "What are the top 5 clubs with the least number of top division titles, considering only those clubs that remained in the top division for 10 or more seasons?". [/INST] SELECT "club" FROM "clubs" WHERE "number_of_seasons_in_top_division" >= 10 ORDER BY "top_division_titles" 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 "clubs" ( "club" text, "position_in_2012_13" text, "first_season_in_top_division" text, "number_of_seasons_in_top_division" real, "number_of_seasons_in_the_premier_league" real, "first_season_of_current_spell_in_top_division" text, "top_division_titles" real, "last_top_division_title" text );. Question: "What is the least number of seasons in top division for each club and list down the result ordered by the number of seasons in ascending order with a limit of 5?". [/INST] SELECT "club", MIN("number_of_seasons_in_top_division") FROM "clubs" GROUP BY "club" ORDER BY MIN("number_of_seasons_in_top_division") 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 "u_s_nielsen_ratings" ( "num" real, "episode" text, "rating" text, "share" real, "rating_share_18_49" text, "viewers_millions" text, "rank_timeslot" real, "rank_night" real, "rank_week" text );. Question: "What are the top 5 episodes with the highest viewer count for the week ranked 20, grouped by their rating share of 18-49?". [/INST] SELECT "episode", MAX("viewers_millions") FROM "u_s_nielsen_ratings" WHERE "rank_week"='20' GROUP BY "rating_share_18_49" ORDER BY "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 "u_s_nielsen_ratings" ( "num" real, "episode" text, "rating" text, "share" real, "rating_share_18_49" text, "viewers_millions" text, "rank_timeslot" real, "rank_night" real, "rank_week" text );. Question: "Can you provide the average rank in its timeslot, ranked by the number of viewers in descending order, for the top 5 episodes with the highest viewership?". [/INST] SELECT AVG("rank_timeslot"), "episode" FROM "u_s_nielsen_ratings" WHERE "episode" LIKE '%Dangerous Liaisons%' GROUP BY "episode" ORDER BY "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 "u_s_nielsen_ratings" ( "num" real, "episode" text, "rating" text, "share" real, "rating_share_18_49" text, "viewers_millions" text, "rank_timeslot" real, "rank_night" real, "rank_week" text );. Question: "What is the highest and lowest rank (night) and corresponding episode for the top five episodes with viewers (millions) numerically below or equal to 5.25, ordered by "rank_night" in descending order?". [/INST] SELECT "episode", MAX("rank_night"), MIN("rank_night") FROM "u_s_nielsen_ratings" WHERE CAST("viewers_millions" AS REAL) <=5.25 GROUP BY "episode" ORDER BY MAX("rank_night") 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_nielsen_ratings" ( "num" real, "episode" text, "rating" text, "share" real, "rating_share_18_49" text, "viewers_millions" text, "rank_timeslot" real, "rank_night" real, "rank_week" text );. Question: "What's the highest and lowest rating for the episode named "conference call" and how many times this specific rating was seen, also sorted decreasingly by the view count?". [/INST] SELECT "rating", count("rating"), min("viewers_millions"), max("viewers_millions") FROM "u_s_nielsen_ratings" WHERE "episode"='\"Conference Call\"' GROUP BY "rating" ORDER BY count("rating") DESC, "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 "u_s_nielsen_ratings" ( "num" real, "episode" text, "rating" text, "share" real, "rating_share_18_49" text, "viewers_millions" text, "rank_timeslot" real, "rank_night" real, "rank_week" text );. Question: "What is the highest and lowest viewers count (in millions) for the top 3 most common rank (night) along with the average rank timeslot for these ranks?". [/INST] SELECT "rank_night", MAX("viewers_millions"), MIN("viewers_millions"), AVG("rank_timeslot") FROM "u_s_nielsen_ratings" GROUP BY "rank_night" ORDER BY COUNT("rank_night") 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_11251601_2" ( "country" text, "carbon_dioxide_emissions_per_year_10_6_tons_2006" real, "percentage_of_global_total" text, "avg_emission_per_km_2_of_its_land_tons" real, "carbon_dioxide_emissions_per_year_tons_per_person_2007" text );. Question: "What is the average carbon dioxide emission per square km for countries whose carbon dioxide emission per year (tons per person) in 2007 was 1.4, grouping the results by the country and sorting in descending order of average emissions, and limiting to the top 5 countries?". [/INST] SELECT "country", AVG("avg_emission_per_km_2_of_its_land_tons") FROM "table1_11251601_2" WHERE "carbon_dioxide_emissions_per_year_tons_per_person_2007"='1.4' GROUP BY "country" ORDER BY AVG("avg_emission_per_km_2_of_its_land_tons") 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_11251601_2" ( "country" text, "carbon_dioxide_emissions_per_year_10_6_tons_2006" real, "percentage_of_global_total" text, "avg_emission_per_km_2_of_its_land_tons" real, "carbon_dioxide_emissions_per_year_tons_per_person_2007" text );. Question: "What are the top 5 countries with the highest Carbon Dioxide emissions in 2006?". [/INST] SELECT "country", MAX("carbon_dioxide_emissions_per_year_10_6_tons_2006") FROM "table1_11251601_2" GROUP BY "country" ORDER BY "carbon_dioxide_emissions_per_year_10_6_tons_2006" 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_11251601_2" ( "country" text, "carbon_dioxide_emissions_per_year_10_6_tons_2006" real, "percentage_of_global_total" text, "avg_emission_per_km_2_of_its_land_tons" real, "carbon_dioxide_emissions_per_year_tons_per_person_2007" text );. Question: "What are the top five countries with the highest percentage of global total emissions, and how much carbon dioxide do they emit per square km of their land?". [/INST] SELECT "country", "percentage_of_global_total", "avg_emission_per_km_2_of_its_land_tons" FROM "table1_11251601_2" ORDER BY "percentage_of_global_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 "table1_11251601_2" ( "country" text, "carbon_dioxide_emissions_per_year_10_6_tons_2006" real, "percentage_of_global_total" text, "avg_emission_per_km_2_of_its_land_tons" real, "carbon_dioxide_emissions_per_year_tons_per_person_2007" text );. Question: "What is the average carbon dioxide emissions per square km of countries with percentage of global total emissions greater than the country that produced 4.9 tons carbon dioxide emissions per person in 2007 limited to top 10 countries in decreasing order of their average emissions?". [/INST] SELECT AVG("avg_emission_per_km_2_of_its_land_tons") FROM "table1_11251601_2" WHERE "percentage_of_global_total" > (SELECT "percentage_of_global_total" FROM "table1_11251601_2" WHERE "carbon_dioxide_emissions_per_year_tons_per_person_2007" = '4.9') GROUP BY "country" ORDER BY AVG("avg_emission_per_km_2_of_its_land_tons") 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_11251601_2" ( "country" text, "carbon_dioxide_emissions_per_year_10_6_tons_2006" real, "percentage_of_global_total" text, "avg_emission_per_km_2_of_its_land_tons" real, "carbon_dioxide_emissions_per_year_tons_per_person_2007" text );. Question: "What is the total and average of carbon dioxide emissions per year in tons per person in India, sorted from least to most, and limit it to top 5 records?". [/INST] SELECT SUM("carbon_dioxide_emissions_per_year_tons_per_person_2007"), AVG("carbon_dioxide_emissions_per_year_tons_per_person_2007") FROM "table1_11251601_2" WHERE "country"='India' GROUP BY "carbon_dioxide_emissions_per_year_tons_per_person_2007" ORDER BY "carbon_dioxide_emissions_per_year_tons_per_person_2007" 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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot_est" text, "season" text, "rating" text, "share" real, "18_49" text, "viewers_m" text, "rank_num" text );. Question: "What's the highest and lowest rank number of the episodes aired in the five most viewed seasons after October 16, 2007, ordered by the average viewer count in each season?". [/INST] SELECT "season", MAX("rank_num"), MIN("rank_num"), AVG("viewers_m") AS avg_viewers FROM "weekly_ratings" WHERE "air_date">'October 16, 2007' GROUP BY "season" ORDER BY avg_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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot_est" text, "season" text, "rating" text, "share" real, "18_49" text, "viewers_m" text, "rank_num" text );. Question: "What is the highest share of each timeslot with viewership count greater than 5.96 million, ordered by share in descending order, and limit the results to the top 3 timeslots?". [/INST] SELECT "timeslot_est", MAX("share") FROM "weekly_ratings" WHERE "viewers_m">'5.96' GROUP BY "timeslot_est" ORDER BY MAX("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 "weekly_ratings" ( "num" real, "episode" text, "air_date" text, "timeslot_est" text, "season" text, "rating" text, "share" real, "18_49" text, "viewers_m" text, "rank_num" text );. Question: "What is the highest, lowest, and average viewership, along with the total number of episodes aired on each timeslot, for November 9, 2007, ordered by the highest average viewership and limiting the result to top 3 timeslots?". [/INST] SELECT "timeslot_est", MAX("viewers_m"), MIN("viewers_m"), AVG("viewers_m"), COUNT("episode") FROM "weekly_ratings" WHERE "air_date"='November 9, 2007' GROUP BY "timeslot_est" ORDER BY AVG("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 "ranking_points" ( "finishing_position" text, "points_awarded_platinum" real, "points_awarded_gold" real, "points_awarded_silver" real, "points_awarded_satellite" real );. Question: "What is the average, maximum, and minimum number of platinum points awarded grouped by gold points, limited to top 3 by maximum platinum points, when the awarded gold points are greater than or equal to 6?". [/INST] SELECT "points_awarded_gold", AVG("points_awarded_platinum"), MAX("points_awarded_platinum"), MIN("points_awarded_platinum") FROM "ranking_points" WHERE "points_awarded_gold" >= 6 GROUP BY "points_awarded_gold" ORDER BY MAX("points_awarded_platinum") 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 "ranking_points" ( "finishing_position" text, "points_awarded_platinum" real, "points_awarded_gold" real, "points_awarded_silver" real, "points_awarded_satellite" real );. Question: "What are the top 3 most frequent finishing positions where platinum points awarded are greater than or equal to 15 and the sum of those platinum points?". [/INST] SELECT "finishing_position", SUM("points_awarded_platinum") as Total_Points FROM "ranking_points" WHERE "points_awarded_platinum" >= 15 GROUP BY "finishing_position" ORDER BY COUNT(*) DESC, Total_Points 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 "ranking_points" ( "finishing_position" text, "points_awarded_platinum" real, "points_awarded_gold" real, "points_awarded_silver" real, "points_awarded_satellite" real );. Question: "What is the total number of platinum, gold, silver and satellite points awarded for top 3 positions in descending order?". [/INST] SELECT "finishing_position", SUM("points_awarded_platinum"), SUM("points_awarded_gold"), SUM("points_awarded_silver"), SUM("points_awarded_satellite") FROM "ranking_points" WHERE "finishing_position" IN ('1st', '2nd', '3rd') GROUP BY "finishing_position" ORDER BY CASE "finishing_position" WHEN '1st' THEN 1 WHEN '2nd' THEN 2 WHEN '3rd' THEN 3 END;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "ranking_points" ( "finishing_position" text, "points_awarded_platinum" real, "points_awarded_gold" real, "points_awarded_silver" real, "points_awarded_satellite" real );. Question: "What are the maximum and minimum platinum points awarded grouped by the number of silver points awarded, when there were at least 50 silver points awarded?". [/INST] SELECT MAX("points_awarded_platinum"), MIN("points_awarded_platinum"), "points_awarded_silver" FROM "ranking_points" WHERE "points_awarded_silver">=50 GROUP BY "points_awarded_silver" ORDER BY "points_awarded_silver" 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 "ranking_points" ( "finishing_position" text, "points_awarded_platinum" real, "points_awarded_gold" real, "points_awarded_silver" real, "points_awarded_satellite" real );. Question: "What is the maximum and minimum number of platinum points awarded for each unique gold point value less than 10, ordering the result by gold points in descending order and limit the output to 5 records?". [/INST] SELECT "points_awarded_gold", MAX("points_awarded_platinum"), MIN("points_awarded_platinum") FROM "ranking_points" WHERE "points_awarded_gold"<10 GROUP BY "points_awarded_gold" ORDER BY "points_awarded_gold" 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 "season_1" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What were the top 3 episodes with the highest share which had viewers more than 2.65 million sorted by 18_49_rating_share?". [/INST] SELECT "episode", MAX("share"), "18_49_rating_share" FROM "season_1" WHERE "viewers_m">'2.65' GROUP BY "episode" ORDER BY "18_49_rating_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 "season_1" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "How many episodes had the same share as the first episode that ranked 85 and what was their average viewership?". [/INST] SELECT COUNT("episode"), AVG("viewers_m") FROM "season_1" WHERE "share" =(SELECT MIN("share") FROM "season_1" WHERE "rank_num"='85') GROUP BY "share";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "season_1" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" real, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "How many viewers in millions on average each timeslot had in descending order, and list only top 3 timeslots?". [/INST] SELECT "timeslot", AVG("viewers_m") FROM "season_1" GROUP BY "timeslot" ORDER BY AVG("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 "season_2" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" text, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What was the maximum and minimum number of viewers per timeslot for the episodes that aired in May 2009, ordered by the number of viewers in descending order, limited to the top 5?". [/INST] SELECT "timeslot", MAX("viewers_m"), MIN("viewers_m") FROM "season_2" WHERE "air_date" LIKE 'May%, 2009' GROUP BY "timeslot" ORDER BY MAX("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 "season_2" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" text, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What is the average "18_49_rating_share" grouped by "timeslot" for the episodes aired in 2009, and sort the results by "18_49_rating_share" in descending order, show the top 5 results?". [/INST] SELECT "timeslot", AVG("18_49_rating_share") AS average_rating_share FROM "season_2" WHERE "air_date" LIKE '%2009%' GROUP BY "timeslot" ORDER BY average_rating_share 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 "season_2" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" text, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What's the total number of episodes per timeslot whose original airings were viewed by at least 1.82 million viewers, and order the result by timeslot?". [/INST] SELECT "timeslot", COUNT("episode") FROM "season_2" WHERE "viewers_m">='1.82' GROUP BY "timeslot" ORDER BY "timeslot" 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 "season_2" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" text, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What is the average rating and viewer count of episodes originally aired on May 5, 2009, ordered by rating and limiting to top 3?". [/INST] SELECT AVG("rating"), AVG("viewers_m") FROM "season_2" WHERE "air_date"='May 5, 2009' GROUP BY "episode" ORDER BY AVG("rating") 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 "season_2" ( "no" real, "episode" text, "air_date" text, "timeslot" text, "rating" text, "share" text, "18_49_rating_share" text, "viewers_m" text, "rank_num" text );. Question: "What is the average rating of the episodes that were watched by more than 2 million viewers, and how many times have they occurred per timeslot, ordered by timeslot in descending order limited to top 5?". [/INST] SELECT AVG("rating"), COUNT("episode"), "timeslot" FROM "season_2" WHERE "viewers_m" > '2' GROUP BY "timeslot" ORDER BY "timeslot" 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_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "Find the count of unique founders who are both extroverted, task-oriented as Director and extroverted, relationship-oriented, sorted by the number of occurrences in descending order, limit only to the top 5.". [/INST] SELECT "founder", COUNT(*) FROM "table1_11256021_1" WHERE "extroverted_task_oriented" ='Director' AND "extroverted_relationship_oriented" IS NOT NULL GROUP BY "founder" ORDER BY COUNT(*) DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "Count the distinct instances of 'extroverted_relationship_oriented' types where 'moderate' is 'Introverted Sanguine', grouped by 'founder' and ordered by the count in descending order. Also, limit the output to the top 5 results.". [/INST] SELECT "founder", COUNT(DISTINCT "extroverted_relationship_oriented") FROM "table1_11256021_1" WHERE "moderate"='Introverted Sanguine' GROUP BY "founder" ORDER BY COUNT(DISTINCT "extroverted_relationship_oriented") 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_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "How many distinct extroversion scales are there for each founder, where the moderate is 'ether', ordered by the number of extroversion scales in decreasing order, limited to the top 5?". [/INST] SELECT "founder", COUNT(DISTINCT "extroversion_scales") AS num_extroversion_scales FROM "table1_11256021_1" WHERE "moderate"='ether' GROUP BY "founder" ORDER BY num_extroversion_scales 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_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "For each date, find the task with the highest number of extroverted, relationship-oriented individuals and limit the results to top 5.". [/INST] SELECT "date", "extroverted_relationship_oriented", MAX("people_task_orientation_scale") as Maximum FROM "table1_11256021_1" WHERE "extroverted_relationship_oriented"='c. 1928' GROUP BY "date", "extroverted_relationship_oriented" ORDER BY Maximum 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_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "How many times each founder appears in the records where the date is 'c. 1900' and they are classified as 'extroverted_task_oriented', sorted by the count in descending order, limited to the top 5 entries". [/INST] SELECT "founder", COUNT(*) FROM "table1_11256021_1" WHERE "date"='c. 1900' AND "extroverted_task_oriented" IS NOT NULL GROUP BY "founder" ORDER BY COUNT(*) DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_11256021_1" ( "date" text, "founder" text, "extroversion_scales" text, "people_task_orientation_scale" text, "introverted_task_oriented" text, "extroverted_task_oriented" text, "extroverted_relationship_oriented" text, "introverted_relationship_oriented" text, "moderate" text );. Question: "Count the number of unique dates where the people-task orientation scale is above average and sort them by the founder, limiting the results to the top 5.". [/INST] SELECT "date", COUNT("founder") FROM "table1_11256021_1" WHERE "extroverted_relationship_oriented"='Team Type' AND "people_task_orientation_scale" > (SELECT AVG("people_task_orientation_scale") FROM "table1_11256021_1") GROUP BY "date", "founder" ORDER BY COUNT("founder") 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_11303072_5" ( "wicket" text, "runs" text, "batting_partners" text, "batting_team" text, "fielding_team" text, "venue" text, "season" text );. Question: "What is the maximum number of runs scored, the associated venue, and the season, for the top 5 batting teams in terms of total runs scored?". [/INST] SELECT "batting_team", MAX("runs"), "venue", "season" FROM "table1_11303072_5" GROUP BY "batting_team" ORDER BY SUM("runs") 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_11303072_5" ( "wicket" text, "runs" text, "batting_partners" text, "batting_team" text, "fielding_team" text, "venue" text, "season" text );. Question: "What is the maximum number of runs scored by each batting team at Durham grouped by the season, limited to the top 5 seasons ordered by number of runs in descending order?". [/INST] SELECT "batting_team", "season", MAX("runs") FROM "table1_11303072_5" WHERE "venue"='Durham' GROUP BY "batting_team", "season" ORDER BY MAX("runs") 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_11303072_5" ( "wicket" text, "runs" text, "batting_partners" text, "batting_team" text, "fielding_team" text, "venue" text, "season" text );. Question: "Which three fielding teams have faced the greatest number of partnerships between Thilina Kandamby and Rangana Herath, ordered by the total runs conceded?". [/INST] SELECT "fielding_team", COUNT(*), SUM("runs") FROM "table1_11303072_5" WHERE "batting_partners"='Thilina Kandamby and Rangana Herath' GROUP BY "fielding_team" ORDER BY SUM("runs") 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_11303072_5" ( "wicket" text, "runs" text, "batting_partners" text, "batting_team" text, "fielding_team" text, "venue" text, "season" text );. Question: "What are the top three venues where the fielding team has made the most number of 155 runs?". [/INST] SELECT "venue", COUNT(*) FROM "table1_11303072_5" WHERE "runs"='155' GROUP BY "venue" 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 "table1_11303072_5" ( "wicket" text, "runs" text, "batting_partners" text, "batting_team" text, "fielding_team" text, "venue" text, "season" text );. Question: "Which batting and fielding team pair for each season had the highest number of occurrences of batting partners achieving runs of 226, and also show a count of these occurrences?". [/INST] SELECT "batting_team", "fielding_team", "season", COUNT("batting_partners") FROM "table1_11303072_5" WHERE "runs"='226' GROUP BY "batting_team", "fielding_team", "season" ORDER BY COUNT("batting_partners") 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 "most_dismissals_in_a_career" ( "rank" real, "dismissals" real, "player" text, "nationality" text, "catches" real, "stumpings" real, "career_span" text );. Question: "What is the maximum number of catches and stumpings per nationality, also display the nationality with the least amount of total dismissals having David Bairstow as a player?". [/INST] SELECT "nationality", MAX("catches"), MAX("stumpings"), MIN("dismissals") FROM "most_dismissals_in_a_career" WHERE "player"='David Bairstow' GROUP BY "nationality";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "most_dismissals_in_a_career" ( "rank" real, "dismissals" real, "player" text, "nationality" text, "catches" real, "stumpings" real, "career_span" text );. Question: "What are the top 5 players with the most career dismissals along with their catch and stump record, sorted in decreasing order of dismissals?". [/INST] SELECT "player", "catches", "stumpings" FROM "most_dismissals_in_a_career" ORDER BY "dismissals" 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 "most_dismissals_in_a_career" ( "rank" real, "dismissals" real, "player" text, "nationality" text, "catches" real, "stumpings" real, "career_span" text );. Question: "What is the total number of stumpings and the average number of catches made by players of the same nationality as Paul Nixon throughout their careers, sorted by the number of catches in descending order, limiting to the top 5 players?". [/INST] SELECT "nationality", SUM("stumpings"), AVG("catches") FROM "most_dismissals_in_a_career" WHERE "nationality"=(SELECT "nationality" FROM "most_dismissals_in_a_career" WHERE "player"='Paul Nixon') GROUP BY "nationality" ORDER BY AVG("catches") 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 "most_dismissals_in_a_career" ( "rank" real, "dismissals" real, "player" text, "nationality" text, "catches" real, "stumpings" real, "career_span" text );. Question: "What is the total number of stumpings and the career span of players from the same nationality as Adam Gilchrist who achieved more dismissals than him, ordered from the highest to lowest stumpings?". [/INST] SELECT SUM("stumpings"), "career_span" FROM "most_dismissals_in_a_career" WHERE "nationality"=(SELECT "nationality" FROM "most_dismissals_in_a_career" WHERE "player"='Adam Gilchrist') AND "dismissals" > (SELECT "dismissals" FROM "most_dismissals_in_a_career" WHERE "player"='Adam Gilchrist') GROUP BY "career_span" ORDER BY SUM("stumpings") 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_1130632_1" ( "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "featured_character_s" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What are the top 3 titles directed by each director that have more than 19.48 million U.S. viewers, ordered by the number of viewers in descending order?". [/INST] SELECT "title", "directed_by", "u_s_viewers_million" FROM "table1_1130632_1" WHERE "u_s_viewers_million" > '19.48' GROUP BY "directed_by", "title" ORDER BY "u_s_viewers_million" 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_1130632_1" ( "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "featured_character_s" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "How many episodes directed by each director have 18.73 u.s. viewers, and also arrange this data in descending order.". [/INST] SELECT "directed_by", COUNT("title") AS "numberOfEpisodes" FROM "table1_1130632_1" WHERE "u_s_viewers_million"='18.73' GROUP BY "directed_by" ORDER BY "numberOfEpisodes" 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_1130632_1" ( "no_in_series" real, "title" text, "directed_by" text, "written_by" text, "featured_character_s" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "Count how many different characters have featured in all the shows written by each writer with 18.73 u.s. viewers, sorted by the number in descending order and restrict the output to the top 5". [/INST] SELECT "written_by", COUNT(DISTINCT "featured_character_s") as distinct_chars FROM "table1_1130632_1" WHERE "u_s_viewers_million"='18.73' GROUP BY "written_by" ORDER BY distinct_chars 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 "metropolitan_areas_with_largest_jewish_p" ( "rank_wjc" real, "rank_arda" real, "metro_area" text, "number_of_jews_wjc" real, "number_of_jews_asarb" real );. Question: "What is the maximum and minimum rank (WJC and ARDA) for the 5 metro areas with the highest number of Jews according to WJC and ASARB?". [/INST] SELECT "metro_area", MAX("rank_wjc"), MIN("rank_arda"), MAX("number_of_jews_wjc"), MAX("number_of_jews_asarb") FROM "metropolitan_areas_with_largest_jewish_p" GROUP BY "metro_area" ORDER BY MAX("number_of_jews_wjc") DESC, MAX("number_of_jews_asarb") 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 "metropolitan_areas_with_largest_jewish_p" ( "rank_wjc" real, "rank_arda" real, "metro_area" text, "number_of_jews_wjc" real, "number_of_jews_asarb" real );. Question: "What is the maximum and minimum number of jews in the top 5 ranked metropolitan areas under ARDA rankings?". [/INST] SELECT MAX("number_of_jews_wjc"), MIN("number_of_jews_wjc") FROM "metropolitan_areas_with_largest_jewish_p" WHERE "rank_arda"<=5 ORDER BY "rank_arda" 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 "metropolitan_areas_with_largest_jewish_p" ( "rank_wjc" real, "rank_arda" real, "metro_area" text, "number_of_jews_wjc" real, "number_of_jews_asarb" real );. Question: "What is the average number of Jews (ASARB) in the top 5 metro areas with highest rank according to ARDA?". [/INST] SELECT AVG("number_of_jews_asarb") FROM "metropolitan_areas_with_largest_jewish_p" ORDER BY "rank_arda" 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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "What's the crew count corresponding to each "open_1st_viii" category where U15 6th IV is 'BGS', ordered by crew count in descending order and the top 3 results?". [/INST] SELECT "open_1st_viii", COUNT("crew") as crew_count FROM "winning_head_of_the_river_championship_e" WHERE "u15_6th_iv"='BGS' GROUP BY "open_1st_viii" ORDER BY crew_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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "What are the top 5 crew counts which have at least one u16 2nd viii and u15 3rd iv being bbc, and sort them in descending order". [/INST] SELECT "crew", COUNT("u16_2nd_viii") FROM "winning_head_of_the_river_championship_e" WHERE "u15_3rd_iv"='BBC' AND "u16_2nd_viii" IS NOT NULL GROUP BY "crew" ORDER BY COUNT("u16_2nd_viii") 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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "How many 'open 1st viii' crew members are there corresponding to each 'u15 4th iv' category, in descending order, for the top 5 'u15 4th iv' categories having 'u15 4th iv' as 'GT'?". [/INST] SELECT "open_1st_viii", COUNT("crew") FROM "winning_head_of_the_river_championship_e" WHERE "u15_4th_iv"='GT' GROUP BY "open_1st_viii" ORDER BY COUNT("crew") 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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "What is the least number of crews who had u15 3rd iv being bgs, u15 1st iv being acgs and open 1st viii being acgs, and please show the result based on the u16 1st viii, and limit it to 5 records.". [/INST] SELECT MIN(COUNT("crew")), "u16_1st_viii" FROM "winning_head_of_the_river_championship_e" WHERE "u15_3rd_iv"='BGS' AND "u15_1st_iv"='ACGS' AND "open_1st_viii"='ACGS' GROUP BY "u16_1st_viii" ORDER BY COUNT("crew") 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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "Count the number of occurrences of each unique u15 3rd iv where u15 4th iv is bbc and order them by occurrence in descending order. Limit the result to top 5.". [/INST] SELECT "u15_3rd_iv", COUNT("u15_3rd_iv") AS Count FROM "winning_head_of_the_river_championship_e" WHERE "u15_4th_iv"='BBC' GROUP BY "u15_3rd_iv" 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 "winning_head_of_the_river_championship_e" ( "crew" real, "open_1st_viii" text, "open_2nd_viii" text, "open_3rd_viii" text, "u16_1st_viii" text, "u16_2nd_viii" text, "u16_3rd_viii" text, "u15_1st_iv" text, "u15_2nd_iv" text, "u15_3rd_iv" text, "u15_4th_iv" text, "u15_5th_iv" text, "u15_6th_iv" text );. Question: "Which crew has the maximum number of different open 2nd viii, given u15 3rd iv being gt, and list them in descending order?". [/INST] SELECT "crew", COUNT(DISTINCT "open_2nd_viii") as count FROM "winning_head_of_the_river_championship_e" WHERE "u15_3rd_iv"='GT' GROUP BY "crew" 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 "winning_head_of_the_river_championship_e" ( "school" text, "location" text, "enrolment" real, "founded" real, "denomination" text, "day_boarding" text, "school_colours" text, "abbreviation" text, "in_competition_since" real );. Question: "How many distinct denominations are there for schools with an enrolment of 850, and for each denomination, what is the earliest and latest year of foundation?". [/INST] SELECT "denomination", COUNT(*), MIN("founded"), MAX("founded") FROM "winning_head_of_the_river_championship_e" WHERE "enrolment"=850 GROUP BY "denomination" 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 "winning_head_of_the_river_championship_e" ( "school" text, "location" text, "enrolment" real, "founded" real, "denomination" text, "day_boarding" text, "school_colours" text, "abbreviation" text, "in_competition_since" real );. Question: "What is the average enrolment of schools per location for the ones that have been in competition since 1896?". [/INST] SELECT "location", AVG("enrolment") FROM "winning_head_of_the_river_championship_e" WHERE "in_competition_since"=1896 GROUP BY "location";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "winning_head_of_the_river_championship_e" ( "school" text, "location" text, "enrolment" real, "founded" real, "denomination" text, "day_boarding" text, "school_colours" text, "abbreviation" text, "in_competition_since" real );. Question: "What is the average enrollment of schools located in South Brisbane grouped by denomination, and ordered by this average in descending order, showing the top 5?". [/INST] SELECT "denomination", AVG("enrolment") as average_enrollment FROM "winning_head_of_the_river_championship_e" WHERE "location"='South Brisbane' GROUP BY "denomination" ORDER BY average_enrollment 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 "winning_head_of_the_river_championship_e" ( "school" text, "location" text, "enrolment" real, "founded" real, "denomination" text, "day_boarding" text, "school_colours" text, "abbreviation" text, "in_competition_since" real );. Question: "Which are the top three oldest schools competing since the earliest time (based on 'in_competition_since') along with their respective foundation years ('founded')?". [/INST] SELECT "abbreviation", MIN("founded") FROM "winning_head_of_the_river_championship_e" GROUP BY "abbreviation" ORDER BY "in_competition_since" 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 "winning_head_of_the_river_championship_e" ( "school" text, "location" text, "enrolment" real, "founded" real, "denomination" text, "day_boarding" text, "school_colours" text, "abbreviation" text, "in_competition_since" real );. Question: "What is the total enrollment and average enrollment of schools in each location that have been in competition since 1990, and sort the results by total enrollment in descending order with a limit of 10 entries?". [/INST] SELECT "location", SUM("enrolment") AS TOTAL_ENROLLMENT, AVG("enrolment") AS AVERAGE_ENROLLMENT FROM "winning_head_of_the_river_championship_e" WHERE "in_competition_since" >= 1990 GROUP BY "location" ORDER BY TOTAL_ENROLLMENT 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "What is the maximum, minimum and average number assigned to the Monaco Grand Prix, grouping by the pole_position and limit to the top 5 ordered by the rd in ascending order.". [/INST] SELECT pole_position, MAX("rd"), MIN("rd"), AVG("rd") FROM "grands_prix" WHERE "grand_prix"='Monaco Grand Prix' GROUP BY "pole_position" ORDER BY AVG("rd") 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "How many times each driver has been in the pole position for each Grand Prix, sorted by number of times in descending order and show only top 3?". [/INST] SELECT "pole_position", COUNT("grand_prix") FROM "grands_prix" GROUP BY "pole_position" ORDER BY COUNT("grand_prix") 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "Count the number of unique grand prixs that are constructed by Ferrari where Michael Schumacher held the fastest lap and pole position, also list those unique grand prixs sorted in descending order. Show only the top 5 in the list.". [/INST] SELECT COUNT(DISTINCT "grand_prix"), "grand_prix" FROM "grands_prix" WHERE "fastest_lap"='Michael Schumacher' AND "constructor"='Ferrari' AND "pole_position"='Michael Schumacher' GROUP BY "grand_prix" ORDER BY "grand_prix" 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "Which constructor has the highest number of pole positions in Austrian Grand Prix and how many such instances are there?". [/INST] SELECT "constructor", COUNT("pole_position") AS "num_pole_positions" FROM "grands_prix" WHERE "grand_prix"='Austrian Grand Prix' AND "pole_position" IS NOT NULL GROUP BY "constructor" ORDER BY "num_pole_positions" 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "List the top 5 Grand Prix with the most occurrence of a certain constructor sorted in descending order.". [/INST] SELECT "grand_prix", COUNT("constructor") FROM "grands_prix" WHERE "constructor"='Ferrari' GROUP BY "grand_prix" ORDER BY COUNT("constructor") 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "What is the minimum, maximum and average rd for each grand prix, sorted by average rd in ascending order, limit to the top 10 records?". [/INST] SELECT "grand_prix", MIN("rd"), MAX("rd"), AVG("rd") FROM "grands_prix" GROUP BY "grand_prix" ORDER BY AVG("rd") 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "Who are the top five drivers with the most number of fastest laps for each constructor at the European Grand Prix?". [/INST] SELECT "winning_driver", COUNT("fastest_lap") AS "Number_of_Fastest_Laps" FROM "grands_prix" WHERE "grand_prix"='European Grand Prix' GROUP BY "winning_driver", "constructor" ORDER BY "Number_of_Fastest_Laps" 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 "grands_prix" ( "rd" real, "grand_prix" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "constructor" text, "report" text );. Question: "How many times has Ferrari secured the pole position at each grand prix and name the fastest lap and winning driver for the latest grand prix hosted (based on rd)?". [/INST] SELECT "grand_prix", COUNT("pole_position"), MAX("rd"), "fastest_lap", "winning_driver" FROM "grands_prix" WHERE "constructor"='Ferrari' GROUP BY "grand_prix" ORDER BY "rd" 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 "fed_cup_singles_performances_9" ( "edition" real, "zone" text, "round" text, "date" text, "against" text, "surface" text, "opponent" text, "outcome" text, "result" text );. Question: "What is the count of the different result outcomes for every opponent in round 2R, and list them in descending order by count?". [/INST] SELECT "opponent", COUNT("outcome") FROM "fed_cup_singles_performances_9" WHERE "round"='2R' GROUP BY "opponent" ORDER BY COUNT("outcome") 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 "fed_cup_singles_performances_9" ( "edition" real, "zone" text, "round" text, "date" text, "against" text, "surface" text, "opponent" text, "outcome" text, "result" text );. Question: "How many matches Tina Pisnik played on each surface, ordered by the total matches in descending order and list top 3 surfaces only.". [/INST] SELECT "surface", COUNT("against") AS "matches_played" FROM "fed_cup_singles_performances_9" WHERE "opponent"='Tina Pisnik' GROUP BY "surface" ORDER BY "matches_played" 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 "fed_cup_singles_performances_9" ( "edition" real, "zone" text, "round" text, "date" text, "against" text, "surface" text, "opponent" text, "outcome" text, "result" text );. Question: "What are the number of 2R rounds per surface type sorted in descending order and limiting to the top 5 records?". [/INST] SELECT "surface", COUNT("result") FROM "fed_cup_singles_performances_9" WHERE "round"='2R' GROUP BY "surface" ORDER BY COUNT("result") DESC LIMIT 5;</s>