What is World Major Cities Database

What is World Major Cities Database

A database is an organized collection of data or information that is set up and stored for easy access electronically in a computer system.

GeoDataSource World Major Cities Database is a database that consists of the worldwide major cities that can be used in any applications that are requiring a comprehensive list of country code and country name, region/state/province name, city name, latitude, longitude and ZIP code. Most major cities in the world are included in this database in TSV (tab separated values) format, and can be easily accessed or loaded into a relational database for lookup.

This database enables a web developer to easily implement drop down lists, or any other solutions, that requires the list of countries, states and cities. Sample codes written in ASP, .NET and PHP are provided in the package to generate city names drop down list by countries and states. The sample codes enable a developer to rapidly deploy and utilize this package. Developer can apply this data for other purposes such as data validation, auto form filling, etc.

Database Fields

The benefit of using the World Major Cities Database is that the data is updated monthly, ensuring the most accurate and up-to-date source of data. It also provides instant download upon subscription. Below are the database fields for World Major Cities Database.

Field nameDescription
country_codeISO 3166 Primary Country Code. A two alphabetic character ISO 3166 Primary Country Code uniquely identifying a geopolitical entity (countries, dependencies, and areas of special sovereignty).
country_nameISO 3166 Primary Country Name. The full name of ISO 3166 Primary Country Name uniquely identifying a geopolitical entity (countries, dependencies, and areas of special sovereignty).
region_nameRegion/State Full Name. The full name is a complete region name which identifies the first-order administrative division. It is comprised of the specific name, generic name, and any articles or prepositions.
city_nameCity Full Name. The full name is a complete city name which identifies the named feature. It is comprised of the specific name, generic name, and any articles or prepositions.
 latitudeLatitude in Decimal Degree. Latitude of the city in ± decimal degrees (WGS84).
longitudeLongitude in Decimal Degree. Longitude of the city in ± decimal degrees (WGS84).
zip_codeCity ZIP Code. ZIP/Postal code of the city.

 Database table

In order to get the world major cities information, the World Major Cities Database table can be created and loaded by the following code in MySQL.

-- Create table "countrystatecity"
CREATE TABLE `countrystatecity` (
  `country_code` varchar(2),
  `country_name` varchar(64),
  `region_name` varchar(128),
  `city_name` varchar(128),
  `latitude` float,
  `longitude` float,
  `zip_code` varchar(50),
  PRIMARY KEY (`country_code`,`region_name`,`city_name`)
) CHARSET=utf8 COLLATE=utf8_bin;

-- Load data into table
LOAD DATA LOCAL INFILE 'GEODATASOURCE-WORLD-MAJOR-CITIES.TXT'
INTO TABLE `countrystatecity`
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\r\n';

For more details about the World Major Cities Database, you can visit https://www.geodatasource.com/world-major-cities-database to learn more about the information provided.

Was this article helpful?

Related Articles