✅ Enum Representation in Java
Taiwan (Republic of China) is composed of 22 administrative divisions, including 6 special municipalities, 3 provincial cities, and 13 counties. Here's the Java enum
representation with division codes:
java
public enum TaiwanDivision {
TAIPEI("TP"),
NEW_TAIPEI("NT"),
TAOYUAN("TY"),
TAICHUNG("TC"),
TAINAN("TN"),
KAOHSIUNG("KH"),
KEELUNG("KL"),
HSINCHU_CITY("HC"),
CHIAYI_CITY("CC"),
YILAN_COUNTY("IL"),
HSINCHU_COUNTY("HCY"),
MIAOLI_COUNTY("ML"),
CHANGHUA_COUNTY("CH"),
NANTOU_COUNTY("NTU"),
YUNLIN_COUNTY("YL"),
CHIAYI_COUNTY("CY"),
PINGTUNG_COUNTY("PT"),
TAITUNG_COUNTY("TT"),
HUALIEN_COUNTY("HL"),
PENGHU_COUNTY("PH"),
KINMEN_COUNTY("KM"),
LIENCHIANG_COUNTY("LC");
private final String code;
TaiwanDivision(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
🔹 Notes:
- Includes all first-level divisions.
- Naming follows English conventions with
_CITY
and _COUNTY
for clarity.
- Codes are common abbreviations or ISO-like representations used in government and postal data.
✅ SQL Representation for Storing Taiwan’s Administrative Divisions
Here is the SQL schema and insert script for the 22 divisions:
sql
-- Table for Taiwan's administrative divisions
CREATE TABLE taiwan_divisions (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
code VARCHAR(5) NOT NULL
);
-- Insert divisions into the table
INSERT INTO taiwan_divisions (name, code) VALUES
('Taipei', 'TP'),
('New Taipei', 'NT'),
('Taoyuan', 'TY'),
('Taichung', 'TC'),
('Tainan', 'TN'),
('Kaohsiung', 'KH'),
('Keelung', 'KL'),
('Hsinchu City', 'HC'),
('Chiayi City', 'CC'),
('Yilan County', 'IL'),
('Hsinchu County', 'HCY'),
('Miaoli County', 'ML'),
('Changhua County', 'CH'),
('Nantou County', 'NTU'),
('Yunlin County', 'YL'),
('Chiayi County', 'CY'),
('Pingtung County', 'PT'),
('Taitung County', 'TT'),
('Hualien County', 'HL'),
('Penghu County', 'PH'),
('Kinmen County', 'KM'),
('Lienchiang County', 'LC');
This design supports regional handling in Java applications and databases for Taiwan.