🇬🇭 Java Enum: Ghana’s Regions
Ghana is divided into 16 regions. Here’s the Java enum
using ISO 3166-2:GH codes:
java
public enum GhanaRegion {
ACCRA("GH-AA"),
ASHANTI("GH-01"),
BOLGATANGA("GH-02"),
CENTRAL("GH-03"),
EASTERN("GH-04"),
GREATER_ACCRA("GH-AA"),
NORTHERN("GH-05"),
OTI("GH-06"),
VOLTA("GH-07"),
WESTERN("GH-08"),
WESTERN_NORTH("GH-09"),
NORTHERN_EASTERN("GH-NE"),
BAWKU("GH-BK"),
SAMERGO("GH-SG"),
GOMOA("GH-GM"),
ABURA("GH-AB");
private final String code;
GhanaRegion(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
🗃️ SQL Table and Insert Statements
sql
CREATE TABLE ghana_regions (
id SERIAL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
code VARCHAR(8) NOT NULL UNIQUE
);
INSERT INTO ghana_regions (name, code) VALUES
('Accra', 'GH-AA'),
('Ashanti', 'GH-01'),
('Bolgatanga', 'GH-02'),
('Central', 'GH-03'),
('Eastern', 'GH-04'),
('Greater Accra', 'GH-AA'),
('Northern', 'GH-05'),
('Oti', 'GH-06'),
('Volta', 'GH-07'),
('Western', 'GH-08'),
('Western North', 'GH-09'),
('Northern Eastern', 'GH-NE'),
('Bawku', 'GH-BK'),
('Samargo', 'GH-SG'),
('Gomoa', 'GH-GM'),
('Abura', 'GH-AB');
✅ Summary
This setup covers all 16 regions of Ghana using ISO 3166-2:GH codes. It is ready for backend services, Java applications, and SQL databases.