Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List/Database of U.S cities and states [closed]

Tags:

database

I want a .csv list, mysql database, or any other list of all U.S states and cities, including which cities are in which state. From this list I will generate a mysql database with the following fields:

states:  - id (int, auto_increment, primary)  - name (varchar 255)  cities:  - id (int, auto_increment, primary)  - stateId (id of the state from states table to which this city belongs)  - name (varchar 255) 

Thanks in advance.

like image 413
Ali Avatar asked Feb 01 '10 15:02

Ali


People also ask

How many cities are there in the cities table SQL?

There are 4079 cities in the table. We use the built-in COUNT() function to find out the number of rows.

How many cities are in USA?

As of 2018, there are 19,495 incorporated cities, towns and villages in the United States.

How many US cities have a population over 50000?

The seven cities that passed the 50,000 population mark were Kyle, Texas (51,789); Burleson, Texas (51,618); Little Elm, Texas (51,042); Lincoln, California (50,649); Westfield, Indiana (50,630); Newark, Ohio (50,383); and Jeffersonville, Indiana (50,315).


2 Answers

You can get city/state information in tab-separated value format from GeoNames.org. The data is free, comprehensive and well structured. For US data, grab the US.txt file at the free postal code data page. The readme.txt file on that page describes the format.

like image 105
Joshua Frank Avatar answered Oct 04 '22 07:10

Joshua Frank


I spent a while looking for such a file, and ended up doing one myself, you can get it from here:

https://github.com/grammakov/us_cities_and_states/tree/master

like image 39
The Whiz of Oz Avatar answered Oct 04 '22 08:10

The Whiz of Oz