Programming & Development / April 11, 2025

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

Botswana districts Java enum Botswana ISO 3166-2 BW SQL Botswana districts Botswana administrative divisions Spring Boot enum Botswana districts list BW region codes districts of Botswana

🇧🇼 Java Enum: Botswana’s Districts

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

java

public enum BotswanaDistrict {
    CENTRAL("BW-C"),
    CHOBE("BW-CH"),
    GHANZI("BW-G"),
    KGALAGADI("BW-K"),
    KGDISTRICT("BW-KG"),
    NORTH_EAST("BW-NE"),
    NORTH_WEST("BW-NW"),
    SOUTH_EAST("BW-SE"),
    SOUTH("BW-S"),
    SEROWE("BW-SW");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

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

INSERT INTO botswana_districts (name, code) VALUES
('Central', 'BW-C'),
('Chobe', 'BW-CH'),
('Ghanzi', 'BW-G'),
('Kgalagadi', 'BW-K'),
('Kgdistrict', 'BW-KG'),
('North East', 'BW-NE'),
('North West', 'BW-NW'),
('South East', 'BW-SE'),
('South', 'BW-S'),
('Serowe', 'BW-SW');

✅ Summary

This setup represents Botswana’s 10 districts using the ISO 3166-2:BW codes. It’s useful for managing geographical data, administrative tasks, or region-based processing in your applications.


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