Giter VIP home page Giter VIP logo

us-cities-database's Introduction

U.S. Cities Database

The SQL file has 29.880 registered cities. All cities are located in the United States.

The SQL file contains two tables:

  • US_STATES: ID, STATE_CODE and STATE_NAME.

  • US_CITIES: ID, ID_STATE, CITY, COUNTY, LATITUDE and LONGITUDE.

The US_CITIES table has all (or almost all) cities from the United States.

Compatibility

The us_cities.sql file is compatible with MySQL. See sqlite for the sqlite3 compatible version.

Samples

US_STATES

ID STATE_CODE STATE_NAME
1 AL Alabama
2 AK Alaska
3 AZ Arizona

US_CITIES

ID ID_STATE CITY COUNTY LATITUDE LONGITUDE
1 2 Adak Aleutians West 55.999722 -161.20777
2 2 Akiachak Bethel 60.891854 -161.39233
3 2 Akiak Bethel 60.890632 -161.19932
4 2 Akutan Aleutians East 54.143012 -165.78536
5 2 Alakanuk Kusilvak 62.746967 -164.60228

Export Data

You can use the following SQL command to export the data to a CSV file.

SELECT
	US_CITIES.ID, US_STATES.STATE_CODE, US_STATES.STATE_NAME, US_CITIES.CITY, US_CITIES.COUNTY, US_CITIES.LATITUDE, US_CITIES.LONGITUDE
FROM
	US_STATES
INNER JOIN
	US_CITIES
ON
	US_STATES.ID = US_CITIES.ID_STATE
ORDER BY
	US_CITIES.ID ASC
INTO OUTFILE
	'C:/US_Cities.csv'
FIELDS TERMINATED BY
	';'
ENCLOSED BY
	''
LINES TERMINATED BY
	'\n';

For convenience, the generated CSV file is here.

License

This project was created under the MIT license.

If you find some inconsistent data, such as a duplicated city, please open an issue explaining what is happening or directly fix the problem and send a Pull Request.

References

This SQL dump was created based on the SQL dump that can be found at the following link: http://www.farinspace.com/us-cities-and-state-sql-dump/

CHANGELOG

  • The zip column was deleted.
  • Some duplicated cities were deleted.
  • All data were reorganized (rows and columns).
  • It was included the Puerto Rico state name that was missing in the original SQL.
  • It was included the US_STATES table.
  • Wade Hampton was renamed to Kusilvak.

us-cities-database's People

Contributors

fatahnuram avatar kelvins avatar rwalk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

us-cities-database's Issues

Add a new STATE column

Create a new column containing the full state name.

It can be done based on the state code.
For example:

'NY' - 'New York'
'OH' - 'Ohio'
'OK' - 'Oklahoma'
'OR' - 'Oregon'

What is the key to access the database.

Hi Kelvins,

Can you please share "Key" to access the database. As the dbfile is encrypted with a key, We can not able to access it directly.

Thanks
Venkat

Add Zip Code

Can you please add back in the Zip Code statement for this dev obj? That is the missing link for my data pull.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.