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`) )
which state has the highest point
SELECT state_name 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 state has the highest elevation
SELECT state_name 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`) )
in which state does the highest point in usa exist
SELECT state_name 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 state has highest elevation
SELECT state_name 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 state with the highest elevation in the united states
SELECT state_name 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 state that contains the highest point
SELECT state_name 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 state contains the highest point in the us
SELECT state_name 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`) )
which state has the lowest elevation
SELECT state_name 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 name of the state with the lowest point
SELECT state_name 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 state with the lowest point
SELECT state_name 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`) )
which state has the lowest point that borders idaho
SELECT state_name FROM highlow WHERE lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "idaho" ) ) AND state_name IN ( SELECT border FROM border_info WHERE state_name = "idaho" );
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 average urban population
SELECT state_name FROM city GROUP BY state_name ORDER BY AVG ( 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`) )
which state is mount whitney in
SELECT state_name FROM mountain WHERE mountain_name = "whitney";
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`) )
in what state is mount whitney
SELECT state_name FROM mountain WHERE mountain_name = "whitney";
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 mount whitney
SELECT state_name FROM mountain WHERE mountain_name = "whitney";
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 mount whitney located
SELECT state_name FROM mountain WHERE mountain_name = "whitney";
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 have a river
SELECT traverse 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 states have rivers running through them
SELECT traverse 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 states have a major city named austin
SELECT state_name FROM city WHERE city_name = "austin" AND population > 150000;
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 a state that borders california
SELECT city_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city 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 city in states that border california
SELECT city_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city 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`) )
how many rivers do not traverse the state with the capital albany
SELECT COUNT ( river_name ) FROM river WHERE traverse NOT IN ( SELECT state_name FROM state WHERE capital = "albany" );
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 shortest river in texas
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( LENGTH ) FROM river WHERE traverse = "texas" ) AND traverse = "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 are the major cities in the smallest state in the us
SELECT city_name FROM city WHERE population > 150000 AND 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 is the population of the capital of the largest state through which the mississippi runs
SELECT population FROM city WHERE city_name = ( SELECT capital FROM state WHERE area = ( SELECT MAX ( t1.area ) FROM state AS t1 JOIN river AS t2 ON t1.state_name = t2.traverse WHERE t2.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 shortest river in the usa
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( 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 is the shortest river
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( 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 is the shortest river in the us
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( 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 is the shortest river in the united states
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( 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 shortest river
SELECT river_name FROM river WHERE LENGTH = ( SELECT MIN ( 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 is the capital of the state that borders the state that borders texas
SELECT capital FROM state WHERE state_name IN ( SELECT border FROM border_info WHERE 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 city of the smallest state in the us
SELECT city_name FROM city WHERE population = ( SELECT MIN ( 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 population of the largest state that borders texas
SELECT population FROM state WHERE area = ( SELECT MAX ( 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 state is salem the capital of
SELECT state_name FROM state WHERE capital = "salem";
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 capital is salem
SELECT state_name FROM state WHERE capital = "salem";
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`) )
salem is the capital of which state
SELECT state_name FROM state WHERE capital = "salem";
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 capital salem
SELECT state_name FROM state WHERE capital = "salem";
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 the state with the largest population
SELECT river_name FROM river WHERE traverse IN ( 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 is the largest state that borders the state with the highest population
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT state_name FROM border_info WHERE border IN ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) ) ) ) AND state_name IN ( SELECT state_name FROM border_info WHERE border IN ( 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`) )
how many rivers are there in us
SELECT COUNT ( river_name ) 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`) )
name the 50 capitals in the usa
SELECT DISTINCT capital 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 states have a city named springfield
SELECT COUNT ( state_name ) FROM city WHERE city_name = "springfield";
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 states have a city called springfield
SELECT COUNT ( state_name ) FROM city WHERE city_name = "springfield";
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 states have cities named springfield
SELECT COUNT ( state_name ) FROM city WHERE city_name = "springfield";
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 states have cities or towns named springfield
SELECT COUNT ( state_name ) FROM city WHERE city_name = "springfield";
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 borders the state with the smallest population
SELECT border FROM border_info WHERE state_name IN ( SELECT state_name FROM state WHERE population = ( SELECT MIN ( 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 lakes in states bordering texas
SELECT lake_name FROM lake WHERE 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`) )
how many major cities are in texas
SELECT COUNT ( city_name ) FROM city WHERE population > 150000 AND 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`) )
how many big cities are in texas
SELECT COUNT ( city_name ) FROM city WHERE population > 150000 AND 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`) )
how many major cities are there in texas
SELECT COUNT ( city_name ) FROM city WHERE population > 150000 AND 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`) )
how high are the highest points of all the states
SELECT 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`) )
how many states does the missouri run through
SELECT COUNT ( traverse ) FROM river WHERE river_name = "missouri";
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 states does the missouri river flow through
SELECT COUNT ( traverse ) FROM river WHERE river_name = "missouri";
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 states does the missouri river run through
SELECT COUNT ( traverse ) FROM river WHERE river_name = "missouri";
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 smallest state in the usa
SELECT river_name FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river WHERE traverse IN ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) ) ) AND traverse 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 average population per square km in pennsylvania
SELECT population / area FROM state WHERE state_name = "pennsylvania";
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 states that border florida
SELECT border FROM border_info WHERE state_name IN ( SELECT border FROM border_info WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "florida" ) );
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 states border at least one other state
SELECT COUNT ( DISTINCT state_name ) FROM border_info;
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 height of the highest mountain in texas
SELECT MAX ( DISTINCT highest_elevation ) FROM highlow 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`) )
how many states border colorado and border new mexico
SELECT COUNT ( border ) FROM border_info WHERE border IN ( SELECT border FROM border_info WHERE state_name = "new mexico" ) AND 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`) )
how many major cities are in states bordering nebraska
SELECT COUNT ( city_name ) FROM city WHERE population > 150000 AND state_name IN ( SELECT border FROM border_info WHERE state_name = "nebraska" );
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 population of the states that border texas
SELECT SUM ( t2.population ) FROM state AS t2 JOIN border_info AS t1 ON t2.state_name = t1.border WHERE t1.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 are the major lakes in united states
SELECT lake_name FROM lake WHERE area > 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`) )
show me all the major lakes in the us
SELECT lake_name FROM lake WHERE area > 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`) )
name all the lakes of us
SELECT lake_name FROM lake;
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 major rivers cross ohio
SELECT COUNT ( river_name ) FROM river WHERE LENGTH > 750 AND traverse = "ohio";
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 shortest river
SELECT DISTINCT traverse FROM river WHERE LENGTH = ( SELECT MIN ( 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`) )
how many states are next to major rivers
SELECT COUNT ( DISTINCT 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 is the height of mount mckinley
SELECT mountain_altitude FROM mountain WHERE mountain_name = "mckinley";
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 does the shortest river run through
SELECT traverse FROM river WHERE LENGTH = ( SELECT MIN ( 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 is the highest point in the state with the smallest population
SELECT t2.highest_point FROM state AS t1 JOIN highlow AS t2 ON t1.state_name = t2.state_name WHERE t1.state_name IN ( SELECT state_name FROM state WHERE population = ( SELECT MIN ( 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`) )
which rivers run through the state with the lowest elevation in the usa
SELECT river_name FROM river WHERE traverse IN ( SELECT state_name 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 rivers run through the state with the lowest point in the usa
SELECT river_name FROM river WHERE traverse IN ( SELECT state_name 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 mountains are in alaska
SELECT mountain_name 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`) )
how many states have major rivers
SELECT COUNT ( 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 is the smallest state through which the longest river runs
SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river ) ) ) AND 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`) )
what is the largest state traversed by the rio grande river
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "rio grande" ) ) AND state_name IN ( SELECT traverse FROM river WHERE river_name = "rio grande" );
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 of the state that the rio grande runs through
SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = "rio grande" ) ) AND state_name IN ( SELECT traverse FROM river WHERE river_name = "rio grande" );
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 rivers run through the states bordering colorado
SELECT COUNT ( river_name ) FROM river WHERE traverse 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 state has no rivers
SELECT state_name FROM state WHERE state_name NOT IN ( SELECT traverse 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 is the capital of the largest state
SELECT capital 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 capital city of the largest state in the us
SELECT capital 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`) )
how many cities are in texas
SELECT COUNT ( city_name ) FROM city 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`) )
how many cities does texas have
SELECT COUNT ( city_name ) FROM city 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 area of the states
SELECT 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`) )
how many states in the us does the shortest river run through
SELECT COUNT ( DISTINCT traverse ) FROM river WHERE LENGTH = ( SELECT MIN ( 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 rivers flow through states that border the state with the largest population
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name IN ( 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 major cities in the largest state
SELECT city_name FROM city WHERE population > 150000 AND state_name = ( 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 area of the smallest state
SELECT area 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 longest river in the usa
SELECT border FROM border_info 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`) )
what is the population density of the state with the smallest population
SELECT density FROM state WHERE population = ( SELECT MIN ( 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`) )
how many states border the mississippi river
SELECT COUNT ( DISTINCT 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 have a capital that is the highest point in the state
SELECT t1.state_name FROM state AS t1 JOIN highlow AS t2 ON t1.capital = t2.highest_point;
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 capital of the smallest state
SELECT population FROM city WHERE city_name = ( SELECT capital 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 capital of the largest state
SELECT population FROM city WHERE city_name = ( SELECT capital 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 lowest point of the state with the largest area
SELECT t2.lowest_point FROM state AS t1 JOIN highlow AS t2 ON t1.state_name = t2.state_name WHERE t1.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 states border states that border the state with the largest population
SELECT t1.border FROM border_info AS t2 JOIN border_info AS t1 ON t2.border = t1.state_name WHERE t2.state_name IN ( 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 is the size of the largest state in the usa
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 area of the largest state
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`) )
which capitals are not major cities
SELECT t2.capital FROM state AS t2 JOIN city AS t1 ON t2.capital = t1.city_name WHERE t1.population <= 150000;