Programming & Development / April 11, 2025

How to Represent Hungary’s Counties in Java and SQL Using ISO 3166-2 Codes

Hungary counties Java enum Hungary ISO 3166-2 HU SQL Hungary counties HU county codes Hungary administrative divisions backend region enum Hungary provinces Java SQL Spring Boot regions Hungary

🇭🇺 Java Enum: Hungary’s Counties

Hungary is divided into 19 counties and the capital, Budapest. Here’s the Java enum using ISO 3166-2:HU codes:

java

public enum HungaryCounty {
    BACS_KISKUN("HU-BK"),
    BARANYA("HU-BA"),
    BECS_KOZSEG("HU-BC"),
    BUDAPEST("HU-BU"),
    FEJER("HU-FE"),
    GYOR_MOSON_SOPRON("HU-GY"),
    HAJDUSZOBOSZLO("HU-HS"),
    HEVES("HU-HE"),
    JASZ_NAGYKUN_SZOLNOK("HU-JN"),
    KEMES("HU-KE"),
    KOMAROM_ESZTERGOM("HU-KM"),
    NOGRAD("HU-NO"),
    PEST("HU-PE"),
    SOMOGY("HU-SO"),
    SZABOLCS_SZATMAR_BEREG("HU-SZ"),
    TOLNA("HU-TO"),
    VAS("HU-VS"),
    VESZPREM("HU-VP"),
    ZALA("HU-ZA");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

CREATE TABLE hungary_counties (
    id SERIAL PRIMARY KEY,
    name VARCHAR(64) NOT NULL,
    code VARCHAR(8) NOT NULL UNIQUE
);

INSERT INTO hungary_counties (name, code) VALUES
('Bács-Kiskun', 'HU-BK'),
('Baranya', 'HU-BA'),
('Becs Kozseg', 'HU-BC'),
('Budapest', 'HU-BU'),
('Fejer', 'HU-FE'),
('Gyor-Moson-Sopron', 'HU-GY'),
('Hajduszoboszlo', 'HU-HS'),
('Heves', 'HU-HE'),
('Jasz Nagykun Szolnok', 'HU-JN'),
('Kemes', 'HU-KE'),
('Komarom-Esztergom', 'HU-KM'),
('Nograd', 'HU-NO'),
('Pest', 'HU-PE'),
('Somogy', 'HU-SO'),
('Szabolcs-Szatmar-Bereg', 'HU-SZ'),
('Tolna', 'HU-TO'),
('Vas', 'HU-VS'),
('Veszprem', 'HU-VP'),
('Zala', 'HU-ZA');

✅ Summary

This setup covers all 19 counties of Hungary (including Budapest), using ISO 3166-2:HU codes, ideal for backend services, Java applications, and SQL databases.


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