raramuridesign/mysql-country-list
mysql insert country list into database
MYSQL Country & Nationality List Imports
Use this repository to import comprehensive lists of countries and nationalities into your database or application.
Features
- Multiple Formats: MySQL, JSON, PHP arrays, Python tuples, Joomla custom fields
- Comprehensive Data: Basic country info, detailed geographic data, time zones, nationalities
- Standardized Codes: ISO 3166-2, ISO 3166-3, and numeric codes
- Flag Assets: SVG flags for all countries and territories
- Regular Updates: Maintained to reflect current international standards
Quick Start
Database Import
# Import basic country list
mysql -u username -p database < country-lists/mysql-country-list.sql
# Import detailed country information
mysql -u username -p database < country-lists/mysql-country-list-detailed-info.sql
PHP Usage
<?php
include 'country-lists/php-country-list-array.php';
$countries = $arr; // Ready to use associative array
?>
JavaScript/Web Usage
// Fetch country data
fetch('country-lists/json-country-list.json')
.then(response => response.json())
.then(countries => {
// Use country data in your application
});
Available Data
Country Lists
| Format | File | Description |
|---|---|---|
| MySQL Basic | mysql-country-list.sql | Country codes and names |
| MySQL InnoDB | mysql-country-list-InnoDB.sql | Optimized for InnoDB tables |
| MySQL Detailed | mysql-country-list-detailed-info.sql | Geographic, currency, and language data |
| JSON | json-country-list.json | Structured country data |
| JSON Extended | json-country-list-V2-name-alpha2-3-numeric.json | Full ISO codes and names |
| PHP Array | php-country-list-array.php | PHP associative array |
| Python Tuple | python-country-list-array.py | Django-compatible choices |
| Joomla Field | json-country-list-joomla-custom-field.json | Joomla CMS integration |
Additional Data
- Nationalities: Separate nationality lists for applications requiring distinction
- Time Zones: Country-specific time zone data with GMT offsets
- Flags: SVG flag assets for all countries and territories
Data Standards
All data follows international standards:
- ISO 3166-1: Country codes and names
- ISO 3166-2: Subdivisions and regions
- ISO 4217: Currency codes
- ISO 639: Language codes
Flag Assets
SVG flags are provided in flags/svg/ directory:
- Standard country flags
- Regional variants (UK nations, Caribbean Netherlands)
- Optimized for web use
Time Zone Integration
Import time zone data for location-aware applications:
SOURCE time-zones/time-zone-import.sql;
API Integration
For programmatic access, consider:
- TimezoneDB: Comprehensive time zone API (https://timezonedb.com/api)
- Geonames: Geographic data services (https://www.geonames.org/)
Contributing
We welcome contributions! Please:
- Report data inaccuracies with reliable sources
- Suggest format improvements
- Propose new data fields
- Test changes across all formats
Development Setup
# Clone repository
git clone https://github.com/your-repo/mysql-country-list.git
cd mysql-country-list
# Check data consistency
# (Add validation scripts as needed)
Maintenance Notes
- Outdated Names: Some legacy names are preserved with notes (e.g., "Netherlands Antilles (dissolved)")
- Data Sources: Regularly updated from ISO standards and official registries
- Compatibility: Tested across MySQL 5.7+, PHP 7.0+, Python 3.6+
License
MIT License - see MIT-License file for details.
Credits
Maintained by: raramuridesign.com
Data Sources:
- ISO 3166 International Standards
- United Nations Geoscheme
- Geonames Database
- Flagpack (SVG flags)
Related Projects:
For detailed documentation, see docs/ directory.
Similar Projects
Discover other similar projects and AI models.
Laravel country database package with Eloquent models, ISO 3166 codes, country flags, GeoJSON maps, phone codes, currencies and translations in 9 languages. Built with migrations & seeders for Laravel 10–13.
:flags: A curated collection of all country flags in SVG — plus the CSS for easier integration
A collection of 400+ minimal circular SVG country, state and language flags
Complete .NET library for worldwide country data: ISO codes, currencies, languages, regions, borders & translations for 250+ countries.
A lightweight Python library for accessing comprehensive country data — including ISO codes, states/provinces, capital cities, currencies, languages, and other geographic information.
convert country codes (ISO 3166-1 alpha-2) to corresponding emoji flags (unicode regional indicator symbols)
An UITextField subclass to simplify country code's picking. Swift 5.0
A collection of 400+ minimalist square SVG country, state and language flags