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 rivers flow through the state with the largest population
assistant
SELECT river_name FROM river WHERE traverse IN ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );
human
what rivers flow through the largest state
assistant
SELECT river_name FROM river WHERE traverse IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );
human
which rivers run through the state with the largest city in the us
assistant
SELECT river_name FROM river WHERE traverse IN ( SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city ) );
human
what rivers flow through states that border the state with the largest population
assistant
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 ) ) );
human
which states have a river
assistant
SELECT traverse FROM river;
human
which river runs through the most states
assistant
SELECT river_name FROM river GROUP BY ( river_name ) ORDER BY COUNT( DISTINCT traverse ) DESC LIMIT 1 ;