{"id":19188908,"url":"https://github.com/kelvins/us-cities-database","last_synced_at":"2025-02-23T03:42:40.607Z","repository":{"id":47595428,"uuid":"89436958","full_name":"kelvins/US-Cities-Database","owner":"kelvins","description":" :us: SQL dump of U.S. cities data containing latitude and longitude","archived":false,"fork":false,"pushed_at":"2021-04-24T13:33:06.000Z","size":2217,"stargazers_count":201,"open_issues_count":0,"forks_count":63,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-04T06:17:34.066Z","etag":null,"topics":["cities-database","latitude-and-longitude","sql","sql-dump"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kelvins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-26T04:14:11.000Z","updated_at":"2024-12-24T03:04:32.000Z","dependencies_parsed_at":"2022-07-26T15:32:35.896Z","dependency_job_id":null,"html_url":"https://github.com/kelvins/US-Cities-Database","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelvins%2FUS-Cities-Database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelvins%2FUS-Cities-Database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelvins%2FUS-Cities-Database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelvins%2FUS-Cities-Database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelvins","download_url":"https://codeload.github.com/kelvins/US-Cities-Database/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240266854,"owners_count":19774072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cities-database","latitude-and-longitude","sql","sql-dump"],"created_at":"2024-11-09T11:26:41.715Z","updated_at":"2025-02-23T03:42:40.465Z","avatar_url":"https://github.com/kelvins.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# U.S. Cities Database\n\nThe SQL file has **29.880** registered cities. All cities are located in the **United States**.\n\nThe SQL file contains two tables:\n\n - US_STATES: ID, STATE_CODE and STATE_NAME.\n\n - US_CITIES: ID, ID_STATE, CITY, COUNTY, LATITUDE and LONGITUDE.\n\nThe US_CITIES table has all (or almost all) cities from the **United States**.\n\n## Compatibility\nThe [us_cities.sql](./us_cities.sql) file is compatible with MySQL. See [sqlite](./sqlite) for the sqlite3 compatible version.\n## Samples\n\n### US_STATES\n\n| ID | STATE_CODE | STATE_NAME |\n|:--:|:----------:|:----------:|\n|  1 |     AL     |   Alabama  |\n|  2 |     AK     |   Alaska   |\n|  3 |     AZ     |   Arizona  |\n\n### US_CITIES\n\n| ID | ID_STATE |      CITY      |      COUNTY      | LATITUDE  | LONGITUDE  |\n|:--:|:--------:|:--------------:|:----------------:|:---------:|:----------:|\n|  1 |    2     |      Adak      |  Aleutians West  | 55.999722 | -161.20777 |\n|  2 |    2     |    Akiachak    |      Bethel      | 60.891854 | -161.39233 |\n|  3 |    2     |     Akiak      |      Bethel      | 60.890632 | -161.19932 |\n|  4 |    2     |     Akutan     |  Aleutians East  | 54.143012 | -165.78536 |\n|  5 |    2     |    Alakanuk    |     Kusilvak     | 62.746967 | -164.60228 |\n\n\n## Export Data\n\nYou can use the following SQL command to export the data to a CSV file.\n\n``` sql\nSELECT\n\tUS_CITIES.ID, US_STATES.STATE_CODE, US_STATES.STATE_NAME, US_CITIES.CITY, US_CITIES.COUNTY, US_CITIES.LATITUDE, US_CITIES.LONGITUDE\nFROM\n\tUS_STATES\nINNER JOIN\n\tUS_CITIES\nON\n\tUS_STATES.ID = US_CITIES.ID_STATE\nORDER BY\n\tUS_CITIES.ID ASC\nINTO OUTFILE\n\t'C:/US_Cities.csv'\nFIELDS TERMINATED BY\n\t';'\nENCLOSED BY\n\t''\nLINES TERMINATED BY\n\t'\\n';\n```\nFor convenience, the generated CSV file is [here](./csv/us_cities.csv).\n\n## License\n\nThis project was created under the [MIT license][1].\n\nIf 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.\n\n## References\n\nThis SQL dump was created based on the SQL dump that can be found at the following link:\n[http://www.farinspace.com/us-cities-and-state-sql-dump/][2]\n\n### CHANGELOG\n\n - The **zip** column was deleted.\n - Some duplicated cities were deleted.\n - All data were reorganized (rows and columns).\n - It was included the Puerto Rico state name that was missing in the original SQL.\n - It was included the **US_STATES** table.\n - Wade Hampton was renamed to Kusilvak.\n\n  [1]: LICENSE\n  [2]: http://www.farinspace.com/us-cities-and-state-sql-dump/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelvins%2Fus-cities-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelvins%2Fus-cities-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelvins%2Fus-cities-database/lists"}