Programming & Development / April 11, 2025

Modeling New Zealand's Regions in Java and SQL Using ISO 3166-2:NZ Codes

New Zealand regions New Zealand provinces Java enum New Zealand ISO 3166-2 NZ SQL New Zealand New Zealand subdivisions Spring Boot geographic enum New Zealand administrative units New Zealand backend regions regions of New Zealand

🇳🇿 Java Enum: New Zealand's Regions

New Zealand is divided into 12 regions, each with its official ISO 3166-2:NZ code.

java

public enum NewZealandRegion {
    NORTHLAND("NZ-N"),
    AUCKLAND("NZ-AK"),
    WAIKATO("NZ-WK"),
    BAY_OF_PLENTY("NZ-BOP"),
    GISBORNE("NZ-GIS"),
    HAWKES_BAY("NZ-HKB"),
    TARANAKI("NZ-TKI"),
    MANAWATU_WANGANUI("NZ-MWT"),
    WELLINGTON("NZ-WGN"),
    NELSON("NZ-NEL"),
    MARLBOROUGH("NZ-MBH"),
    CANTERBURY("NZ-CAN"),
    OTAGO("NZ-OTA"),
    SOUTHLAND("NZ-STL");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO newzealand_regions (name, code) VALUES
('Northland', 'NZ-N'),
('Auckland', 'NZ-AK'),
('Waikato', 'NZ-WK'),
('Bay of Plenty', 'NZ-BOP'),
('Gisborne', 'NZ-GIS'),
('Hawke\'s Bay', 'NZ-HKB'),
('Taranaki', 'NZ-TKI'),
('Manawatu-Wanganui', 'NZ-MWT'),
('Wellington', 'NZ-WGN'),
('Nelson', 'NZ-NEL'),
('Marlborough', 'NZ-MBH'),
('Canterbury', 'NZ-CAN'),
('Otago', 'NZ-OTA'),
('Southland', 'NZ-STL');

✅ Summary

This setup models New Zealand's regions with their ISO 3166-2:NZ codes. This data structure can be applied in backend systems, geographic data applications, or databases dealing with New Zealand's administrative regions.



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