✅ Enum Representation in Java
Sudan is divided into 18 states (wilayat). Below is the Java enum
representation with two-letter state codes:
java
public enum State {
KHARTOUM("KH"),
AL_JAZIRAH("GZ"),
RIVER_NILE("RN"),
NORTHERN("NR"),
RED_SEA("RS"),
KASSALA("KA"),
GEDAREF("GD"),
SENNAR("SN"),
WHITE_NILE("WN"),
BLUE_NILE("BN"),
NORTH_KORDOFAN("NK"),
SOUTH_KORDOFAN("SK"),
WEST_KORDOFAN("WK"),
NORTH_DARFUR("ND"),
SOUTH_DARFUR("SD"),
EAST_DARFUR("ED"),
CENTRAL_DARFUR("CD"),
WEST_DARFUR("WD");
private final String code;
State(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
🔹 Notes:
- Each state is mapped to a unique two-character code.
- These codes are useful in applications, forms, and data exchange formats.
- The
getCode()
method gives quick access to these standardized abbreviations.
✅ SQL Representation for Storing State Data
Here’s the SQL table schema and insert statements for storing Sudan’s state information:
sql
-- Table definition for Sudanese states
CREATE TABLE states (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
code CHAR(2) NOT NULL
);
-- Insert data for the 18 states of Sudan
INSERT INTO states (name, code) VALUES
('Khartoum', 'KH'),
('Al Jazirah', 'GZ'),
('River Nile', 'RN'),
('Northern', 'NR'),
('Red Sea', 'RS'),
('Kassala', 'KA'),
('Gedaref', 'GD'),
('Sennar', 'SN'),
('White Nile', 'WN'),
('Blue Nile', 'BN'),
('North Kordofan', 'NK'),
('South Kordofan', 'SK'),
('West Kordofan', 'WK'),
('North Darfur', 'ND'),
('South Darfur', 'SD'),
('East Darfur', 'ED'),
('Central Darfur', 'CD'),
('West Darfur', 'WD');
This structure provides a clean, standardized way to manage Sudan’s regional data across both backend systems and applications.