States with similar sizes

Question

You're given a table showing the total area (in square miles) of 50 U.S. states. Preview below:

Table: state_area

state square_miles
Alaska 1,723,337
Texas 695,662
California 423,967
Montana 380,831
New Mexico 314,917

Using this table, write a SQL query to grab pairs of states with total land area within 100,000 square miles of each other. For the snippet above, we would want to see something like:

state_a state_b
California Montana
Montana New Mexico

You can view/query the table in an interactive SQL fiddle here.

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now