Programming & Development / April 12, 2025

Enum Representation of Provinces in Vietnam and SQL Table for Storing Provincial Data

Enum Vietnam Provinces Java SQL Hanoi Administrative Divisions Province Code Vietnam Enum Southeast Asia

✅ Enum Representation in Java

Vietnam is divided into 58 provinces (tỉnh) and 5 centrally governed cities (thành phố trực thuộc trung ương), which hold the same administrative status as provinces. The capital city, Hanoi, is one of the centrally governed cities.

Here’s the Java enum representing these provinces and cities along with their standard codes:

java

public enum VietnamProvince {
    HA_NOI("01"),
    HO_CHI_MINH("02"),
    AN_GIANG("03"),
    BA_RIA_VUNG_TAU("04"),
    BAC_GIANG("05"),
    BAC_KAN("06"),
    BAC_LIEU("07"),
    BEN_TRE("08"),
    BINH_DINH("09"),
    BINH_DUONG("10"),
    BINH_PHUOC("11"),
    CA_MAU("12"),
    CAN_THO("13"),
    CAY_LON("14"),
    DA_NANG("15"),
    DAK_LAK("16"),
    DONG_NAI("17"),
    DONG_THAP("18"),
    GIA_LAI("19"),
    HA_GIANG("20"),
    HA_TINH("21"),
    HAI_DUONG("22"),
    HAI_PHONG("23"),
    HAU_GIANG("24"),
    HOA_BINH("25"),
    HUNG_YEN("26"),
    KHANH_HOA("27"),
    KONTUM("28"),
    LAI_CHAU("29"),
    LANG_SON("30"),
    LAM_DONG("31"),
    LONG_AN("32"),
    NAM_DINH("33"),
    NGHE_AN("34"),
    NINH_BINH("35"),
    NINH_THUAN("36"),
    PHU_THO("37"),
    PHU_YEN("38"),
    QUANG_BINH("39"),
    QUANG_NAM("40"),
    QUANG_NINH("41"),
    QUANG_TRI("42"),
    SOC_TRANG("43"),
    SON_LA("44"),
    TAY_NINH("45"),
    THAI_BINH("46"),
    THAI_NGUYEN("47"),
    THANH_HOA("48"),
    THUA_THIEN_HUE("49"),
    TIEN_GIANG("50"),
    TRA_VINH("51"),
    TUAU_HOA("52"),
    VINH_LONG("53"),
    YEN_BAI("54"),
    HAI_MINH("55");

    private final String code;

    VietnamProvince(String code) {
        this.code = code;
    }

    public String getCode() {
        return this.code;
    }
}

✅ SQL Representation for Vietnam’s Provinces

Here is the SQL schema and insert statements for the 58 provinces and 5 centrally governed cities of Vietnam:

sql

-- Table for Vietnam provinces and cities
CREATE TABLE vietnam_provinces (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    code CHAR(2) NOT NULL
);

-- Insert Vietnam's provinces and cities into the table
INSERT INTO vietnam_provinces (name, code) VALUES
('Hanoi', '01'),
('Ho Chi Minh City', '02'),
('An Giang', '03'),
('Ba Ria Vung Tau', '04'),
('Bac Giang', '05'),
('Bac Kan', '06'),
('Bac Lieu', '07'),
('Ben Tre', '08'),
('Binh Dinh', '09'),
('Binh Duong', '10'),
('Binh Phuoc', '11'),
('Ca Mau', '12'),
('Can Tho', '13'),
('Cay Lon', '14'),
('Da Nang', '15'),
('Dak Lak', '16'),
('Dong Nai', '17'),
('Dong Thap', '18'),
('Gia Lai', '19'),
('Ha Giang', '20'),
('Ha Tinh', '21'),
('Hai Duong', '22'),
('Hai Phong', '23'),
('Hau Giang', '24'),
('Hoa Binh', '25'),
('Hung Yen', '26'),
('Khanh Hoa', '27'),
('Kontum', '28'),
('Lai Chau', '29'),
('Lang Son', '30'),
('Lam Dong', '31'),
('Long An', '32'),
('Nam Dinh', '33'),
('Nghe An', '34'),
('Ninh Binh', '35'),
('Ninh Thuan', '36'),
('Phu Tho', '37'),
('Phu Yen', '38'),
('Quang Binh', '39'),
('Quang Nam', '40'),
('Quang Ninh', '41'),
('Quang Tri', '42'),
('Soc Trang', '43'),
('Son La', '44'),
('Tay Ninh', '45'),
('Thai Binh', '46'),
('Thai Nguyen', '47'),
('Thanh Hoa', '48'),
('Thua Thien Hue', '49'),
('Tien Giang', '50'),
('Tra Vinh', '51'),
('Tua Hoa', '52'),
('Vinh Long', '53'),
('Yen Bai', '54');

This structure is great for managing the administrative and geographic data of Vietnam, useful for governance, regional planning, and data analysis.


Comments

No comments yet

Add a new Comment

NUHMAN.COM

Information Technology website for Programming & Development, Web Design & UX/UI, Startups & Innovation, Gadgets & Consumer Tech, Cloud Computing & Enterprise Tech, Cybersecurity, Artificial Intelligence (AI) & Machine Learning (ML), Gaming Technology, Mobile Development, Tech News & Trends, Open Source & Linux, Data Science & Analytics

Categories

Tags

©{" "} Nuhmans.com . All Rights Reserved. Designed by{" "} HTML Codex