• Your shopping cart is empty!

Country Borders

FREE

Country borders is a free data that provides you a complete list of countries and the associated land border countries (the neighboring countries). The data come in form of CSV format, and you can easily import into any relational database for query. Furthermore, this data use ISO3166-1 for the country code allowing you to retrieve and use the information with ease.

Specifications

Field Name Description Type Length
country_code Two-character country code based on ISO 3166. character 2
country_name Name of country. character 100
country_border_code Two-character country code based on ISO 3166. character 2
country_border_name Name of country border. character 100

Example of Country Borders

From the below table, we know that France and Spain share the same border as Andorra.

country_code country_name country_border_code country_border_name
AD Andorra FR France
AD Andorra ES Spain
AE United Arab Emirates OM Oman
AE United Arab Emirates SA Saudi Arabia

SQL Statement
-- Create table "country_borders"
CREATE TABLE `country_borders`(
	`country_code` VARCHAR(2),
	`country_name` VARCHAR(100),
	`country_border_code` VARCHAR(2),
	`country_border_name` VARCHAR(100),
	PRIMARY KEY (`country_code`, `country_border_code`),
	INDEX `idx_country_code` (`country_code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- Load data into table
LOAD DATA LOCAL
INFILE 'GEODATASOURCE-COUNTRY-BORDERS.CSV'
INTO TABLE `country_borders`
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
-- Create table "country_borders"
CREATE TABLE [geodatasource].[dbo].[country_border](
	[country_code] nvarchar(2) NOT NULL,
	[country_name] nvarchar(100) NOT NULL,
	[country_border_code] nvarchar(2) NOT NULL,
	[country_border_name] nvarchar(100),
	CONSTRAINT PK_country_borders PRIMARY KEY ([country_code], [country_border_code])
) ON [PRIMARY]
GO

CREATE INDEX [idx_country_code] ON [geodatasource].[dbo].[country_borders]([country_code]) ON [PRIMARY]
GO
Licensing

The Country Borders data is licensed under Creative Commons Attribution-ShareAlike 4.0 International License. It is free for personal or commercial use with attribution required by mentioning the use of this data as follows,
This site or product includes Country Borders data available from https://www.geodatasource.com.