SQL SCRIPT (MYSQL)
Sumber:https://www.nomor.net
Update per 23 Juli 2020:
34 provinsi, 514 kota+kabupaten, 7.201 kecamatan/distrik, 83.436 desa/kelurahan.
Contoh Verifikasi
Jumlah Propinsi
SELECT COUNT(*) AS `Total Propinsi`
FROM (SELECT kodewilayah
FROM kodewilayah
GROUP BY LEFT(kodewilayah,2)) AS kodewilayah
Jumlah Kabupaten
SELECT COUNT(*) AS `Total Kabupaten`
FROM (SELECT kodewilayah FROM kodewilayah
WHERE kodekabkota='Kabupaten'
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah
Jumlah Kota
SELECT COUNT(*) AS `Total Kota`
FROM (SELECT kodewilayah FROM kodewilayah
WHERE kodekabkota='Kota'
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah
Jumlah Kota+Kabupaten
SELECT COUNT(*) AS `Total Kota+Kabupaten`
FROM (SELECT kodewilayah FROM kodewilayah
GROUP BY LEFT(kodewilayah,5)) AS kodewilayah
Jumlah Kecamatan
SELECT COUNT(*) AS `Total Kecamatan`
FROM (SELECT kodewilayah FROM kodewilayah
GROUP BY LEFT(kodewilayah,8)) AS kodewilayah
Jumlah Desa/Kelurahan
SELECT COUNT(*) AS `Total Desa/Kelurahan`
FROM kodewilayah
Contoh Rekap:
SELECT (SELECT COUNT(*)
FROM (SELECT NULL
FROM kodewilayah
GROUP BY LEFT(kodewilayah,2)) Propinsi) AS 'Total Propinsi',
(SELECT COUNT(*)
FROM (SELECT NULL
FROM kodewilayah
GROUP BY LEFT(kodewilayah,5)) KotaKabupaten) AS `Total Kota+Kabupaten`,
(SELECT COUNT(*)
FROM (SELECT NULL
FROM kodewilayah
GROUP BY LEFT(kodewilayah,8)) Kecamatan) AS `Total Kecamatan`,
(SELECT COUNT(*)
FROM kodewilayah) AS `Total Desa/Kelurahan`