Programming & Development / April 11, 2025

How to Represent Argentine Provinces in Java and SQL with Official ISO Codes

Java enum Argentine provinces Argentina ISO 3166-2 AR SQL table enum with code Spring Boot Argentina states insert SQL address validation Buenos Aires provincias argentinas ISO codes Argentina

🇦🇷 Java Enum: Argentine Provinces and City with ISO Codes

Here’s a Java enum representing all 23 provinces and the autonomous city of Buenos Aires (CABA), using ISO 3166-2:AR codes:

java

public enum ArgentineProvince {
    BUENOS_AIRES("B"),
    CABA("C"), // Ciudad Autónoma de Buenos Aires
    CATAMARCA("K"),
    CHACO("H"),
    CHUBUT("U"),
    CORDOBA("X"),
    CORRIENTES("W"),
    ENTRE_RIOS("E"),
    FORMOSA("P"),
    JUJUY("Y"),
    LA_PAMPA("L"),
    LA_RIOJA("F"),
    MENDOZA("M"),
    MISIONES("N"),
    NEUQUEN("Q"),
    RIO_NEGRO("R"),
    SALTA("A"),
    SAN_JUAN("J"),
    SAN_LUIS("D"),
    SANTA_CRUZ("Z"),
    SANTA_FE("S"),
    SANTIAGO_DEL_ESTERO("G"),
    TIERRA_DEL_FUEGO("V"),
    TUCUMAN("T");

    private final String code;

    ArgentineProvince(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }
}

Usage Example:

java

ArgentineProvince province = ArgentineProvince.CORDOBA;
System.out.println(province.getCode()); // Outputs: X

🗃️ SQL Version: Argentine Provinces Table

You can represent these provinces in SQL with the following schema and insert statements:

sql

CREATE TABLE argentine_provinces (
    id SERIAL PRIMARY KEY,
    name VARCHAR(64) NOT NULL,
    code CHAR(2) NOT NULL UNIQUE
);

Insert Statements:

sql

INSERT INTO argentine_provinces (name, code) VALUES
('Buenos Aires', 'B'),
('Ciudad Autónoma de Buenos Aires', 'C'),
('Catamarca', 'K'),
('Chaco', 'H'),
('Chubut', 'U'),
('Córdoba', 'X'),
('Corrientes', 'W'),
('Entre Ríos', 'E'),
('Formosa', 'P'),
('Jujuy', 'Y'),
('La Pampa', 'L'),
('La Rioja', 'F'),
('Mendoza', 'M'),
('Misiones', 'N'),
('Neuquén', 'Q'),
('Río Negro', 'R'),
('Salta', 'A'),
('San Juan', 'J'),
('San Luis', 'D'),
('Santa Cruz', 'Z'),
('Santa Fe', 'S'),
('Santiago del Estero', 'G'),
('Tierra del Fuego, Antártida e Islas del Atlántico Sur', 'V'),
('Tucumán', 'T');

✅ Summary

Representing Argentina’s provinces using Java enums and a structured SQL table makes your application data-safe, standards-compliant (ISO 3166-2:AR), and ready for integration with external systems or forms that handle regional data.


Comments

No comments yet

Add a new Comment

NUHMAN.COM

Information Technology website for Programming & Development, Web Design & UX/UI, Startups & Innovation, Gadgets & Consumer Tech, Cloud Computing & Enterprise Tech, Cybersecurity, Artificial Intelligence (AI) & Machine Learning (ML), Gaming Technology, Mobile Development, Tech News & Trends, Open Source & Linux, Data Science & Analytics

Categories

Tags

©{" "} Nuhmans.com . All Rights Reserved. Designed by{" "} HTML Codex