Skip to content

Tables linked by country, community/state, province, locations. Currently only Spain, database updated until December 2022, which includes the latest territorial updates. This structure is ready to be imported into MySql

License

yanker/countries-and-locations.sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIT License


LINKED TABLES (country, community/state, province, municipalities)

Tables linked by country, community/state, province, locations. Currently only Spain, database updated until December 2022, which includes the latest territorial updates. This structure is ready to be imported into MySql


Stuctuct Tables



TABLE app_countries (COUNTRIES)

ROW TYPE DETAILS
id tinyint(4) Autonumber unique identifier
title varchar(100) Name of the country


TABLE app_states (STATES)

ROW TYPE DETAILS
id tinyint(4) Autonumber unique identifier
title varchar(100) Name of the state
country_id tinyint(4) idLink country-state


TABLE app_locations (LOCATIONS)

ROW TYPE DETAILS
id tinyint(4) Autonumber unique identifier
title varchar(100) Name of the location
states_id tinyint(4) idLink state-location

Getting Started


If you haven´t database create, you must create database before of import the scripts

Import the database in the order exactly indiqued and country seleccioned /scr/getting-start/

  1. app_countries.sql
  2. app_ccaa.sql
  3. app_states.sql
  4. app_locations.sql

Now, Select your country in src/ and import in the database in the order exactly

  1. app_countries.sql
  2. app_ccaa.sql
  3. app_states.sql
  4. app_locations.sql

Countries Availables


src/spain --> Spain src/eeuu --> United States


Test


Exec sql for view results after insert rows

SELECT loc.title AS 'Location',st.title AS 'State', cc.title AS 'CCAA', co.title AS 'Country' FROM app_locations loc LEFT JOIN app_states st ON st.id = loc. states_id LEFT JOIN app_ccaa cc ON cc.id = st.ccaa_id LEFT JOIN app_countries co ON co.id = st.country_id ORDER BY loc.id DESC


## Autor --- Alejandro Estévez (Yanker)

Credits



Built With


My Skills


Licence

Distributed under the MIT License. See LICENSE.txt for more information.


Changelog


History of updates in changelog


Support The Project


Thank you I hope what you utils my projects! If you want contact whith me you want open issues.

Made with 💌 from 🇪🇸

About

Tables linked by country, community/state, province, locations. Currently only Spain, database updated until December 2022, which includes the latest territorial updates. This structure is ready to be imported into MySql

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published