Programming & Development / April 11, 2025

How to Represent Malawi’s Regions in Java and SQL Using ISO 3166-2 Codes

Malawi regions Java enum Malawi ISO 3166-2 MW SQL Malawi regions MW region codes Malawi administrative divisions backend region enum Malawi Java SQL Spring Boot regions Malawi

🇲🇼 Java Enum: Malawi’s Regions

Malawi is divided into 3 main regions according to ISO 3166-2:MW. Here is the Java enum representation:

java

public enum MalawiRegion {
    CENTRAL("MW-C"),
    NORTHERN("MW-N"),
    SOUTHERN("MW-S");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO malawi_regions (name, code) VALUES
('Central', 'MW-C'),
('Northern', 'MW-N'),
('Southern', 'MW-S');

✅ Summary

This setup covers all 3 ISO 3166-2 regions of Malawi, providing a clean way to integrate region data into 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