db_name
stringclasses 146
values | prompt
stringlengths 310
4.81k
|
|---|---|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# List name, dates active, and number of deaths for all storms with at least 1 death.
#
### SQL:
#
# SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names, dates active, and number of deaths for storms that had 1 or more death?
#
### SQL:
#
# SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show the average and maximum damage for all storms with max speed higher than 1000.
#
### SQL:
#
# SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What is the average and maximum damage in millions for storms that had a max speed over 1000?
#
### SQL:
#
# SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What is the total number of deaths and damage for all storms with a max speed greater than the average?
#
### SQL:
#
# SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.
#
### SQL:
#
# SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# List name and damage for all storms in a descending order of max speed.
#
### SQL:
#
# SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names and damage in millions for storms, ordered by their max speeds descending?
#
### SQL:
#
# SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# How many regions are affected?
#
### SQL:
#
# SELECT count(DISTINCT region_id) FROM affected_region
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Count the number of different affected regions.
#
### SQL:
#
# SELECT count(DISTINCT region_id) FROM affected_region
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show the name for regions not affected.
#
### SQL:
#
# SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of regions that were not affected?
#
### SQL:
#
# SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show the name for regions and the number of storms for each region.
#
### SQL:
#
# SELECT T1.region_name , count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# How many storms occured in each region?
#
### SQL:
#
# SELECT T1.region_name , count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# List the name for storms and the number of affected regions for each storm.
#
### SQL:
#
# SELECT T1.name , count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# How many regions were affected by each storm?
#
### SQL:
#
# SELECT T1.name , count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What is the storm name and max speed which affected the greatest number of regions?
#
### SQL:
#
# SELECT T1.name , T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Return the name and max speed of the storm that affected the most regions.
#
### SQL:
#
# SELECT T1.name , T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show the name of storms which don't have affected region in record.
#
### SQL:
#
# SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of storms that did not affect any regions?
#
### SQL:
#
# SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region)
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show storm name with at least two regions and 10 cities affected.
#
### SQL:
#
# SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING count(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected) >= 10
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?
#
### SQL:
#
# SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING count(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected) >= 10
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show all storm names except for those with at least two affected regions.
#
### SQL:
#
# SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING count(*) >= 2
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of storms that did not affect two or more regions?
#
### SQL:
#
# SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING count(*) >= 2
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the region names affected by the storm with a number of deaths of least 10?
#
### SQL:
#
# SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Return the names of the regions affected by storms that had a death count of at least 10.
#
### SQL:
#
# SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show all storm names affecting region "Denmark".
#
### SQL:
#
# SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of the storms that affected Denmark?
#
### SQL:
#
# SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Show the region name with at least two storms.
#
### SQL:
#
# SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*) >= 2
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of regions with two or more storms?
#
### SQL:
#
# SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*) >= 2
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Find the names of the regions which were affected by the storm that killed the greatest number of people.
#
### SQL:
#
# SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of regions that were affected by the storm in which the most people died?
#
### SQL:
#
# SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# Find the name of the storm that affected both Afghanistan and Albania regions.
#
### SQL:
#
# SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'
#
### End.
|
storm_record
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# storm ( Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths )
# region ( Region_id, Region_code, Region_name )
# affected_region ( Region_id, Storm_ID, Number_city_affected )
#
# affected_region.Storm_ID can be joined with storm.Storm_ID
# affected_region.Region_id can be joined with region.Region_id
#
### Question:
#
# What are the names of the storms that affected both the regions of Afghanistan and Albania?
#
### SQL:
#
# SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# How many counties are there in total?
#
### SQL:
#
# SELECT count(*) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Count the total number of counties.
#
### SQL:
#
# SELECT count(*) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the county name and population of all counties.
#
### SQL:
#
# SELECT County_name , Population FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the name and population of each county?
#
### SQL:
#
# SELECT County_name , Population FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the average population of all counties.
#
### SQL:
#
# SELECT avg(Population) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# On average how large is the population of the counties?
#
### SQL:
#
# SELECT avg(Population) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Return the maximum and minimum population among all counties.
#
### SQL:
#
# SELECT max(Population) , min(Population) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the maximum and minimum population of the counties?
#
### SQL:
#
# SELECT max(Population) , min(Population) FROM county
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show all the distinct districts for elections.
#
### SQL:
#
# SELECT DISTINCT District FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the distinct districts for elections?
#
### SQL:
#
# SELECT DISTINCT District FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the zip code of the county with name "Howard".
#
### SQL:
#
# SELECT Zip_code FROM county WHERE County_name = "Howard"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What is the zip code the county named "Howard" is located in?
#
### SQL:
#
# SELECT Zip_code FROM county WHERE County_name = "Howard"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the delegate from district 1 in election.
#
### SQL:
#
# SELECT Delegate FROM election WHERE District = 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Who is the delegate of district 1 in the elections?
#
### SQL:
#
# SELECT Delegate FROM election WHERE District = 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the delegate and committee information of elections.
#
### SQL:
#
# SELECT Delegate , Committee FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the delegate and committee information for each election record?
#
### SQL:
#
# SELECT Delegate , Committee FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# How many distinct governors are there?
#
### SQL:
#
# SELECT count(DISTINCT Governor) FROM party
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Count the number of distinct governors.
#
### SQL:
#
# SELECT count(DISTINCT Governor) FROM party
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the lieutenant governor and comptroller from the democratic party.
#
### SQL:
#
# SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Who are the lieutenant governor and comptroller from the democratic party?
#
### SQL:
#
# SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# In which distinct years was the governor "Eliot Spitzer"?
#
### SQL:
#
# SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Find the distinct years when the governor was named "Eliot Spitzer".
#
### SQL:
#
# SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show all the information about election.
#
### SQL:
#
# SELECT * FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Return all the information for each election record.
#
### SQL:
#
# SELECT * FROM election
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the delegates and the names of county they belong to.
#
### SQL:
#
# SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the delegate and name of the county they belong to, for each county?
#
### SQL:
#
# SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which delegates are from counties with population smaller than 100000?
#
### SQL:
#
# SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Find the delegates who are from counties with population below 100000.
#
### SQL:
#
# SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# How many distinct delegates are from counties with population larger than 50000?
#
### SQL:
#
# SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Count the number of distinct delegates who are from counties with population above 50000.
#
### SQL:
#
# SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the names of the county that the delegates on "Appropriations" committee belong to?
#
### SQL:
#
# SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which county do the delegates on "Appropriations" committee belong to? Give me the county names.
#
### SQL:
#
# SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the delegates and the names of the party they belong to.
#
### SQL:
#
# SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# For each delegate, find the names of the party they are part of.
#
### SQL:
#
# SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Who were the governors of the parties associated with delegates from district 1?
#
### SQL:
#
# SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Find the parties associated with the delegates from district 1. Who served as governors of the parties?
#
### SQL:
#
# SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?
#
### SQL:
#
# SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
#
### SQL:
#
# SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Return all the committees that have delegates from Democratic party.
#
### SQL:
#
# SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which committees have delegates from the Democratic party?
#
### SQL:
#
# SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the name of each county along with the corresponding number of delegates from that county.
#
### SQL:
#
# SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# For each county, find the name of the county and the number of delegates from that county.
#
### SQL:
#
# SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the name of each party and the corresponding number of delegates from that party.
#
### SQL:
#
# SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# For each party, return the name of the party and the number of delegates from that party.
#
### SQL:
#
# SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Return the names of all counties sorted by population in ascending order.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population ASC
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Sort the names of all counties in ascending order of population.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population ASC
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Return the names of all counties sorted by county name in descending alphabetical order.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY County_name DESC
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Sort the names of all counties in descending alphabetical order.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY County_name DESC
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the name of the county with the biggest population.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which county has the largest population? Give me the name of the county.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the 3 counties with the smallest population.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population ASC LIMIT 3
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the 3 counties that have the smallest population? Give me the county names.
#
### SQL:
#
# SELECT County_name FROM county ORDER BY Population ASC LIMIT 3
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the names of counties that have at least two delegates.
#
### SQL:
#
# SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which counties have two or more delegates? Give me the county names.
#
### SQL:
#
# SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the name of the party that has at least two records.
#
### SQL:
#
# SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which party has two or more records?
#
### SQL:
#
# SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the name of the party that has the most delegates.
#
### SQL:
#
# SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which party has the largest number of delegates?
#
### SQL:
#
# SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the people that have been governor the most times.
#
### SQL:
#
# SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which people severed as governor most frequently?
#
### SQL:
#
# SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Show the people that have been comptroller the most times and the corresponding number of times.
#
### SQL:
#
# SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.
#
### SQL:
#
# SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the names of parties that do not have delegates in election?
#
### SQL:
#
# SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which parties did not have any delegates in elections?
#
### SQL:
#
# SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# What are the names of parties that have both delegates on "Appropriations" committee and
#
### SQL:
#
# SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Economic Matters"
#
### End.
|
election
|
### Complete SQL query only and with no explanation
### SQL tables followed by foreign key information:
#
# county ( County_Id, County_name, Population, Zip_code )
# party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate )
# election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee )
#
# election.District can be joined with county.County_Id
# election.Party can be joined with party.Party_ID
#
### Question:
#
# Which parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee?
#
### SQL:
#
# SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = "Economic Matters"
#
### End.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.