spider_version
int64
1
2
db_id
stringclasses
204 values
schema
stringclasses
187 values
question
stringlengths
3
328
query
stringlengths
20
3.81k
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the highest point in the country
SELECT highest_point FROM highlow WHERE highest_elevation = ( SELECT MAX ( highest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the highest point in the us
SELECT highest_point FROM highlow WHERE highest_elevation = ( SELECT MAX ( highest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the highest point in the united states
SELECT highest_point FROM highlow WHERE highest_elevation = ( SELECT MAX ( highest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the highest point of the state with the smallest population density
SELECT highest_point FROM highlow WHERE state_name IN ( SELECT state_name FROM state WHERE density = ( SELECT MIN ( density ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the largest city in smallest state through which the mississippi runs
SELECT city_name FROM city WHERE state_name IN ( SELECT state_name FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) AND area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ) ) ORDER BY population DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the largest city in the smallest state in the usa
SELECT city_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) ) ) AND state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the biggest city in the smallest state
SELECT city_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) ) ) AND state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the largest state bordering california
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "california" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "california" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the largest state that borders california
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "california" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "california" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state that borders california is the largest
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "california" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "california" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the longest river in the largest state
SELECT river_name FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river WHERE traverse IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) ) ) AND traverse IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the longest river in the states that border tennessee
SELECT river_name FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" ) ) AND traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the longest river that flows through a state that borders tennessee
SELECT river_name FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" ) ) AND traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the longest river that runs through a state that borders tennessee
SELECT river_name FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" ) ) AND traverse IN ( SELECT border FROM border_info WHERE state_name = "tennessee" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the longest river in the state with the most major cities
SELECT river_name FROM river WHERE traverse = ( SELECT state_name FROM city WHERE population > 150000 GROUP BY state_name ORDER BY COUNT ( city_name ) DESC LIMIT 1 ) ORDER BY LENGTH DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point in iowa
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point in iowa in meters
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point in the state of iowa
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where is the lowest point in iowa
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point of iowa
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where is the lowest spot in iowa
SELECT lowest_point FROM highlow WHERE state_name = "iowa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point in usa
SELECT lowest_point FROM highlow WHERE lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point in the united states
SELECT lowest_point FROM highlow WHERE lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where is the lowest point in the us
SELECT lowest_point FROM highlow WHERE lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point of the us
SELECT lowest_point FROM highlow WHERE lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the lowest point of all states through which the mississippi river runs through
SELECT lowest_point FROM highlow WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ORDER BY lowest_elevation LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which is the lowest point of the states that the mississippi runs through
SELECT lowest_point FROM highlow WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ORDER BY lowest_elevation LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the most dense state in the usa
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the highest population density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the greatest density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the highest population density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the greatest population density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the largest population density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the state with the largest density in usa
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the state with the largest population density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the largest density
SELECT state_name FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the most populous state through which the mississippi runs
SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ) AND state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state which the mississippi runs through has the largest population
SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ) AND state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the population density of the largest state
SELECT density FROM state WHERE area = ( SELECT MAX ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the population of the largest city in the state with the largest area
SELECT population FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) ) ) AND state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the population of the smallest state
SELECT population FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the population of the state with the highest population density
SELECT population FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
how many people live in the state with the largest population density
SELECT population FROM state WHERE density = ( SELECT MAX ( density ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest city in the usa
SELECT city_name FROM city WHERE population = ( SELECT MIN ( population ) FROM city );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest city in the us
SELECT city_name FROM city WHERE population = ( SELECT MIN ( population ) FROM city );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what city has the least population
SELECT city_name FROM city WHERE population = ( SELECT MIN ( population ) FROM city );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the city with the smallest population
SELECT city_name FROM city WHERE population = ( SELECT MIN ( population ) FROM city );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest state bordering texas
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest state that borders texas
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the smallest area that borders texas
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "texas" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest state that the mississippi river runs through
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" ) ) AND state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the state with the smallest area
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which is the smallest state
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state is the smallest
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest state in the usa
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the smallest state by area
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the smallest area
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the total length of all rivers in the usa
SELECT SUM ( LENGTH ) FROM river;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what river flows through the most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which river goes through the most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which river runs through most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which river traverses most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what river traverses the most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which river runs through the most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what river runs through the most states
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT ( DISTINCT traverse ) DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what rivers are in states that border alabama
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "alabama" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which rivers run through states bordering alabama
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "alabama" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what rivers flow through states that alabama borders
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "alabama" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state bordering oklahoma has the largest population
SELECT state_name FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "oklahoma" ) ORDER BY population DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which of the states bordering oklahoma has the largest population
SELECT state_name FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "oklahoma" ) ORDER BY population DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state that borders oklahoma has the highest population
SELECT state_name FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "oklahoma" ) ORDER BY population DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what is the most populated state bordering oklahoma
SELECT state_name FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "oklahoma" ) ORDER BY population DESC LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state contains the highest point of those the colorado river traverses
SELECT state_name FROM highlow WHERE highest_elevation = ( SELECT MAX ( highest_elevation ) FROM highlow WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "colorado" ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the largest capital
SELECT state_name FROM city WHERE population = ( SELECT MAX ( t1.population ) FROM state AS t2 JOIN city AS t1 ON t2.capital = t1.city_name );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state 's capital city is the largest
SELECT state_name FROM city WHERE population = ( SELECT MAX ( t1.population ) FROM state AS t2 JOIN city AS t1 ON t2.capital = t1.city_name );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the longest river
SELECT DISTINCT traverse FROM river WHERE LENGTH = ( SELECT MAX ( DISTINCT LENGTH ) FROM river );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what state has the smallest urban population
SELECT state_name FROM city GROUP BY state_name ORDER BY SUM ( population ) LIMIT 1;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border states that border colorado
SELECT border FROM border_info WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "colorado" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border states that the mississippi runs through
SELECT border FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which states border states through which the mississippi traverses
SELECT border FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border states which the mississippi runs through
SELECT border FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "mississippi" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border texas and have a major river
SELECT state_name FROM border_info WHERE border = "texas" AND state_name IN ( SELECT traverse FROM river WHERE LENGTH > 750 );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border the most populous state
SELECT border FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what are the states that border the state with the greatest population
SELECT border FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states border the state with the smallest area
SELECT border FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which states border the state with the smallest area
SELECT border FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what states contain at least one major rivers
SELECT traverse FROM river WHERE LENGTH > 750;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where are mountains
SELECT state_name FROM mountain;
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where is the highest mountain of the united states
SELECT state_name FROM mountain WHERE mountain_altitude = ( SELECT MAX ( mountain_altitude ) FROM mountain );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the highest peak in the country
SELECT state_name FROM mountain WHERE mountain_altitude = ( SELECT MAX ( mountain_altitude ) FROM mountain );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
where is the smallest city
SELECT state_name FROM city WHERE population = ( SELECT MIN ( population ) FROM city );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which is the density of the state that the largest river in the united states runs through
SELECT density FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which is the highest peak not in alaska
SELECT mountain_name FROM mountain WHERE mountain_altitude = ( SELECT MAX ( mountain_altitude ) FROM mountain WHERE state_name != "alaska" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which rivers do not run through tennessee
SELECT river_name FROM river WHERE river_name NOT IN ( SELECT river_name FROM river WHERE traverse = "tennessee" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what rivers do not run through tennessee
SELECT river_name FROM river WHERE river_name NOT IN ( SELECT river_name FROM river WHERE traverse = "tennessee" );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which rivers do not run through usa
SELECT river_name FROM river WHERE country_name != "usa";
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which rivers run through states that border the state with the capital atlanta
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name IN ( SELECT state_name FROM state WHERE capital = "atlanta" ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
what rivers run through the states that border the state with the capital atlanta
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name IN ( SELECT state_name FROM state WHERE capital = "atlanta" ) );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state capital has the smallest population
SELECT city_name FROM city WHERE population = ( SELECT MIN ( t1.population ) FROM state AS t2 JOIN city AS t1 ON t2.capital = t1.city_name );
1
geo
CREATE TABLE `state` ( `state_name` text , `population` integer DEFAULT NULL , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `capital` text , `density` DOUBLE DEFAULT NULL , PRIMARY KEY (`state_name`) ); CREATE TABLE `city` ( `city_name` text , `population` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`city_name`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `border_info` ( `state_name` text , `border` text , PRIMARY KEY (`border`,`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) , FOREIGN KEY(`border`) REFERENCES `state`(`state_name`) ); CREATE TABLE `highlow` ( `state_name` text , `highest_elevation` text , `lowest_point` text , `highest_point` text , `lowest_elevation` text , PRIMARY KEY (`state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `lake` ( `lake_name` text , `area` DOUBLE DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text ); CREATE TABLE `mountain` ( `mountain_name` text , `mountain_altitude` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `state_name` text , PRIMARY KEY (`mountain_name`, `state_name`) , FOREIGN KEY(`state_name`) REFERENCES `state`(`state_name`) ); CREATE TABLE `river` ( `river_name` text , `length` integer DEFAULT NULL , `country_name` varchar(3) NOT NULL DEFAULT '' , `traverse` text , PRIMARY KEY (`river_name`) , FOREIGN KEY(`traverse`) REFERENCES `state`(`state_name`) )
which state has the highest elevation
SELECT state_name FROM highlow WHERE highest_elevation = ( SELECT MAX ( highest_elevation ) FROM highlow );