π¦πͺ Java Enum: Emirates of the UAE with ISO Codes
This Java enum
represents all 7 Emirates of the UAE using their official ISO 3166-2:AE codes.
java
public enum UAEEmirate {
ABU_DHABI("AZ"),
AJMAN("AJ"),
DUBAI("DU"),
FUJAIRAH("FU"),
RAS_AL_KHAIMAH("RK"),
SHARJAH("SH"),
UMM_AL_QUWAIN("UQ");
private final String code;
UAEEmirate(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
Usage Example:
java
UAEEmirate emirate = UAEEmirate.DUBAI;
System.out.println(emirate.getCode()); // Outputs: DU
ποΈ SQL Version: UAE Emirates Table
Hereβs the SQL schema and insert statements for creating a table that represents the 7 Emirates of the UAE.
sql
CREATE TABLE uae_emirates (
id SERIAL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
code CHAR(2) NOT NULL UNIQUE
);
Insert Statements:
sql
INSERT INTO uae_emirates (name, code) VALUES
('Abu Dhabi', 'AZ'),
('Ajman', 'AJ'),
('Dubai', 'DU'),
('Fujairah', 'FU'),
('Ras Al Khaimah', 'RK'),
('Sharjah', 'SH'),
('Umm Al Quwain', 'UQ');
β
Summary
This representation of the UAE's Emirates as a Java enum
and in a relational SQL table provides a structured approach to handling address and regional data. The ISO 3166-2:AE codes ensure compliance with international standards and enable integration across systems.