🇨🇱 Java Enum: Chile’s Regions
Chile is divided into 16 regions. Below is the Java enum
using official ISO 3166-2:CL codes:
java
public enum ChileRegion {
ARICA_Y_PARINACOTA("CL-AP"),
TARAPACA("CL-TA"),
ANTOFAGASTA("CL-AN"),
ATACAMA("CL-AT"),
COQUIMBO("CL-CO"),
VALPARAISO("CL-VS"),
METROPOLITANA("CL-RM"),
O_HIGGINS("CL-LI"),
MAULE("CL-ML"),
NUBLE("CL-NB"),
BIOBIO("CL-BI"),
ARAUCANIA("CL-AR"),
LOS_RIOS("CL-LR"),
LOS_LAGOS("CL-LL"),
AISEN("CL-AI"),
MAGALLANES("CL-MA");
private final String code;
ChileRegion(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
🗃️ SQL Table and Insert Statements
sql
CREATE TABLE chile_regions (
id SERIAL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
code VARCHAR(8) NOT NULL UNIQUE
);
INSERT INTO chile_regions (name, code) VALUES
('Arica y Parinacota', 'CL-AP'),
('Tarapacá', 'CL-TA'),
('Antofagasta', 'CL-AN'),
('Atacama', 'CL-AT'),
('Coquimbo', 'CL-CO'),
('Valparaíso', 'CL-VS'),
('Región Metropolitana de Santiago', 'CL-RM'),
('Libertador General Bernardo O’Higgins', 'CL-LI'),
('Maule', 'CL-ML'),
('Ñuble', 'CL-NB'),
('Biobío', 'CL-BI'),
('La Araucanía', 'CL-AR'),
('Los Ríos', 'CL-LR'),
('Los Lagos', 'CL-LL'),
('Aysén del General Carlos Ibáñez del Campo', 'CL-AI'),
('Magallanes y de la Antártica Chilena', 'CL-MA');
✅ Summary
This setup covers Chile’s 16 official regions using ISO 3166-2 codes. It’s perfect for backend systems needing consistent and standardized regional data for Chile.