🇨🇳 Java Enum: China's Provincial-Level Divisions
China is divided into 34 provincial-level divisions, including:
- 23 provinces (e.g., Guangdong, Sichuan)
- 5 autonomous regions (e.g., Xinjiang, Tibet)
- 4 direct-controlled municipalities (e.g., Beijing, Shanghai)
- 2 special administrative regions (SARs): Hong Kong and Macau
Here's the Java enum
using ISO 3166-2:CN codes:
java
public enum ChinaProvince {
ANHUI("CN-AH"),
BEIJING("CN-BJ"),
CHONGQING("CN-CQ"),
FUJIAN("CN-FJ"),
GANSU("CN-GS"),
GUANGDONG("CN-GD"),
GUANGXI("CN-GX"),
GUIZHOU("CN-GZ"),
HAINAN("CN-HI"),
HEBEI("CN-HE"),
HEILONGJIANG("CN-HL"),
HENAN("CN-HA"),
HUBEI("CN-HB"),
HUNAN("CN-HN"),
INNER_MONGOLIA("CN-NM"),
JIANGSU("CN-JS"),
JIANGXI("CN-JX"),
JILIN("CN-JL"),
LIAONING("CN-LN"),
NINGXIA("CN-NX"),
QINGHAI("CN-QH"),
SHAANXI("CN-SN"),
SHANDONG("CN-SD"),
SHANGHAI("CN-SH"),
SHANXI("CN-SX"),
SICHUAN("CN-SC"),
TIANJIN("CN-TJ"),
TIBET("CN-XZ"),
XINJIANG("CN-XJ"),
YUNNAN("CN-YN"),
ZHEJIANG("CN-ZJ"),
HONG_KONG("CN-HK"),
MACAU("CN-MO"),
TAIWAN("CN-TW"); // Note: Taiwan is claimed by China
private final String code;
ChinaProvince(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
🗃️ SQL Table and Insert Statements
sql
CREATE TABLE china_provinces (
id SERIAL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
code VARCHAR(8) NOT NULL UNIQUE
);
INSERT INTO china_provinces (name, code) VALUES
('Anhui', 'CN-AH'),
('Beijing', 'CN-BJ'),
('Chongqing', 'CN-CQ'),
('Fujian', 'CN-FJ'),
('Gansu', 'CN-GS'),
('Guangdong', 'CN-GD'),
('Guangxi Zhuang Autonomous Region', 'CN-GX'),
('Guizhou', 'CN-GZ'),
('Hainan', 'CN-HI'),
('Hebei', 'CN-HE'),
('Heilongjiang', 'CN-HL'),
('Henan', 'CN-HA'),
('Hubei', 'CN-HB'),
('Hunan', 'CN-HN'),
('Inner Mongolia Autonomous Region', 'CN-NM'),
('Jiangsu', 'CN-JS'),
('Jiangxi', 'CN-JX'),
('Jilin', 'CN-JL'),
('Liaoning', 'CN-LN'),
('Ningxia Hui Autonomous Region', 'CN-NX'),
('Qinghai', 'CN-QH'),
('Shaanxi', 'CN-SN'),
('Shandong', 'CN-SD'),
('Shanghai', 'CN-SH'),
('Shanxi', 'CN-SX'),
('Sichuan', 'CN-SC'),
('Tianjin', 'CN-TJ'),
('Tibet Autonomous Region', 'CN-XZ'),
('Xinjiang Uyghur Autonomous Region', 'CN-XJ'),
('Yunnan', 'CN-YN'),
('Zhejiang', 'CN-ZJ'),
('Hong Kong SAR', 'CN-HK'),
('Macau SAR', 'CN-MO'),
('Taiwan', 'CN-TW');
✅ Summary
This setup represents all 34 official provincial-level divisions of China using ISO 3166-2:CN codes. Ideal for applications that need to handle Chinese geographical data in a standardized format.