Skip to content

Daftar kode wilayah NKRI, mencakup propinsi, kabupaten/kota,kecamatan, kelurahan dan kode pos.

Notifications You must be signed in to change notification settings

w3appdev/kodepos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

SQL SCRIPT (MYSQL)

Daftar Kode Wilayah NKRI (+KODE POS)

Sumber:https://www.nomor.net


Update per 18 Mei 2023:
38 propinsi, 514 kota+kabupaten, 7.277 kecamatan/distrik, 83.763 desa/kelurahan.


Contoh Verifikasi

Jumlah Propinsi

SELECT COUNT(*) AS `Total Propinsi`
FROM (SELECT kodewilayah
FROM kodewilayah2023
GROUP BY namapropinsi) AS kodewilayah

Jumlah Kabupaten

SELECT COUNT(*) AS `Total Kabupaten`
FROM (SELECT kodewilayah FROM kodewilayah2023
WHERE kodekabkota='Kabupaten'
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah

Jumlah Kota

SELECT COUNT(*) AS `Total Kota`
FROM (SELECT kodewilayah FROM kodewilayah2023
WHERE kodekabkota='Kota'
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah

Jumlah Kota+Kabupaten

SELECT COUNT(*) AS `Total Kota+Kabupaten`
FROM (SELECT kodewilayah FROM kodewilayah2023
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah

Jumlah Kecamatan

SELECT COUNT(*) AS `Total Kecamatan`
FROM (SELECT kodewilayah FROM kodewilayah2023
GROUP BY LEFT(kodewilayah,8)) AS kodewilayah

Jumlah Desa/Kelurahan

SELECT COUNT(*) AS `Total Desa/Kelurahan`
FROM kodewilayah2023

Contoh Rekap:

SELECT (SELECT COUNT(*)
        FROM (SELECT NULL 
              FROM kodewilayah2023
              GROUP BY namapropinsi) Propinsi) AS 'Total Propinsi',
       (SELECT COUNT(*)
        FROM (SELECT NULL 
              FROM kodewilayah2023 
              GROUP BY LEFT(kodewilayah,5)) KotaKabupaten)  AS `Total Kota+Kabupaten`,
       (SELECT COUNT(*)
        FROM (SELECT NULL 
              FROM kodewilayah2023 
              GROUP BY LEFT(kodewilayah,8)) Kecamatan)  AS `Total Kecamatan`,
       (SELECT COUNT(*) 
        FROM kodewilayah2023)  AS `Total Desa/Kelurahan`

About

Daftar kode wilayah NKRI, mencakup propinsi, kabupaten/kota,kecamatan, kelurahan dan kode pos.

Topics

Resources

Stars

Watchers

Forks