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 "race_results" ( "rd" real, "name" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "How many drivers have recorded the fastest lap in Datsun Twin 200 race, ordered by the number of times they achieved this in descending order, and limit the result to 5?". [/INST] SELECT "fastest_lap", COUNT("winning_driver") AS "times_recorded" FROM "race_results" WHERE "name"='Datsun Twin 200' GROUP BY "fastest_lap" ORDER BY "times_recorded" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "race_results" ( "rd" real, "name" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "For each racing event, what is the total count of pole positions won by a team, sorted from most to least, and only showing the top 3 teams?". [/INST] SELECT "winning_team", COUNT("pole_position") FROM "race_results" GROUP BY "winning_team" ORDER BY COUNT("pole_position") 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 "race_results" ( "rd" real, "name" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "How many races has Johnny Rutherford had the fastest lap and Al Unser was the pole position, grouped by the winning team with the teams ordered by count in descending order, limited to top 3 teams?". [/INST] SELECT "winning_team", COUNT(*) FROM "race_results" WHERE "winning_driver"='Johnny Rutherford' AND "pole_position"='Al Unser' GROUP BY "winning_team" 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 "race_results" ( "rd" real, "name" text, "pole_position" text, "fastest_lap" text, "winning_driver" text, "winning_team" text, "report" text );. Question: "How many times has a pole position holder named 'Al Unser' resulted in 'Penske Racing' winning the race and what's the report on the fastest driver in those races?". [/INST] SELECT COUNT(*),MAX("fastest_lap") FROM "race_results" WHERE "pole_position"='Al Unser' AND "winning_team"='Penske Racing' GROUP BY "winning_driver";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table_of_world_organization_of_the_scout" ( "country" text, "membership_from_2010" real, "name_of_member_organization" text, "year_current_scouting_organization_joined_wosm" text, "year_member_organization_was_founded" text, "admits_boys_girls" text );. Question: "How many boys and girls admitting scout organizations were founded per country in the year 1926 and joined WOSM in 1930, ordered by the number of these organizations in descending order, but only show the top 5 countries.". [/INST] SELECT COUNT("name_of_member_organization") as "number_of_organization", "country" FROM "table_of_world_organization_of_the_scout" WHERE "year_current_scouting_organization_joined_wosm"='1930' AND "year_member_organization_was_founded"='1926' AND "admits_boys_girls" = 'Yes' GROUP BY "country" ORDER BY COUNT("name_of_member_organization") 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 "table_of_world_organization_of_the_scout" ( "country" text, "membership_from_2010" real, "name_of_member_organization" text, "year_current_scouting_organization_joined_wosm" text, "year_member_organization_was_founded" text, "admits_boys_girls" text );. Question: "What is the count of each type of admissions category (only boys, only girls, both) for all scouting organizations?". [/INST] SELECT "admits_boys_girls", COUNT(*) FROM "table_of_world_organization_of_the_scout" GROUP BY "admits_boys_girls" 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 "table_of_world_organization_of_the_scout" ( "country" text, "membership_from_2010" real, "name_of_member_organization" text, "year_current_scouting_organization_joined_wosm" text, "year_member_organization_was_founded" text, "admits_boys_girls" text );. Question: "How many organizations were founded in each year between 1972 and 1977, that admit both boys and girls, and became WOSM members until 1977, group them by their founding year.". [/INST] SELECT "year_member_organization_was_founded", COUNT("name_of_member_organization") FROM "table_of_world_organization_of_the_scout" WHERE "year_member_organization_was_founded">='1972' AND "year_member_organization_was_founded"<='1977' AND "year_current_scouting_organization_joined_wosm"<='1977' AND "admits_boys_girls"='Both' GROUP BY "year_member_organization_was_founded" ORDER BY "year_member_organization_was_founded" 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 "table_of_world_organization_of_the_scout" ( "country" text, "membership_from_2010" real, "name_of_member_organization" text, "year_current_scouting_organization_joined_wosm" text, "year_member_organization_was_founded" text, "admits_boys_girls" text );. Question: "What's the distribution of the type of admission (boys, girls, both) in the Scout Association of Hong Kong since it joined the World Organization of the Scout Movement?". [/INST] SELECT "admits_boys_girls", COUNT(*) FROM "table_of_world_organization_of_the_scout" WHERE "name_of_member_organization"='The Scout Association of Hong Kong' GROUP BY "admits_boys_girls", "year_current_scouting_organization_joined_wosm";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table_of_world_organization_of_the_scout" ( "country" text, "membership_from_2010" real, "name_of_member_organization" text, "year_current_scouting_organization_joined_wosm" text, "year_member_organization_was_founded" text, "admits_boys_girls" text );. Question: "What is the average year when scouting organizations that admit both boys and girls joined the WOSM, and how many such organizations are there, grouped by the country?". [/INST] SELECT AVG("year_current_scouting_organization_joined_wosm"), COUNT(*) FROM "table_of_world_organization_of_the_scout" WHERE "admits_boys_girls"='Both' GROUP BY "country";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "comparison_table_of_hp_laser_jet_4000_mo" ( "model" real, "introduction" text, "discontinued" text, "cpu_speed" text, "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi" text, "print_speed_ppm" text, "standard_memory" text, "maximum_memory" text );. Question: "List the maximum and minimum CPU speed of models introduced in May 1999, grouped by their print resolution.". [/INST] SELECT "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi", MAX("cpu_speed"), MIN("cpu_speed") FROM "comparison_table_of_hp_laser_jet_4000_mo" WHERE "introduction"='May 1999' GROUP BY "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "comparison_table_of_hp_laser_jet_4000_mo" ( "model" real, "introduction" text, "discontinued" text, "cpu_speed" text, "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi" text, "print_speed_ppm" text, "standard_memory" text, "maximum_memory" text );. Question: "What are the two highest CPU speeds of the models that were introduced in December 2002, sorted in descending order based on their print resolution (DPI)?". [/INST] SELECT "cpu_speed", "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi" FROM "comparison_table_of_hp_laser_jet_4000_mo" WHERE "introduction"='December 2002' ORDER BY "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi" 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 "comparison_table_of_hp_laser_jet_4000_mo" ( "model" real, "introduction" text, "discontinued" text, "cpu_speed" text, "print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi" text, "print_speed_ppm" text, "standard_memory" text, "maximum_memory" text );. Question: "What is the average print speed and highest print resolution of the models introduced in years between 1995 and 2005 and discontinued in or after November 2001, grouped by cpu speed, and ordered by average print speed in ascending order?". [/INST] SELECT "cpu_speed", AVG("print_speed_ppm"), MAX("print_resolution_dpi_resolution_is_given_in_dots_per_inch_dpi") FROM "comparison_table_of_hp_laser_jet_4000_mo" WHERE "discontinued">='November 2001' AND strftime('%Y', "introduction") BETWEEN '1995' AND '2005' GROUP BY "cpu_speed" ORDER BY AVG("print_speed_ppm") 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_1053802_1" ( "region_country" text, "local_title" text, "network" text, "winners" text, "main_presenters" text );. Question: "How many unique networks have hosted La Granja, and who are the main presenters of each of these networks?". [/INST] SELECT "network", COUNT(DISTINCT "main_presenters") FROM "table1_1053802_1" WHERE "local_title"='La Granja' GROUP BY "network";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table 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_1053802_1" ( "region_country" text, "local_title" text, "network" text, "winners" text, "main_presenters" text );. Question: "What is the network with the largest number of main presenters for each country/region in the dataset, including Bulgaria?". [/INST] SELECT "region_country", "network", COUNT("main_presenters") AS "presenter_count" FROM "table1_1053802_1" GROUP BY "region_country", "network" ORDER BY "presenter_count" 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_1053802_1" ( "region_country" text, "local_title" text, "network" text, "winners" text, "main_presenters" text );. Question: "What is the network that has maximum number of winners for each 'Farma' show by region/country and list top 5 regions only?". [/INST] SELECT "region_country", "network", MAX("winners") FROM "table1_1053802_1" WHERE "local_title"='Farma' GROUP BY "region_country", "network" ORDER BY COUNT("winners") 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 "swindon_town_career_details" ( "season" text, "team" text, "league_apps" real, "league_goals" real, "cup_apps" real, "cup_goals" real );. Question: "What is the highest and lowest number of league goals, and the total number of cup goals per season, but showed for only top 5 seasons?". [/INST] SELECT "season", MAX("league_goals"), MIN("league_goals"), SUM("cup_goals") FROM "swindon_town_career_details" GROUP BY "season" ORDER BY SUM("cup_goals") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "swindon_town_career_details" ( "season" text, "team" text, "league_apps" real, "league_goals" real, "cup_apps" real, "cup_goals" real );. Question: "What is the average number of league apps and maximum cup goals for each team per season starting from 1923-24 ordered by maximum cup goals in descending order with a maximum of 10 rows?". [/INST] SELECT "team", AVG("league_apps"), MAX("cup_goals") FROM "swindon_town_career_details" WHERE "season">='1923-24' GROUP BY "team", "season" ORDER BY MAX("cup_goals") 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 "swindon_town_career_details" ( "season" text, "team" text, "league_apps" real, "league_goals" real, "cup_apps" real, "cup_goals" real );. Question: "What is the total number of league goals, maximum number of cup apps and average number of league apps done by each team for the seasons '1911-12', '1912-13', and '1913-14', ordered by total number of league goals in descending order and limit to the top 5.". [/INST] SELECT "team", SUM("league_goals"), MAX("cup_apps"), AVG("league_apps") FROM "swindon_town_career_details" WHERE "season" IN ('1911-12', '1912-13', '1913-14') GROUP BY "team" ORDER BY SUM("league_goals") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "trivia_and_statistics" ( "season" real, "premier" text, "runner_up" text, "score" text, "margin" real, "venue" text, "attendance" real );. Question: "What's the venue of the game with the minimum and maximum attendance where the score was 10.16 (76) – 9.22 (76)? Also, how many times did such score occur?". [/INST] SELECT "venue", MIN("attendance"), MAX("attendance"), COUNT("score") FROM "trivia_and_statistics" WHERE "score"='10.16 (76) – 9.22 (76)' GROUP BY "venue" ORDER BY COUNT("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 "trivia_and_statistics" ( "season" real, "premier" text, "runner_up" text, "score" text, "margin" real, "venue" text, "attendance" real );. Question: "What was the maximum attendance for each venue in the season when the premier was from 1970, and order them by descending order of attendance?". [/INST] SELECT "venue", MAX("attendance") FROM "trivia_and_statistics" WHERE "season"=1970 GROUP BY "venue" ORDER BY MAX("attendance") 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 "trivia_and_statistics" ( "season" real, "premier" text, "runner_up" text, "score" text, "margin" real, "venue" text, "attendance" real );. Question: "What's the total and average attendance at venues where 'Richmond' was the premier and rank these venues by the highest total attendance, limit the results to top 5.". [/INST] SELECT "venue", SUM("attendance") AS Total_Attendance, AVG("attendance") AS Average_Attendance FROM "trivia_and_statistics" WHERE "premier"='Richmond' GROUP BY "venue" ORDER BY Total_Attendance 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 "trivia_and_statistics" ( "season" real, "premier" text, "runner_up" text, "score" text, "margin" real, "venue" text, "attendance" real );. Question: "For each season, what is the minimum and maximum attendance with a score of '8.16 (64) – 8.12 (60)', and how many such games were there?". [/INST] SELECT "season", MIN("attendance"), MAX("attendance"), COUNT(*) FROM "trivia_and_statistics" WHERE "score"='8.16 (64) – 8.12 (60)' GROUP BY "season" ORDER BY "season" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10568553_1" ( "county" text, "location" text, "street_names" text, "milepost" text, "roads_intersected" text, "notes" text );. Question: "How many unique locations are there for each milepost on Anne Street and name the top 5 based on the count in descending order?". [/INST] SELECT "location", COUNT(DISTINCT "milepost") as milepost_count FROM "table1_10568553_1" WHERE "street_names"='Anne Street' GROUP BY "location" ORDER BY milepost_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_10568553_1" ( "county" text, "location" text, "street_names" text, "milepost" text, "roads_intersected" text, "notes" text );. Question: "What are the top 3 longest street names per county, that have at least one intersection, and also provides the locations of these streets?". [/INST] SELECT "county", "street_names", "location", MAX("milepost") FROM "table1_10568553_1" WHERE "roads_intersected" IS NOT NULL GROUP BY "county", "street_names" ORDER BY MAX("milepost") 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_10568553_1" ( "county" text, "location" text, "street_names" text, "milepost" text, "roads_intersected" text, "notes" text );. Question: "What is the most frequent location where Route 24 intersects, and how many times does this intersection occur?". [/INST] SELECT "location", COUNT(*) as count_intersection FROM "table1_10568553_1" WHERE "roads_intersected"='Route 24' GROUP BY "location" ORDER BY count_intersection 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_10568553_1" ( "county" text, "location" text, "street_names" text, "milepost" text, "roads_intersected" text, "notes" text );. Question: "Which counties have more than one location for milepost 12.8 and how many of such locations are there per each county?". [/INST] SELECT "county", COUNT("location") FROM "table1_10568553_1" WHERE "milepost"='12.8' GROUP BY "county" HAVING COUNT("location") > 1 ORDER BY COUNT("location") 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 "major_agricultural_products" ( "commodity" text, "2001_02" real, "2002_03" real, "2003_04" real, "2004_05" real, "2005_06" real, "2006_07" real );. Question: "What are the three commodities with the highest average production over the years 2001-02 to 2006-07?". [/INST] SELECT "commodity", AVG(("2001_02"+"2002_03"+"2003_04"+"2004_05"+"2005_06"+"2006_07")/6) AS "Average Production" FROM "major_agricultural_products" GROUP BY "commodity" ORDER BY "Average Production" 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_1057316_1" ( "serial_number" text, "wheel_arrangement_whyte_notation" text, "build_date" text, "operational_owner_s" text, "disposition" text );. Question: "What is the count of each unique wheel arrangement made by every operational owner during the construction date of April 1892, and order them by this count in descending order. Limit the results to only the top 5.". [/INST] SELECT "operational_owner_s", "wheel_arrangement_whyte_notation", COUNT("wheel_arrangement_whyte_notation") AS "count" FROM "table1_1057316_1" WHERE "build_date"='April 1892' GROUP BY "operational_owner_s", "wheel_arrangement_whyte_notation" 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_1057316_1" ( "serial_number" text, "wheel_arrangement_whyte_notation" text, "build_date" text, "operational_owner_s" text, "disposition" text );. Question: "List the count of different wheel arrangements of trains whose current operational owner is 'Colorado and Southern Railway #9', ordered by the count descending and limited to the top 5 results.". [/INST] SELECT "wheel_arrangement_whyte_notation", COUNT(*) FROM "table1_1057316_1" WHERE "operational_owner_s"='Colorado and Southern Railway #9' GROUP BY "wheel_arrangement_whyte_notation" 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_1057316_1" ( "serial_number" text, "wheel_arrangement_whyte_notation" text, "build_date" text, "operational_owner_s" text, "disposition" text );. Question: "How many distinct operational owners are there in Riverdale, Georgia for each unique wheel arrangement?". [/INST] SELECT COUNT(DISTINCT "operational_owner_s") FROM "table1_1057316_1" WHERE "disposition"='Riverdale, Georgia' GROUP BY "wheel_arrangement_whyte_notation" ORDER BY COUNT(DISTINCT "operational_owner_s") 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_1057316_1" ( "serial_number" text, "wheel_arrangement_whyte_notation" text, "build_date" text, "operational_owner_s" text, "disposition" text );. Question: "How many trains were built per year in descending order and limiting to the top 10?". [/INST] SELECT "build_date", COUNT("serial_number") FROM "table1_1057316_1" GROUP BY "build_date" ORDER BY COUNT("serial_number") 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_1057316_1" ( "serial_number" text, "wheel_arrangement_whyte_notation" text, "build_date" text, "operational_owner_s" text, "disposition" text );. Question: "Count the different types of wheel arrangements and their quantities, for trains owned by Texas and New Orleans Railroad #319, also order them from most to least prevalent.". [/INST] SELECT "wheel_arrangement_whyte_notation", COUNT(*) as "Quantity" FROM "table1_1057316_1" WHERE "operational_owner_s" LIKE '%Texas and New Orleans Railroad #%319%' GROUP BY "wheel_arrangement_whyte_notation" ORDER BY "Quantity" 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 "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "In which year most of the colleges with the men's nickname as 'Blazers' joined the institution and what is the average enrollment for such colleges?". [/INST] SELECT "joined", COUNT("institution"), AVG("enrollment") FROM "former_members" WHERE "men_s_nickname"='Blazers' GROUP BY "joined" ORDER BY COUNT("institution") 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 "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "Calculate the average enrollment for each type of institution where women's nickname is 'Wolfpack' and sort them by their joined year, limiting to top 5 results.". [/INST] SELECT AVG("enrollment"), "type" FROM "former_members" WHERE "women_s_nickname"='Wolfpack' GROUP BY "type" ORDER BY "joined" 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 "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "What was the average enrollment for institutions where the Lady Pilots left, grouping them by the year they left and ordering the result by the average enrollment in descending order? Limit the result to the top 5.". [/INST] SELECT "left", AVG("enrollment") FROM "former_members" WHERE "women_s_nickname"='Lady Pilots' GROUP BY "left" ORDER BY AVG("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 "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "What are the different institutions in Mobile, Alabama where the enrollment is 1500, and what are the earliest and latest years these institutions were founded?". [/INST] SELECT "institution", MIN("founded"), MAX("founded") FROM "former_members" WHERE "enrollment"=1500 AND "location"='Mobile, Alabama' GROUP BY "institution" ORDER BY "institution";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "How many different types of institutions in each conference are there in Jackson, Mississippi, order the results by the count of institution types in descending order?". [/INST] SELECT "current_conference", COUNT(DISTINCT "type") as count_types FROM "former_members" WHERE "location"='Jackson, Mississippi' GROUP BY "current_conference" ORDER BY count_types 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 "former_members" ( "institution" text, "location" text, "men_s_nickname" text, "women_s_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text, "left" text, "current_conference" text, "classification" text );. Question: "What is the men's nickname at the school that has the lady wildcats women's nickname, and what's the largest enrollment among such schools?". [/INST] SELECT "men_s_nickname", MAX("enrollment") FROM "former_members" WHERE "women_s_nickname"='Lady Wildcats' GROUP BY "men_s_nickname" ORDER BY "enrollment" DESC LIMIT 1;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_members" ( "institution" text, "location" text, "mens_nickname" text, "womens_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text );. Question: "What is the average enrollment for each type of institution in Jacksonville, Florida, ordered by enrollment size, and limit to the top 5?". [/INST] SELECT "type", AVG("enrollment") as average_enrollment FROM "current_members" WHERE "location"='Jacksonville, Florida' GROUP BY "type" 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 "current_members" ( "institution" text, "location" text, "mens_nickname" text, "womens_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text );. Question: "What is the average enrollment for each type of institution that was founded in 1866 and is a Private/(African Methodist) type, ordered by the date they joined and capped to 5 results?". [/INST] SELECT AVG("enrollment"), "type" FROM "current_members" WHERE "founded"=1866 AND "type"='Private/(African Methodist)' GROUP BY "type" ORDER BY "joined" LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_members" ( "institution" text, "location" text, "mens_nickname" text, "womens_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text );. Question: "What is the average year of foundation and total enrollment count for each type of institution, ordered by total enrollment count, for institutions located in Nashville, Tennessee?". [/INST] SELECT "type", AVG("founded"), SUM("enrollment") FROM "current_members" WHERE "location"='Nashville, Tennessee' GROUP BY "type" ORDER BY SUM("enrollment") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_members" ( "institution" text, "location" text, "mens_nickname" text, "womens_nickname" text, "founded" real, "type" text, "enrollment" real, "joined" text );. Question: "How many institutions of each type have joined each year in descending order of number of institutions, limiting the result to the top 10?". [/INST] SELECT "type", "joined", COUNT("institution") as "number_of_institutions" FROM "current_members" GROUP BY "type", "joined" ORDER BY COUNT("institution") 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_in_table" text );. Question: "How many vacancies occured for each team before the date of appointment of "Alex McLeish" on "28 November 2007" and what was the earliest and latest date of those vacancies?". [/INST] SELECT "team", COUNT("date_of_vacancy"), MIN("date_of_vacancy"), MAX("date_of_vacancy") FROM "managerial_changes" WHERE "date_of_appointment" < '2007-11-28' AND "replaced_by" = 'Alex McLeish' GROUP BY "team" ORDER BY COUNT("date_of_vacancy") 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_in_table" text );. Question: "What is the earliest and latest date of appointment of a manager, grouped by team, for vacancies that occurred after 21 December 2007, and provide only top 3 records when sorted by team name?". [/INST] SELECT "team", MIN("date_of_appointment"), MAX("date_of_appointment") FROM "managerial_changes" WHERE "date_of_vacancy" > '21 December 2007' GROUP BY "team" ORDER BY "team" 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 "managerial_changes" ( "team" text, "outgoing_manager" text, "manner_of_departure" text, "date_of_vacancy" text, "replaced_by" text, "date_of_appointment" text, "position_in_table" text );. Question: "What's the maximum, minimum, and average position in the table when each manager was replaced at Wigan Athletic and provide the count as well? Order the results by date of appointment and limit only the top 10.". [/INST] SELECT "replaced_by", MAX("position_in_table"), MIN("position_in_table"), AVG("position_in_table"), COUNT(*) FROM "managerial_changes" WHERE "team"='Wigan Athletic' GROUP BY "replaced_by" ORDER BY "date_of_appointment" 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_in_table" text );. Question: "What is the maximum and minimum date of vacancy when the team is Manchester City and replaced by any manager, ordered by the date of vacancy from latest to earliest considering only top 5 records?". [/INST] SELECT MAX("date_of_vacancy"), MIN("date_of_vacancy") FROM "managerial_changes" WHERE "team"='Manchester City' GROUP BY "replaced_by" ORDER BY MAX("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, "position_in_table" text );. Question: "What is the earliest and latest date of appointment for managers who replaced Roy Hodgson, and the number of times this occurred?". [/INST] SELECT MIN("date_of_appointment"), MAX("date_of_appointment"), COUNT(*) FROM "managerial_changes" WHERE "replaced_by"='Roy Hodgson';</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table 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_in_table" text );. Question: "How many managerial changes have occurred per team in a pre-season position, and what's the latest date of appointment per team?". [/INST] SELECT "team", COUNT("outgoing_manager"), MAX("date_of_appointment") FROM "managerial_changes" WHERE "position_in_table"='Pre-season' GROUP BY "team" ORDER BY COUNT("outgoing_manager") DESC, MAX("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 "table1_1059743_1" ( "rank" real, "member_association" text, "points" text, "group_stage" real, "play_off" real, "afc_cup" real );. Question: "What is the highest rank of the member association with the most games having a score value of 813.5 in post-season play grouped by member association?". [/INST] SELECT "member_association", MAX("rank") FROM "table1_1059743_1" WHERE "points"='813.5' GROUP BY "member_association" ORDER BY COUNT("play_off") 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_1059743_1" ( "rank" real, "member_association" text, "points" text, "group_stage" real, "play_off" real, "afc_cup" real );. Question: "What is the maximum points achieved by any team in the group stage, showing only the top five ranks?". [/INST] SELECT "rank", "member_association", MAX("group_stage") as Maximum_Group_Stage_Points FROM "table1_1059743_1" WHERE "points" > '860.5' GROUP BY "member_association" ORDER BY Maximum_Group_Stage_Points DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "2009_season_schedule" ( "date" text, "opponent" text, "home_away" text, "score" text, "high_points" text, "high_rebounds" text, "high_assists" text, "location_attendance" text, "record" text );. Question: "What was the highest number of points, rebounds, and assists achieved so far across all the games when the team reached a record of 6-9 and how many people in each of these games had attended by location?". [/INST] SELECT MAX("high_points"), MAX("high_rebounds"), MAX("high_assists"), "location_attendance", COUNT("location_attendance") FROM "2009_season_schedule" WHERE "record"='6-9' GROUP BY "location_attendance" ORDER BY "location_attendance" DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_members" ( "institution" text, "nickname" text, "location" text, "founded" real, "type" text, "enrollment" real );. Question: "How many universities of each type are there in each location with enrollment greater than 5000, and what is the average founding year for each type, ordered by the total number of universities in descending order with a limit of 10?". [/INST] SELECT COUNT("institution"), "type", "location", AVG("founded") FROM "current_members" WHERE "enrollment" > 5000 AND "institution" like 'Point Park University' GROUP BY "type", "location" ORDER BY COUNT("institution") 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 "current_members" ( "institution" text, "nickname" text, "location" text, "founded" real, "type" text, "enrollment" real );. Question: "What's the oldest institution, considering only the maximum founding year, for the top 3 private institutions in terms of enrollment located in Wilmore, Kentucky, and group the result based on the nickname of institutions.". [/INST] SELECT MAX("founded"), "nickname" FROM "current_members" WHERE "type"='Private' AND "location"='Wilmore, Kentucky' GROUP BY "nickname" ORDER BY "enrollment" 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 "current_members" ( "institution" text, "nickname" text, "location" text, "founded" real, "type" text, "enrollment" real );. Question: "What are the distinct types of institutions for universities in the same location as Point Park University and show the count of each type?". [/INST] SELECT "type", COUNT(*) as "institutions_count" FROM "current_members" WHERE "location"= (SELECT "location" FROM "current_members" WHERE "institution"='Point Park University') GROUP BY "type";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "current_members" ( "institution" text, "nickname" text, "location" text, "founded" real, "type" text, "enrollment" real );. Question: "What is the maximum, minimum and average enrollment values for each type of institution in Carlow University 1?". [/INST] SELECT MAX("enrollment"), MIN("enrollment"), AVG("enrollment") FROM "current_members" WHERE "institution"='Carlow University 1' GROUP BY "type";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table 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_10610087_6" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text );. Question: "Provide a list of the top 5 episodes that were written by the same writer as the episode titled "Black", ordered by their season number and limit the result to 5 episodes.". [/INST] SELECT "title", "no_in_season" FROM "table1_10610087_6" WHERE "written_by" IN (SELECT "written_by" FROM "table1_10610087_6" WHERE "title"='\"Black\"') ORDER BY "no_in_season" 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_10610087_6" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text );. Question: "How many episodes per season are written by each writer, taking into account only the first five seasons and order them in descending order?". [/INST] SELECT "written_by", COUNT("title") FROM "table1_10610087_6" WHERE "no_in_season" <= 5 GROUP BY "written_by", "no_in_season" ORDER BY COUNT("title") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10610087_3" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text );. Question: "What is the earliest and latest original air date of episodes that are number 9 in their respective seasons, and how many such episodes are there, sorted by the dates in descending order.". [/INST] SELECT MIN("original_air_date"), MAX("original_air_date"), COUNT(*) FROM "table1_10610087_3" WHERE "no_in_season"=9 GROUP BY "no_in_season" ORDER BY "original_air_date" DESC LIMIT 10;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "table1_10610087_3" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text );. Question: "How many unique episodes are directed by the person who directed the most episodes written by Denis Leary, Peter Tolan and Evan Reilly, and what are the first 5 titles of these episodes ordered by the number of the episode in the season.". [/INST] SELECT COUNT(DISTINCT "title"), "title" FROM "table1_10610087_3" WHERE "directed_by" IN (SELECT "directed_by" FROM "table1_10610087_3" WHERE "written_by" LIKE '%Denis Leary%' or "written_by" LIKE '%Peter Tolan%' or "written_by" LIKE '%Evan Reilly%' GROUP BY "directed_by" ORDER BY COUNT(*) DESC LIMIT 1) GROUP BY "title" ORDER BY "no_in_season" 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_10610087_3" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "original_air_date" text );. Question: "How many episodes titled "Voicemail" were there and who were they directed by, organized by the director's name?". [/INST] SELECT "directed_by", COUNT(*) FROM "table1_10610087_3" WHERE "title"='\"Voicemail\"' GROUP BY "directed_by" ORDER BY "directed_by" 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_effects" ( "name" text, "dates_active" text, "peak_classification" text, "windspeeds" text, "pressure" text, "areas_affected" text, "damage_usd" text, "deaths" text, "refs" text );. Question: "What is the maximum, minimum, and average windspeed of hurricanes grouped by their peak classification which were active during the same date range as 'Kamba', and rank them in descending order by the maximum windspeed?". [/INST] SELECT "peak_classification", MAX("windspeeds"), MIN("windspeeds"), AVG("windspeeds") FROM "season_effects" WHERE "dates_active"=(SELECT "dates_active" FROM "season_effects" WHERE "name"='Kamba') GROUP BY "peak_classification" ORDER BY MAX("windspeeds") 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 "season_effects" ( "name" text, "dates_active" text, "peak_classification" text, "windspeeds" text, "pressure" text, "areas_affected" text, "damage_usd" text, "deaths" text, "refs" text );. Question: "What is the average pressure of cyclones causing a maximum of 95km/h (60mph) wind speeds, grouped by their peak classification and name?". [/INST] SELECT "peak_classification", "name", AVG("pressure") FROM "season_effects" WHERE "windspeeds"='95km/h (60mph)' GROUP BY "peak_classification", "name";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "season_effects" ( "name" text, "dates_active" text, "peak_classification" text, "windspeeds" text, "pressure" text, "areas_affected" text, "damage_usd" text, "deaths" text, "refs" text );. Question: "What are the name, pressure, and damage in USD for the storms with the top 5 highest death rates, sorted by their death rates, and how many areas did they affect?". [/INST] SELECT "name", "pressure", "damage_usd", COUNT("areas_affected") FROM "season_effects" WHERE "deaths" IN (SELECT "deaths" FROM "season_effects" ORDER BY "deaths" DESC LIMIT 5) GROUP BY "name", "pressure", "damage_usd" ORDER BY "deaths" 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 "season_effects" ( "name" text, "dates_active" text, "peak_classification" text, "windspeeds" text, "pressure" text, "areas_affected" text, "damage_usd" text, "deaths" text, "refs" text );. Question: "What was the total damage (usd) from the cyclones grouped by their peak_classification that measured 1003hPa (29.62inHg) pressure and show only top 3 based on total damage in decreasing order?". [/INST] SELECT "peak_classification", SUM("damage_usd") AS total_damage FROM "season_effects" WHERE "pressure"='1003hPa (29.62inHg)' GROUP BY "peak_classification" ORDER BY total_damage 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 "batting_averages" ( "player" text, "matches" real, "inns" real, "n_o" real, "runs" real, "high_score" real, "average" text, "100" real, "50" real, "catches" real, "stump" real );. Question: "What's the total number of matches played, average runs scored, maximum and minimum innings per player where the high score is above 120, ordered by the highest number of matches, and only show the top 10 players.". [/INST] SELECT "player", SUM("matches"), AVG("runs"), MAX("inns"), MIN("inns") FROM "batting_averages" WHERE "high_score" > 120 GROUP BY "player" ORDER BY SUM("matches") 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 "batting_averages" ( "player" text, "matches" real, "inns" real, "n_o" real, "runs" real, "high_score" real, "average" text, "100" real, "50" real, "catches" real, "stump" real );. Question: "Who are the top 10 players with the greatest number of games played and how many half-centuries (50) and no-outs (n/o) they have, given that they have at least two half-centuries and no outs?". [/INST] SELECT "player", COUNT("matches"), SUM("50"), SUM("n_o") FROM "batting_averages" WHERE "50">=2 AND "n_o"=0 GROUP BY "player" ORDER BY COUNT("matches") 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 "batting_averages" ( "player" text, "matches" real, "inns" real, "n_o" real, "runs" real, "high_score" real, "average" text, "100" real, "50" real, "catches" real, "stump" real );. Question: "What is the player name, total runs scored, and average catches, for those players who have played more than 21 innings, sorted by the total runs and limited to top 5 players?". [/INST] SELECT "player", SUM("runs"), AVG("catches") FROM "batting_averages" WHERE "inns" > 21 GROUP BY "player" 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 "general_election_results" ( "general_election" real, "num_of_candidates" real, "num_of_seats_won" real, "pct_of_popular_vote" text, "result" text );. Question: "Count the number of candidates and seats won in each general election where PQ majority was achieved and the percentage of the popular vote was at least 44.75%. Order the results by the election year in ascending order and display only the first 5 records.". [/INST] SELECT "general_election", COUNT("num_of_candidates"), SUM("num_of_seats_won") FROM "general_election_results" WHERE "result"='PQ majority' AND CAST(REPLACE("pct_of_popular_vote", '%', '') AS REAL) >= 44.75 GROUP BY "general_election" ORDER BY "general_election" 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 "general_election_results" ( "general_election" real, "num_of_candidates" real, "num_of_seats_won" real, "pct_of_popular_vote" text, "result" text );. Question: "In each general election year, what is the least number of candidates running for when 80 or more seats were won, and what is the result in those cases? Order the result by year in ascending order and limit to the top 5 results.". [/INST] SELECT "general_election", MIN("num_of_candidates"), "result" FROM "general_election_results" WHERE "num_of_seats_won">=80 GROUP BY "general_election","result" ORDER BY "general_election" 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 "general_election_results" ( "general_election" real, "num_of_candidates" real, "num_of_seats_won" real, "pct_of_popular_vote" text, "result" text );. Question: "What is the average number of seats won in the top 3 elections with the highest number of candidates, and what was their percentage of the popular vote?". [/INST] SELECT AVG("num_of_seats_won"), "pct_of_popular_vote" FROM "general_election_results" GROUP BY "pct_of_popular_vote" HAVING "num_of_candidates" IN (SELECT "num_of_candidates" FROM "general_election_results" ORDER BY "num_of_candidates" 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 "regular_season" ( "week" real, "date" text, "opponent" text, "result" text, "game_site" text, "record" text, "attendance" real );. Question: "What is the maximum weekly attendance, the minimum weekly attendance, and the average weekly attendance at each game site, ordered by the number of games held at each site, from highest to lowest?". [/INST] SELECT "game_site", MAX("attendance"), MIN("attendance"), AVG("attendance"), COUNT("week") FROM "regular_season" GROUP BY "game_site" ORDER BY COUNT("week") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "regular_season" ( "week" real, "date" text, "opponent" text, "result" text, "game_site" text, "record" text, "attendance" real );. Question: "Can you provide the total attendance by week for games against the Indianapolis Colts, in ascending order of the week?". [/INST] SELECT "week", SUM("attendance") FROM "regular_season" WHERE "opponent"='Indianapolis Colts' GROUP BY "week" ORDER BY "week" 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 "regular_season" ( "week" real, "date" text, "opponent" text, "result" text, "game_site" text, "record" text, "attendance" real );. Question: "On December 16, 1985, how many unique records were there, ordered by their frequency, list the first 10?". [/INST] SELECT "record", COUNT(*) as frequency FROM "regular_season" WHERE "date"='December 16, 1985' GROUP BY "record" ORDER BY frequency 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 "game_by_game_results" ( "week" real, "date" text, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What was the average attendance for games where the team had a record of 0-4, grouped by each opposing team, and ordered by the highest to lowest average attendance?". [/INST] SELECT "opponent", AVG("attendance") AS Average_Attendance FROM "game_by_game_results" WHERE "record"='0-4' GROUP BY "opponent" ORDER BY Average_Attendance 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 "game_by_game_results" ( "week" real, "date" text, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What is the maximum and minimum attendance for all the games played each week that took place on the date 'October 11, 1969', ordered by weeks in ascending order with a limit of 5 results.". [/INST] SELECT "week", MAX("attendance"), MIN("attendance") FROM "game_by_game_results" WHERE "date"='October 11, 1969' GROUP BY "week" ORDER BY "week" 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 "game_by_game_results" ( "week" real, "date" text, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "Give me the sum of attendances, the average attendance, and the game result, for each unique week that includes the date November 9, 1969, ordered by the sum of attendances in descending order and limited to the top 5 records.". [/INST] SELECT SUM("attendance"), AVG("attendance"), "result" FROM "game_by_game_results" WHERE "date"='November 9, 1969' GROUP BY "week" ORDER BY SUM("attendance") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "game_by_game_results" ( "week" real, "date" text, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What are the three dates with the highest attendance at War Memorial Stadium, sorted in descending order, and how many records were there on each of those dates?". [/INST] SELECT "date", COUNT("record") as record_count FROM "game_by_game_results" WHERE "stadium"='War Memorial Stadium' GROUP BY "date" ORDER BY "attendance" DESC LIMIT 3;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "game_by_game_results" ( "week" real, "date" text, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What was the maximum, minimum, and average attendance at each stadium where matches were held on December 7, 1969, ordered according to the highest average attendance to the lowest?". [/INST] SELECT "stadium", MAX("attendance"), MIN("attendance"), AVG("attendance") FROM "game_by_game_results" WHERE "date"='December 7, 1969' GROUP BY "stadium" ORDER BY AVG("attendance") 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 "schedule" ( "week" real, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What is the maximum and minimum attendance at the Memorial Stadium, and how many games were played there in total, grouped by result type?". [/INST] SELECT "result", MAX("attendance"), MIN("attendance"), COUNT(*) FROM "schedule" WHERE "stadium"='Memorial Stadium' GROUP BY "result";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "schedule" ( "week" real, "opponent" text, "result" text, "stadium" text, "record" text, "attendance" real );. Question: "What is the maximum and minimum attendance at each stadium for games played until week 5?". [/INST] SELECT "stadium", MAX("attendance"), MIN("attendance") FROM "schedule" WHERE "week"<=5 GROUP BY "stadium";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What is the highest, lowest and average probability of the 1st player winning if the probability of a draw is less than 10% and the 2nd player chooses 'B BR', grouped by the first player's choice and ordered by average probability in descending order.". [/INST] SELECT "1st_players_choice", MAX("probability_1st_player_wins"), MIN("probability_1st_player_wins"), AVG("probability_1st_player_wins") FROM "variation_with_playing_cards" WHERE CAST(REPLACE("probability_of_a_draw", '%', '') AS FLOAT) < 10 AND "2nd_players_choice"='B BR' GROUP BY "1st_players_choice" ORDER BY AVG("probability_1st_player_wins") DESC;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What are the top 3 distinct second player's choices when the first player selects 'RB B', ranked in descending order by the count of each choice?". [/INST] SELECT "2nd_players_choice", COUNT("2nd_players_choice") as count FROM "variation_with_playing_cards" WHERE "1st_players_choice"='RB B' GROUP BY "2nd_players_choice" 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 "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What is the maximum, minimum and average probabilities of the second player winning, grouped by the first player's choice, where the second player's choice is R RB and the probabilities of the first player winning is less than 5.18%? Also, provide these records in descending order by average probabilities and limit the result to top 5.". [/INST] SELECT "1st_players_choice", MAX("probability_2nd_player_wins"), MIN("probability_2nd_player_wins"), AVG("probability_2nd_player_wins") FROM "variation_with_playing_cards" WHERE "2nd_players_choice"='R RB' AND "probability_1st_player_wins" < '5.18%' GROUP BY "1st_players_choice" ORDER BY AVG("probability_2nd_player_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 "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What are the top 5 choices of the first player when the second player has the maximum chance of winning with the choice "R RB", and what is the average probability that the first player will win in these circumstances?". [/INST] SELECT "1st_players_choice", AVG("probability_1st_player_wins") FROM "variation_with_playing_cards" WHERE "2nd_players_choice"='R RB' GROUP BY "1st_players_choice" ORDER BY "probability_2nd_player_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 "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What is the highest, lowest and average probability of player 2 winning grouped by the choice of player 1, sorted in descending order of highest probability, and limited to the top 5 choices of player 1?". [/INST] SELECT "1st_players_choice", MAX("probability_2nd_player_wins"), MIN("probability_2nd_player_wins"), AVG("probability_2nd_player_wins") FROM "variation_with_playing_cards" GROUP BY "1st_players_choice" ORDER BY MAX("probability_2nd_player_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 "variation_with_playing_cards" ( "1st_players_choice" text, "2nd_players_choice" text, "probability_1st_player_wins" text, "probability_2nd_player_wins" text, "probability_of_a_draw" text );. Question: "What is the average probability of winning for the first player, the highest and lowest probabilities of winning for the second player, and the total count of draws grouped by the second player's choice, when the second player's chance of winning is greater than or equal to 50%, and limited to 5 highest probability instances?". [/INST] SELECT "2nd_players_choice", AVG("probability_1st_player_wins"), MAX("probability_2nd_player_wins"),MIN("probability_2nd_player_wins"), COUNT("probability_of_a_draw") FROM "variation_with_playing_cards" WHERE "probability_2nd_player_wins" >= '50%' GROUP BY "2nd_players_choice" ORDER BY AVG("probability_1st_player_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 "nfl_draft" ( "pick_num" real, "nfl_team" text, "player" text, "position" text, "college" text );. Question: "In which NFL team did player named Thane Gash serve, and how many unique positions has he played across all teams, order by team name ascending limit to the first two records.". [/INST] SELECT "nfl_team", COUNT(DISTINCT "position") FROM "nfl_draft" WHERE "player"='Thane Gash' GROUP BY 'nfl_team' ORDER BY 'nfl_team' ASC 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 "nfl_draft" ( "pick_num" real, "nfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the maximum and minimum pick number where player is Anthony Blaylock, grouped by their position and ordered by maximum pick number in descending order, and show only the top 5 records.". [/INST] SELECT "position", MAX("pick_num"), MIN("pick_num") FROM "nfl_draft" WHERE "player"='Anthony Blaylock' GROUP BY "position" ORDER BY MAX("pick_num") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nfl_draft" ( "pick_num" real, "nfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the count of all unique positions per each college for the player 'Clifford Charlton' who are picked by their respective nfl teams?". [/INST] SELECT "college", COUNT(DISTINCT "position") FROM "nfl_draft" WHERE "player"='Clifford Charlton' GROUP BY "college";</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nfl_draft" ( "pick_num" real, "nfl_team" text, "player" text, "position" text, "college" text );. Question: "How many players from each college have played the same position as Anthony Blaylock". [/INST] SELECT COUNT("player"), "college" FROM "nfl_draft" WHERE "position"=(SELECT "position" FROM "nfl_draft" WHERE "player"='Anthony Blaylock') GROUP BY "college" ORDER BY COUNT("player") DESC LIMIT 5;</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the question. <</SYS>> CREATE TABLE statement: CREATE TABLE "nfl_draft" ( "pick_num" real, "nfl_team" text, "player" text, "position" text, "college" text );. Question: "What is the average and maximum pick number for each position and which team has selected the player for these positions?". [/INST] SELECT "position", AVG("pick_num"), MAX("pick_num"), "nfl_team" FROM "nfl_draft" GROUP BY "position", "nfl_team" ORDER BY "pick_num" 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_area_and_density_sortable_on_" ( "province" text, "population_2004_estimate" real, "area_km" real, "density" text, "gdp_2003_pps_in_mil" real, "gdp_per_cap_2003_in" real );. Question: "What is the maximum and minimum GDP per capita in 2003 for provinces with a density of 971.4 or higher grouped by province, and ordered by GDP per capita in descending order with a limit of 5 provinces?". [/INST] SELECT "province", MAX("gdp_per_cap_2003_in"), MIN("gdp_per_cap_2003_in") FROM "population_area_and_density_sortable_on_" WHERE CAST("density" as REAL)>=971.4 GROUP BY "province" ORDER BY MAX("gdp_per_cap_2003_in") 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_area_and_density_sortable_on_" ( "province" text, "population_2004_estimate" real, "area_km" real, "density" text, "gdp_2003_pps_in_mil" real, "gdp_per_cap_2003_in" real );. Question: "What is the average GDP per capita across all provinces and how does Friesland's minimum and maximum GDP per capita compare to this average?". [/INST] SELECT AVG("gdp_per_cap_2003_in") AS average_gdp_per_capita, MIN("gdp_per_cap_2003_in") AS min_gdp_per_capita_friesland, MAX("gdp_per_cap_2003_in") AS max_gdp_per_capita_friesland FROM "population_area_and_density_sortable_on_" WHERE "province"='Friesland' GROUP BY "province" HAVING "province"='Friesland';</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table 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_area_and_density_sortable_on_" ( "province" text, "population_2004_estimate" real, "area_km" real, "density" text, "gdp_2003_pps_in_mil" real, "gdp_per_cap_2003_in" real );. Question: "What is the total area of provinces with population densities less than 331.4 and what is the average of those areas?". [/INST] SELECT SUM("area_km"), AVG("area_km") FROM "population_area_and_density_sortable_on_" WHERE "density" < '331.4';</s>
<s>[INST] <<SYS>> You are an expert in SQL and data analysis. Given the table 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_area_and_density_sortable_on_" ( "province" text, "population_2004_estimate" real, "area_km" real, "density" text, "gdp_2003_pps_in_mil" real, "gdp_per_cap_2003_in" real );. Question: "What is the total area for the provinces that have the top 5 GDP in 2003 (in million euros)?". [/INST] SELECT SUM("area_km") FROM "population_area_and_density_sortable_on_" WHERE "province" IN (SELECT "province" FROM "population_area_and_density_sortable_on_" ORDER BY "gdp_2003_pps_in_mil" 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_area_and_density_sortable_on_" ( "province" text, "population_2004_estimate" real, "area_km" real, "density" text, "gdp_2003_pps_in_mil" real, "gdp_per_cap_2003_in" real );. Question: "What are the top 5 provinces by population estimate in 2004 for places that had a GDP equal to or greater than 18496€ million euro in 2003, sorted by population in descending order?". [/INST] SELECT "province", "population_2004_estimate" FROM "population_area_and_density_sortable_on_" WHERE "gdp_2003_pps_in_mil">=18496 ORDER BY "population_2004_estimate" 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_10701133_1" ( "no_in_series" real, "no_in_season" 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 directors directed episodes that aired on distinct dates and show the top five based on the count, in descending order.". [/INST] SELECT "directed_by", COUNT(DISTINCT "original_air_date") AS distinct_air_dates FROM "table1_10701133_1" GROUP BY "directed_by" ORDER BY distinct_air_dates 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_10701133_1" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "featured_character_s" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "What is the highest and lowest no. in season for each director, and what is the average no. in season for each director, also list only top 10 directors whose average is highest?". [/INST] SELECT "directed_by", MAX("no_in_season"), MIN("no_in_season"), AVG("no_in_season") FROM "table1_10701133_1" GROUP BY "directed_by" ORDER BY AVG("no_in_season") 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_10701133_1" ( "no_in_series" real, "no_in_season" real, "title" text, "directed_by" text, "written_by" text, "featured_character_s" text, "original_air_date" text, "u_s_viewers_million" text );. Question: "Which director has the highest number of episodes that garnered at least 12.90 million U.S. viewers on their original air date?". [/INST] SELECT "directed_by", COUNT("title") AS "no_of_episodes" FROM "table1_10701133_1" WHERE "u_s_viewers_million" >= '12.90' GROUP BY "directed_by" ORDER BY "no_of_episodes" 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_1067134_1" ( "dvd_name" text, "num_of_ep" real, "region_1" text, "region_2" text, "region_4" text );. Question: "What is the maximum and minimum number of episodes aired across all DVDs in Region 2 beginning May 26, 2008, and how many such DVDs were there?". [/INST] SELECT MAX("num_of_ep"), MIN("num_of_ep"), COUNT("dvd_name") FROM "table1_1067134_1" WHERE "region_2"='May 26, 2008';</s>