Programming & Development / April 11, 2025

How to Represent Comoros’ Islands in Java and SQL Using ISO 3166-2 Codes

Comoros islands Java enum Comoros ISO 3166-2 KM SQL Comoros divisions Comoros administrative regions Spring Boot enum Comoros region list KM island codes provinces of Comoros

🇰🇲 Java Enum: Comoros’ Islands

Comoros is composed of 3 main islands (autonomous islands). These are represented in ISO 3166-2:KM as follows:

java

public enum ComorosIsland {
    ANJOUAN("KM-A"),
    GRANDE_COMORE("KM-G"),
    MOHELI("KM-M");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO comoros_islands (name, code) VALUES
('Anjouan (Ndzuwani)', 'KM-A'),
('Grande Comore (Ngazidja)', 'KM-G'),
('Mohéli (Mwali)', 'KM-M');

✅ Summary

This setup defines the 3 autonomous islands of Comoros using standardized ISO 3166-2:KM codes. It’s ideal for backends, databases, and applications dealing with geographical or governmental data.


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