Programming & Development / April 12, 2025

Enum Representation of States in South Sudan and SQL Table for Storing State Data

Enum State South Sudan Java SQL Central Equatoria Jonglei Unity Upper Nile Bahr el Ghazal State Code

✅ Enum Representation in Java

South Sudan is divided into 10 official states (as of the 2020 reversion from 32 states). Here's the Java enum representation with state codes:

java

public enum State {
    CENTRAL_EQUATORIA("CE"),
    EASTERN_EQATORIA("EE"),
    JONGLEI("JO"),
    LAKES("LK"),
    NORTHERN_BAHR_EL_GHAZAL("NB"),
    UNITY("UN"),
    UPPER_NILE("UP"),
    WARRAP("WR"),
    WESTERN_BAHR_EL_GHAZAL("WB"),
    WESTERN_EQUATORIA("WE");

    private final String code;

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

    public String getCode() {
        return this.code;
    }
}

🔹 Notes:

  • Each enum constant reflects one of the 10 states of South Sudan.
  • Codes are designed for consistency, typically two-letter abbreviations.
  • getCode() provides easy access to the abbreviation.

✅ SQL Representation for Storing State Data

Here is the SQL schema and insert statements to store these states in a relational database:

sql

-- Table creation for states of South Sudan
CREATE TABLE states (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    code CHAR(2) NOT NULL
);

-- Insert states into the table
INSERT INTO states (name, code) VALUES
('Central Equatoria', 'CE'),
('Eastern Equatoria', 'EE'),
('Jonglei', 'JO'),
('Lakes', 'LK'),
('Northern Bahr el Ghazal', 'NB'),
('Unity', 'UN'),
('Upper Nile', 'UP'),
('Warrap', 'WR'),
('Western Bahr el Ghazal', 'WB'),
('Western Equatoria', 'WE');

This design is great for use in backend systems, admin dashboards, and geographic data modeling.


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