Programming & Development / April 11, 2025

How to Represent Belarus’ Regions in Java and SQL Using ISO 3166-2 Codes

Belarus regions Java enum Belarus ISO 3166-2 BY SQL Belarus regions Belarus administrative divisions Spring Boot enum Belarus regions list BY region codes regions of Belarus

🇧🇾 Java Enum: Belarus’ Regions

Belarus is divided into 6 regions (voblasts) and the capital city of Minsk. Here’s the Java enum using the ISO 3166-2:BY codes.

java

public enum BelarusRegion {
    MINSK("BY-01"),
    BREST("BY-02"),
    GOMEL("BY-03"),
    GRODNO("BY-04"),
    MOGILEV("BY-06"),
    VITEBSK("BY-07"),
    MINSK_CITY("BY-03");

    private final String code;

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

    public String getCode() {
        return code;
    }
}

🗃️ SQL Table and Insert Statements

sql

CREATE TABLE belarus_regions (
    id SERIAL PRIMARY KEY,
    name VARCHAR(64) NOT NULL,
    code VARCHAR(8) NOT NULL UNIQUE
);

INSERT INTO belarus_regions (name, code) VALUES
('Minsk', 'BY-01'),
('Brest', 'BY-02'),
('Gomel', 'BY-03'),
('Grodno', 'BY-04'),
('Mogilev', 'BY-06'),
('Vitebsk', 'BY-07'),
('Minsk City', 'BY-03');

✅ Summary

This setup represents Belarus' 6 regions (voblasts) and the capital city Minsk using the ISO 3166-2:BY codes. This structure is great for region-based data handling, administrative tasks, and geographical functionalities.


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