🇭🇺 Java Enum: Hungary’s Counties
Hungary is divided into 19 counties and the capital, Budapest. Here’s the Java enum
using ISO 3166-2:HU codes:
java
public enum HungaryCounty {
BACS_KISKUN("HU-BK"),
BARANYA("HU-BA"),
BECS_KOZSEG("HU-BC"),
BUDAPEST("HU-BU"),
FEJER("HU-FE"),
GYOR_MOSON_SOPRON("HU-GY"),
HAJDUSZOBOSZLO("HU-HS"),
HEVES("HU-HE"),
JASZ_NAGYKUN_SZOLNOK("HU-JN"),
KEMES("HU-KE"),
KOMAROM_ESZTERGOM("HU-KM"),
NOGRAD("HU-NO"),
PEST("HU-PE"),
SOMOGY("HU-SO"),
SZABOLCS_SZATMAR_BEREG("HU-SZ"),
TOLNA("HU-TO"),
VAS("HU-VS"),
VESZPREM("HU-VP"),
ZALA("HU-ZA");
private final String code;
HungaryCounty(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
🗃️ SQL Table and Insert Statements
sql
CREATE TABLE hungary_counties (
id SERIAL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
code VARCHAR(8) NOT NULL UNIQUE
);
INSERT INTO hungary_counties (name, code) VALUES
('Bács-Kiskun', 'HU-BK'),
('Baranya', 'HU-BA'),
('Becs Kozseg', 'HU-BC'),
('Budapest', 'HU-BU'),
('Fejer', 'HU-FE'),
('Gyor-Moson-Sopron', 'HU-GY'),
('Hajduszoboszlo', 'HU-HS'),
('Heves', 'HU-HE'),
('Jasz Nagykun Szolnok', 'HU-JN'),
('Kemes', 'HU-KE'),
('Komarom-Esztergom', 'HU-KM'),
('Nograd', 'HU-NO'),
('Pest', 'HU-PE'),
('Somogy', 'HU-SO'),
('Szabolcs-Szatmar-Bereg', 'HU-SZ'),
('Tolna', 'HU-TO'),
('Vas', 'HU-VS'),
('Veszprem', 'HU-VP'),
('Zala', 'HU-ZA');
✅ Summary
This setup covers all 19 counties of Hungary (including Budapest), using ISO 3166-2:HU codes, ideal for backend services, Java applications, and SQL databases.