Programming & Development / April 12, 2025

Enum Representation of Divisions in Tonga and SQL Table for Storing Division Data

Enum Tonga Divisions Java SQL Nukuʻalofa Tongatapu Administrative Division Island Groups Division Code Polynesia

✅ Enum Representation in Java

Tonga is divided into 5 administrative divisions, which are based on its main island groups:

  1. Tongatapu
  2. Vavaʻu
  3. Haʻapai
  4. ʻEua
  5. Niuas (includes Niuafoʻou and Niuatoputapu)

Here’s the Java enum representing these divisions with short two-letter codes:

java

public enum TongaDivision {
    TONGATAPU("TT"),
    VAVAU("VV"),
    HAAPAI("HP"),
    EUA("EU"),
    NIUAS("NU");

    private final String code;

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

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

✅ SQL Representation for Tonga’s Divisions

Below is the SQL schema and INSERT statements for storing Tonga's 5 divisions:

sql

-- Table for Tonga administrative divisions
CREATE TABLE tonga_divisions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    code CHAR(2) NOT NULL
);

-- Insert administrative divisions into the table
INSERT INTO tonga_divisions (name, code) VALUES
('Tongatapu', 'TT'),
('Vavaʻu', 'VV'),
('Haʻapai', 'HP'),
('ʻEua', 'EU'),
('Niuas', 'NU');

This structure supports systems involving governance, logistics, public services, and geographic analysis for the Kingdom of Tonga.



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