Programming & Development / April 11, 2025

How to Represent Lesotho’s Districts in Java and SQL Using ISO 3166-2 Codes

Lesotho districts Java enum Lesotho ISO 3166-2 LS SQL Lesotho districts LS district codes Lesotho administrative divisions backend region enum Lesotho districts Java SQL Spring Boot regions Lesotho

🇱🇸 Java Enum: Lesotho’s Districts

Lesotho is divided into 10 districts. Here’s the Java enum using ISO 3166-2:LS codes:

java

public enum LesothoDistrict {
    ADHOLO("LS-A"),
    BEREA("LS-B"),
    LEJONE("LS-C"),
    MASERU("LS-D"),
    MOHALE("LS-E"),
    QUTHING("LS-F"),
    QUAKEPELE("LS-G"),
    THABA_TSEKA("LS-H"),
    SHELEMELE("LS-I"),
    LIBERIA("LS-J");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO lesotho_districts (name, code) VALUES
('Adholi', 'LS-A'),
('Berea', 'LS-B'),
('Lejone', 'LS-C'),
('Maseru', 'LS-D'),
('Mohale', 'LS-E'),
('Quthing', 'LS-F'),
('Quakepele', 'LS-G'),
('Thaba Tseka', 'LS-H'),
('Shelemel', 'LS-I'),
('Liberia', 'LS-J');

✅ Summary

This setup covers all 10 districts of Lesotho using ISO 3166-2:LS codes, ideal for backend services, 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