db_id
stringclasses
146 values
question
stringlengths
3
224
sql
stringlengths
18
577
database_schema
stringclasses
146 values
storm_record
List name, dates active, and number of deaths for all storms with at least 1 death.
SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names, dates active, and number of deaths for storms that had 1 or more death?
SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show the average and maximum damage for all storms with max speed higher than 1000.
SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What is the average and maximum damage in millions for storms that had a max speed over 1000?
SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What is the total number of deaths and damage for all storms with a max speed greater than the average?
SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.
SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
List name and damage for all storms in a descending order of max speed.
SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names and damage in millions for storms, ordered by their max speeds descending?
SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
How many regions are affected?
SELECT count(DISTINCT region_id) FROM affected_region
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Count the number of different affected regions.
SELECT count(DISTINCT region_id) FROM affected_region
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show the name for regions not affected.
SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of regions that were not affected?
SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show the name for regions and the number of storms for each region.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
How many storms occured in each region?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
List the name for storms and the number of affected regions for each storm.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
How many regions were affected by each storm?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What is the storm name and max speed which affected the greatest number of regions?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Return the name and max speed of the storm that affected the most regions.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show the name of storms which don't have affected region in record.
SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of storms that did not affect any regions?
SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region)
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show storm name with at least two regions and 10 cities affected.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show all storm names except for those with at least two affected regions.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of storms that did not affect two or more regions?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the region names affected by the storm with a number of deaths of least 10?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Return the names of the regions affected by storms that had a death count of at least 10.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show all storm names affecting region "Denmark".
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'
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of the storms that affected Denmark?
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'
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Show the region name with at least two storms.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of regions with two or more storms?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Find the names of the regions which were affected by the storm that killed the greatest number of people.
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of regions that were affected by the storm in which the most people died?
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
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
Find the name of the storm that affected both Afghanistan and Albania regions.
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'
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
storm_record
What are the names of the storms that affected both the regions of Afghanistan and Albania?
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'
CREATE TABLE "storm" ( "Storm_ID" int, "Name" text, "Dates_active" text, "Max_speed" int, "Damage_millions_USD" real, "Number_Deaths" int, PRIMARY KEY ("Storm_ID") ) 3 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.00 0 2 Two August3–August10 972 10.75 7 3 Three August5–August14 972 13.00 52 CREATE TABLE "region" ( `Region_id` int, `Region_code` text, `Region_name` text, PRIMARY KEY ("Region_id") ) 3 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania 3 DZ Algeria CREATE TABLE `affected_region` ( `Region_id` int, `Storm_ID` int, `Number_city_affected` real, PRIMARY KEY (`Region_id`,`Storm_ID`), FOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`), FOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`) ) 3 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 3 3 30.0
election
How many counties are there in total?
SELECT count(*) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Count the total number of counties.
SELECT count(*) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the county name and population of all counties.
SELECT County_name , Population FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the name and population of each county?
SELECT County_name , Population FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the average population of all counties.
SELECT avg(Population) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
On average how large is the population of the counties?
SELECT avg(Population) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Return the maximum and minimum population among all counties.
SELECT max(Population) , min(Population) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the maximum and minimum population of the counties?
SELECT max(Population) , min(Population) FROM county
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show all the distinct districts for elections.
SELECT DISTINCT District FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the distinct districts for elections?
SELECT DISTINCT District FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the zip code of the county with name "Howard".
SELECT Zip_code FROM county WHERE County_name = "Howard"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What is the zip code the county named "Howard" is located in?
SELECT Zip_code FROM county WHERE County_name = "Howard"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the delegate from district 1 in election.
SELECT Delegate FROM election WHERE District = 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Who is the delegate of district 1 in the elections?
SELECT Delegate FROM election WHERE District = 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the delegate and committee information of elections.
SELECT Delegate , Committee FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the delegate and committee information for each election record?
SELECT Delegate , Committee FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
How many distinct governors are there?
SELECT count(DISTINCT Governor) FROM party
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Count the number of distinct governors.
SELECT count(DISTINCT Governor) FROM party
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the lieutenant governor and comptroller from the democratic party.
SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Who are the lieutenant governor and comptroller from the democratic party?
SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
In which distinct years was the governor "Eliot Spitzer"?
SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Find the distinct years when the governor was named "Eliot Spitzer".
SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show all the information about election.
SELECT * FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Return all the information for each election record.
SELECT * FROM election
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the delegates and the names of county they belong to.
SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the delegate and name of the county they belong to, for each county?
SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which delegates are from counties with population smaller than 100000?
SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Find the delegates who are from counties with population below 100000.
SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
How many distinct delegates are from counties with population larger than 50000?
SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Count the number of distinct delegates who are from counties with population above 50000.
SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the names of the county that the delegates on "Appropriations" committee belong to?
SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which county do the delegates on "Appropriations" committee belong to? Give me the county names.
SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the delegates and the names of the party they belong to.
SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
For each delegate, find the names of the party they are part of.
SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Who were the governors of the parties associated with delegates from district 1?
SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Find the parties associated with the delegates from district 1. Who served as governors of the parties?
SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Return all the committees that have delegates from Democratic party.
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which committees have delegates from the Democratic party?
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the name of each county along with the corresponding number of delegates from that county.
SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
For each county, find the name of the county and the number of delegates from that county.
SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the name of each party and the corresponding number of delegates from that party.
SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
For each party, return the name of the party and the number of delegates from that party.
SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Return the names of all counties sorted by population in ascending order.
SELECT County_name FROM county ORDER BY Population ASC
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Sort the names of all counties in ascending order of population.
SELECT County_name FROM county ORDER BY Population ASC
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Return the names of all counties sorted by county name in descending alphabetical order.
SELECT County_name FROM county ORDER BY County_name DESC
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Sort the names of all counties in descending alphabetical order.
SELECT County_name FROM county ORDER BY County_name DESC
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the name of the county with the biggest population.
SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which county has the largest population? Give me the name of the county.
SELECT County_name FROM county ORDER BY Population DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the 3 counties with the smallest population.
SELECT County_name FROM county ORDER BY Population ASC LIMIT 3
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the 3 counties that have the smallest population? Give me the county names.
SELECT County_name FROM county ORDER BY Population ASC LIMIT 3
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the names of counties that have at least two delegates.
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which counties have two or more delegates? Give me the county names.
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the name of the party that has at least two records.
SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which party has two or more records?
SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the name of the party that has the most delegates.
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which party has the largest number of delegates?
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
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the people that have been governor the most times.
SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which people severed as governor most frequently?
SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Show the people that have been comptroller the most times and the corresponding number of times.
SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.
SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the names of parties that do not have delegates in election?
SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which parties did not have any delegates in elections?
SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
What are the names of parties that have both delegates on "Appropriations" committee and
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"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations
election
Which parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee?
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"
CREATE TABLE "county" ( "County_Id" int, "County_name" text, "Population" real, "Zip_code" text, PRIMARY KEY ("County_Id") ) 3 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 3 Colony 79000.0 D02 CREATE TABLE "party" ( "Party_ID" int, "Year" real, "Party" text, "Governor" text, "Lieutenant_Governor" text, "Comptroller" text, "Attorney_General" text, "US_Senate" text, PRIMARY KEY ("Party_ID") ) 3 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer 3 2002.0 Democratic Carl McCall Dennis Mehiel Alan Hevesi Eliot Spitzer (no election) CREATE TABLE "election" ( "Election_ID" int, "Counties_Represented" text, "District" int, "Delegate" text, "Party" int, "First_Elected" real, "Committee" text, PRIMARY KEY ("Election_ID"), FOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`), FOREIGN KEY (`District`) REFERENCES `county`(`County_Id`) ) 3 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters 3 12.1 12A 2 DeBoy, Steven J. Sr. Steven J. DeBoy, Sr. 2 2002.0 Appropriations