human
Schema:
state (state_name, population, area, country_name, capital, density)
city (city_name, population, country_name, state_name)
border_info (state_name, border)
highlow (state_name, highest_elevation, lowest_point, highest_point, lowest_elevation)
lake (lake_name, area, country_name, state_name)
mountain (mountain_name, mountain_altitude, country_name, state_name)
river (river_name, length, country_name, traverse)
Please answer with SQL.
assistant
Sure, I understand.
human
what states border states that the mississippi runs through
assistant
SELECT border FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = 'mississippi' );
human
which states border the longest river in the usa
assistant
SELECT border FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE LENGTH = ( SELECT MAX ( LENGTH ) FROM river ) );
human
how many states border the mississippi river
assistant
SELECT COUNT ( DISTINCT border ) FROM border_info WHERE state_name IN ( SELECT traverse FROM river WHERE river_name = 'mississippi' );
human
which states have a river
assistant
SELECT traverse FROM river;
human
which rivers run through states that border the state with the capital atlanta
assistant
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name IN ( SELECT state_name FROM state WHERE capital = 'atlanta' ) );
human
which rivers run through states bordering alabama
assistant
SELECT river_name FROM river WHERE traverse IN ( SELECT border FROM border_info WHERE state_name = "alabama" ) ;