Free CSV/SQL database with World Countries & Cities

To be able to present all information in the Lensora.com Image Gallery and other location based articles there is a big database of cities and countries powering it all. And this database we at Lensora.com want to make public for you to download and use, together with images of all country flags as well.

These are examples of how you can publish and list counties and cities.

List values from tableCountries
Photography in Australia
Photography in Canada
Photography in United Kingdom
Photography in United States of America
List values from tableCities
Photography in Pasadena (California)
Photography in Newark (New Jersey)
Photography in Fullerton (California)
Photography in Miramar (Florida)

I am delighted to offer you access to this comprehensive database of ours, consisting of a detailed list of all countries globally and approximately 48,000 major cities around the world, organized into two distinct tables. These datasets are available for download in both .sql and .csv extension - allowing you to integrate this repository into your own application.

tableCountries

tableCountries

This table contains all countries in the world. The structure of the table is as follows:

column type example
id integer 101
country varchar United States of America
country_iso varchar US
tableCities

tableCities

This table contains all major cities in the world (around 48,000 listings) together with the latitude and longitude coordinates as well as the population, both for the city itself but also for the greater metropolitan area. The structure of the table is as follows:

column type example
id integer 25912
city varchar Houston
cityfirstletter varchar H
lat decimal 29.763284
lng decimal -95.363272
country varchar United States of America
country_iso varchar US
state varchar Texas
comment varchar city
populationarea integer 4459000
populationcity integer 3647574

PNG flags to combine with the tables

We also provide a free set of flags in a PNG format to combine with all the countries. The flags comes in two different sizes and are named after the country_iso value in the tables above. Here are examples of how you can display an image of the Australian flag (country_iso = 'au').

These are examples of how you can publish and list counties and cities.

The flag of Australia100 pixels wide
Path:
images/flags/png100px/au.png
The flag of Australia250 pixels wide
Path:
images/flags/png250px/au.png