Programming & Development / April 11, 2025

Modeling Norway's Counties in Java and SQL Using ISO 3166-2:NO Codes

Norway counties Norway regions Java enum Norway ISO 3166-2 NO SQL Norway Norway subdivisions Spring Boot geographic enum Norway administrative units backend regions Norway counties of Norway

๐Ÿ‡ณ๐Ÿ‡ด Java Enum: Norway's Counties

Norway is divided into 11 counties (as of 2021) and the Oslo region (often counted as a special case). Each county has its official ISO 3166-2:NO code.

java

public enum NorwayCounty {
    AGDER("NO-42"),
    INNLANDET("NO-34"),
    Mร˜RE_OG_ROMSDAL("NO-15"),
    NORDLAND("NO-18"),
    OSLO("NO-03"),
    ROGALAND("NO-11"),
    VESTFOLD_OG_TELEMARK("NO-30"),
    VIKEN("NO-30"),
    TROMS_OG_FINNMARK("NO-54"),
    HORDALAND("NO-46"),
    BUSKERUD("NO-06");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

๐Ÿ—ƒ๏ธ SQL Table and Insert Statements

sql

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

INSERT INTO norway_counties (name, code) VALUES
('Agder', 'NO-42'),
('Inlandet', 'NO-34'),
('Mรธre og Romsdal', 'NO-15'),
('Nordland', 'NO-18'),
('Oslo', 'NO-03'),
('Rogaland', 'NO-11'),
('Vestfold og Telemark', 'NO-30'),
('Viken', 'NO-30'),
('Troms og Finnmark', 'NO-54'),
('Hordaland', 'NO-46'),
('Buskerud', 'NO-06');

โœ… Summary

This setup models Norway's counties with their ISO 3166-2:NO codes. It can be used in backend systems, geographic applications, or databases dealing with Norway'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