Programming & Development / April 11, 2025

Modeling Nepal's Provinces in Java and SQL Using ISO 3166-2:NP Codes

Nepal provinces Nepal regions Java enum Nepal ISO 3166-2 NP SQL Nepal Nepal subdivisions Spring Boot geographic enum Nepal administrative units Nepal backend regions provinces of Nepal

🇳🇵 Java Enum: Nepal's Provinces

Nepal is divided into 7 provinces, each with its official ISO 3166-2:NP code.

java

public enum NepalProvince {
    PROVINCE_1("NP-P1"),
    PROVINCE_2("NP-P2"),
    BAGMATI("NP-P3"),
    GANDAKI("NP-P4"),
    LUMBINI("NP-P5"),
    KARNALI("NP-P6"),
    SUDURPASCHIM("NP-P7");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO nepal_provinces (name, code) VALUES
('Province 1', 'NP-P1'),
('Province 2', 'NP-P2'),
('Bagmati', 'NP-P3'),
('Gandaki', 'NP-P4'),
('Lumbini', 'NP-P5'),
('Karnali', 'NP-P6'),
('Sudurpashchim', 'NP-P7');

✅ Summary

This setup models Nepal's provinces with their ISO 3166-2:NP codes, which can be applied in backend systems, geographic data handling, or databases involving Nepal'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