Print "Hello World"
## Created by RHB
# Your code here
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Test Results")
def test_group():
@test.it("does it print hello world")
def test_case():
test.expect(passed="Hello World", message=None, allow_raise=False)
Perusahaan bernama PT. Gobie memiliki data tentang statistik daily covid 19 di setiap kota di Indonesia yang disimpan di tabel "cases" dengan skema seperti dibawah ini:
Nama Kolom | Tipe Data | Deskripsi |
---|---|---|
id | Serial | Primary Key |
type | varchar | Cara Pengambilan Data |
features_type | varchar | Tipe Pengambilan Data |
dati_code | integer | Kode Dati (Kota) |
confirmed_cases | integer | Jumlah Kasus Covid Terkonfirmasi |
recovered_cases | integer | Jumlah Kasus Covid Sembuh |
death_cases | integer | Jumlah Kasus Covid Meninggal |
date | date | Tanggal |
Selain itu PT. Gobie juga memiliki table bername "dati" yang memiliki skema:
Nama Kolom | Tipe Data | Deskripsi |
---|---|---|
code | integer | Kode Dati |
city_name | varchar | Nama Kota |
province_name | varchar | Nama Provinsi |
country_name | varchar | Nama Negara |
Buatkan query untuk mendapatkan jumlah confirmed_cases, recovered_cases, dan death_cases di masing-masing nama provinsi
Ketentuan:
- Nama kolom: kota,confirmed_cases,recovered_cases,death_cases
- Urutkan berdasarkan jumlah confirmed_cases dari paling banyak ke paling sedikit
Expected Output
kota | confirmed_cases | recovered_cases | death_cases |
---|---|---|---|
Kota Tasikmalaya | 10000 | 2000 | 200 |
Kabupaten Tasikmalaya | 8000 | 3000 | 220 |
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
dati = DB[:dati]
# Populate the table
dati.insert(:code => 1101, :city_name => 'KABUPATEN SIMEULUE', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1102, :city_name => 'KABUPATEN ACEH SINGKIL', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1103, :city_name => 'KABUPATEN ACEH SELATAN', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1104, :city_name => 'KABUPATEN ACEH TENGGARA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1105, :city_name => 'KABUPATEN ACEH TIMUR', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1106, :city_name => 'KABUPATEN ACEH TENGAH', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1107, :city_name => 'KABUPATEN ACEH BARAT', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1108, :city_name => 'KABUPATEN ACEH BESAR', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1109, :city_name => 'KABUPATEN PIDIE', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1110, :city_name => 'KABUPATEN BIREUEN', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1111, :city_name => 'KABUPATEN ACEH UTARA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1112, :city_name => 'KABUPATEN ACEH BARAT DAYA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1113, :city_name => 'KABUPATEN GAYO LUES', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1114, :city_name => 'KABUPATEN ACEH TAMIANG', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1115, :city_name => 'KABUPATEN NAGAN RAYA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1116, :city_name => 'KABUPATEN ACEH JAYA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1117, :city_name => 'KABUPATEN BENER MERIAH', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1118, :city_name => 'KABUPATEN PIDIE JAYA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1171, :city_name => 'KOTA BANDA ACEH', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1172, :city_name => 'KOTA SABANG', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1173, :city_name => 'KOTA LANGSA', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1174, :city_name => 'KOTA LHOKSEUMAWE', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1175, :city_name => 'KOTA SUBULUSSALAM', :province_name => 'ACEH', :country_name => 'Indonesia')
dati.insert(:code => 1201, :city_name => 'KABUPATEN NIAS', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1202, :city_name => 'KABUPATEN MANDAILING NATAL', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1203, :city_name => 'KABUPATEN TAPANULI SELATAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1204, :city_name => 'KABUPATEN TAPANULI TENGAH', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1205, :city_name => 'KABUPATEN TAPANULI UTARA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1206, :city_name => 'KABUPATEN TOBA SAMOSIR', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1207, :city_name => 'KABUPATEN LABUHAN BATU', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1208, :city_name => 'KABUPATEN ASAHAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1209, :city_name => 'KABUPATEN SIMALUNGUN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1210, :city_name => 'KABUPATEN DAIRI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1211, :city_name => 'KABUPATEN KARO', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1212, :city_name => 'KABUPATEN DELI SERDANG', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1213, :city_name => 'KABUPATEN LANGKAT', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1214, :city_name => 'KABUPATEN NIAS SELATAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1215, :city_name => 'KABUPATEN HUMBANG HASUNDUTAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1216, :city_name => 'KABUPATEN PAKPAK BHARAT', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1217, :city_name => 'KABUPATEN SAMOSIR', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1218, :city_name => 'KABUPATEN SERDANG BEDAGAI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1219, :city_name => 'KABUPATEN BATU BARA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1220, :city_name => 'KABUPATEN PADANG LAWAS UTARA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1221, :city_name => 'KABUPATEN PADANG LAWAS', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1222, :city_name => 'KABUPATEN LABUHAN BATU SELATAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1223, :city_name => 'KABUPATEN LABUHAN BATU UTARA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1224, :city_name => 'KABUPATEN NIAS UTARA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1225, :city_name => 'KABUPATEN NIAS BARAT', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1271, :city_name => 'KOTA SIBOLGA', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1272, :city_name => 'KOTA TANJUNG BALAI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1273, :city_name => 'KOTA PEMATANG SIANTAR', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1274, :city_name => 'KOTA TEBING TINGGI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1275, :city_name => 'KOTA MEDAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1276, :city_name => 'KOTA BINJAI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1277, :city_name => 'KOTA PADANGSIDIMPUAN', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1278, :city_name => 'KOTA GUNUNGSITOLI', :province_name => 'SUMATERA UTARA', :country_name => 'Indonesia')
dati.insert(:code => 1301, :city_name => 'KABUPATEN KEPULAUAN MENTAWAI', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1302, :city_name => 'KABUPATEN PESISIR SELATAN', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1303, :city_name => 'KABUPATEN SOLOK', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1304, :city_name => 'KABUPATEN SIJUNJUNG', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1305, :city_name => 'KABUPATEN TANAH DATAR', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1306, :city_name => 'KABUPATEN PADANG PARIAMAN', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1307, :city_name => 'KABUPATEN AGAM', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1308, :city_name => 'KABUPATEN LIMA PULUH KOTA', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1309, :city_name => 'KABUPATEN PASAMAN', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1310, :city_name => 'KABUPATEN SOLOK SELATAN', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1311, :city_name => 'KABUPATEN DHARMASRAYA', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1312, :city_name => 'KABUPATEN PASAMAN BARAT', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1371, :city_name => 'KOTA PADANG', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1372, :city_name => 'KOTA SOLOK', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1373, :city_name => 'KOTA SAWAH LUNTO', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1374, :city_name => 'KOTA PADANG PANJANG', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1375, :city_name => 'KOTA BUKITTINGGI', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1376, :city_name => 'KOTA PAYAKUMBUH', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1377, :city_name => 'KOTA PARIAMAN', :province_name => 'SUMATERA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 1401, :city_name => 'KABUPATEN KUANTAN SINGINGI', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1402, :city_name => 'KABUPATEN INDRAGIRI HULU', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1403, :city_name => 'KABUPATEN INDRAGIRI HILIR', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1404, :city_name => 'KABUPATEN PELALAWAN', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1405, :city_name => 'KABUPATEN S I A K', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1406, :city_name => 'KABUPATEN KAMPAR', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1407, :city_name => 'KABUPATEN ROKAN HULU', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1408, :city_name => 'KABUPATEN BENGKALIS', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1409, :city_name => 'KABUPATEN ROKAN HILIR', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1410, :city_name => 'KABUPATEN KEPULAUAN MERANTI', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1471, :city_name => 'KOTA PEKANBARU', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1473, :city_name => 'KOTA D U M A I', :province_name => 'RIAU', :country_name => 'Indonesia')
dati.insert(:code => 1501, :city_name => 'KABUPATEN KERINCI', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1502, :city_name => 'KABUPATEN MERANGIN', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1503, :city_name => 'KABUPATEN SAROLANGUN', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1504, :city_name => 'KABUPATEN BATANG HARI', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1505, :city_name => 'KABUPATEN MUARO JAMBI', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1506, :city_name => 'KABUPATEN TANJUNG JABUNG TIMUR', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1507, :city_name => 'KABUPATEN TANJUNG JABUNG BARAT', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1508, :city_name => 'KABUPATEN TEBO', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1509, :city_name => 'KABUPATEN BUNGO', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1571, :city_name => 'KOTA JAMBI', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1572, :city_name => 'KOTA SUNGAI PENUH', :province_name => 'JAMBI', :country_name => 'Indonesia')
dati.insert(:code => 1601, :city_name => 'KABUPATEN OGAN KOMERING ULU', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1602, :city_name => 'KABUPATEN OGAN KOMERING ILIR', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1603, :city_name => 'KABUPATEN MUARA ENIM', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1604, :city_name => 'KABUPATEN LAHAT', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1605, :city_name => 'KABUPATEN MUSI RAWAS', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1606, :city_name => 'KABUPATEN MUSI BANYUASIN', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1607, :city_name => 'KABUPATEN BANYU ASIN', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1608, :city_name => 'KABUPATEN OGAN KOMERING ULU SELATAN', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1609, :city_name => 'KABUPATEN OGAN KOMERING ULU TIMUR', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1610, :city_name => 'KABUPATEN OGAN ILIR', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1611, :city_name => 'KABUPATEN EMPAT LAWANG', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1612, :city_name => 'KABUPATEN PENUKAL ABAB LEMATANG ILIR', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1613, :city_name => 'KABUPATEN MUSI RAWAS UTARA', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1671, :city_name => 'KOTA PALEMBANG', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1672, :city_name => 'KOTA PRABUMULIH', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1673, :city_name => 'KOTA PAGAR ALAM', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1674, :city_name => 'KOTA LUBUKLINGGAU', :province_name => 'SUMATERA SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 1701, :city_name => 'KABUPATEN BENGKULU SELATAN', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1702, :city_name => 'KABUPATEN REJANG LEBONG', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1703, :city_name => 'KABUPATEN BENGKULU UTARA', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1704, :city_name => 'KABUPATEN KAUR', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1705, :city_name => 'KABUPATEN SELUMA', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1706, :city_name => 'KABUPATEN MUKOMUKO', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1707, :city_name => 'KABUPATEN LEBONG', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1708, :city_name => 'KABUPATEN KEPAHIANG', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1709, :city_name => 'KABUPATEN BENGKULU TENGAH', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1771, :city_name => 'KOTA BENGKULU', :province_name => 'BENGKULU', :country_name => 'Indonesia')
dati.insert(:code => 1801, :city_name => 'KABUPATEN LAMPUNG BARAT', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1802, :city_name => 'KABUPATEN TANGGAMUS', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1803, :city_name => 'KABUPATEN LAMPUNG SELATAN', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1804, :city_name => 'KABUPATEN LAMPUNG TIMUR', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1805, :city_name => 'KABUPATEN LAMPUNG TENGAH', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1806, :city_name => 'KABUPATEN LAMPUNG UTARA', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1807, :city_name => 'KABUPATEN WAY KANAN', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1808, :city_name => 'KABUPATEN TULANGBAWANG', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1809, :city_name => 'KABUPATEN PESAWARAN', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1810, :city_name => 'KABUPATEN PRINGSEWU', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1811, :city_name => 'KABUPATEN MESUJI', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1812, :city_name => 'KABUPATEN TULANG BAWANG BARAT', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1813, :city_name => 'KABUPATEN PESISIR BARAT', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1871, :city_name => 'KOTA BANDAR LAMPUNG', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1872, :city_name => 'KOTA METRO', :province_name => 'LAMPUNG', :country_name => 'Indonesia')
dati.insert(:code => 1901, :city_name => 'KABUPATEN BANGKA', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1902, :city_name => 'KABUPATEN BELITUNG', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1903, :city_name => 'KABUPATEN BANGKA BARAT', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1904, :city_name => 'KABUPATEN BANGKA TENGAH', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1905, :city_name => 'KABUPATEN BANGKA SELATAN', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1906, :city_name => 'KABUPATEN BELITUNG TIMUR', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 1971, :city_name => 'KOTA PANGKAL PINANG', :province_name => 'KEPULAUAN BANGKA BELITUNG', :country_name => 'Indonesia')
dati.insert(:code => 2101, :city_name => 'KABUPATEN KARIMUN', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2102, :city_name => 'KABUPATEN BINTAN', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2103, :city_name => 'KABUPATEN NATUNA', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2104, :city_name => 'KABUPATEN LINGGA', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2105, :city_name => 'KABUPATEN KEPULAUAN ANAMBAS', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2171, :city_name => 'KOTA B A T A M', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 2172, :city_name => 'KOTA TANJUNG PINANG', :province_name => 'KEPULAUAN RIAU', :country_name => 'Indonesia')
dati.insert(:code => 3101, :city_name => 'KABUPATEN KEPULAUAN SERIBU', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3171, :city_name => 'KOTA JAKARTA SELATAN', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3172, :city_name => 'KOTA JAKARTA TIMUR', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3173, :city_name => 'KOTA JAKARTA PUSAT', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3174, :city_name => 'KOTA JAKARTA BARAT', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3175, :city_name => 'KOTA JAKARTA UTARA', :province_name => 'DKI JAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3201, :city_name => 'KABUPATEN BOGOR', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3202, :city_name => 'KABUPATEN SUKABUMI', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3203, :city_name => 'KABUPATEN CIANJUR', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3204, :city_name => 'KABUPATEN BANDUNG', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3205, :city_name => 'KABUPATEN GARUT', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3206, :city_name => 'KABUPATEN TASIKMALAYA', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3207, :city_name => 'KABUPATEN CIAMIS', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3208, :city_name => 'KABUPATEN KUNINGAN', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3209, :city_name => 'KABUPATEN CIREBON', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3210, :city_name => 'KABUPATEN MAJALENGKA', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3211, :city_name => 'KABUPATEN SUMEDANG', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3212, :city_name => 'KABUPATEN INDRAMAYU', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3213, :city_name => 'KABUPATEN SUBANG', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3214, :city_name => 'KABUPATEN PURWAKARTA', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3215, :city_name => 'KABUPATEN KARAWANG', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3216, :city_name => 'KABUPATEN BEKASI', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3217, :city_name => 'KABUPATEN BANDUNG BARAT', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3218, :city_name => 'KABUPATEN PANGANDARAN', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3271, :city_name => 'KOTA BOGOR', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3272, :city_name => 'KOTA SUKABUMI', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3273, :city_name => 'KOTA BANDUNG', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3274, :city_name => 'KOTA CIREBON', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3275, :city_name => 'KOTA BEKASI', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3276, :city_name => 'KOTA DEPOK', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3277, :city_name => 'KOTA CIMAHI', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3278, :city_name => 'KOTA TASIKMALAYA', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3279, :city_name => 'KOTA BANJAR', :province_name => 'JAWA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 3301, :city_name => 'KABUPATEN CILACAP', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3302, :city_name => 'KABUPATEN BANYUMAS', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3303, :city_name => 'KABUPATEN PURBALINGGA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3304, :city_name => 'KABUPATEN BANJARNEGARA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3305, :city_name => 'KABUPATEN KEBUMEN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3306, :city_name => 'KABUPATEN PURWOREJO', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3307, :city_name => 'KABUPATEN WONOSOBO', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3308, :city_name => 'KABUPATEN MAGELANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3309, :city_name => 'KABUPATEN BOYOLALI', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3310, :city_name => 'KABUPATEN KLATEN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3311, :city_name => 'KABUPATEN SUKOHARJO', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3312, :city_name => 'KABUPATEN WONOGIRI', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3313, :city_name => 'KABUPATEN KARANGANYAR', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3314, :city_name => 'KABUPATEN SRAGEN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3315, :city_name => 'KABUPATEN GROBOGAN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3316, :city_name => 'KABUPATEN BLORA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3317, :city_name => 'KABUPATEN REMBANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3318, :city_name => 'KABUPATEN PATI', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3319, :city_name => 'KABUPATEN KUDUS', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3320, :city_name => 'KABUPATEN JEPARA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3321, :city_name => 'KABUPATEN DEMAK', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3322, :city_name => 'KABUPATEN SEMARANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3323, :city_name => 'KABUPATEN TEMANGGUNG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3324, :city_name => 'KABUPATEN KENDAL', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3325, :city_name => 'KABUPATEN BATANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3326, :city_name => 'KABUPATEN PEKALONGAN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3327, :city_name => 'KABUPATEN PEMALANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3328, :city_name => 'KABUPATEN TEGAL', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3329, :city_name => 'KABUPATEN BREBES', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3371, :city_name => 'KOTA MAGELANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3372, :city_name => 'KOTA SURAKARTA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3373, :city_name => 'KOTA SALATIGA', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3374, :city_name => 'KOTA SEMARANG', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3375, :city_name => 'KOTA PEKALONGAN', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3376, :city_name => 'KOTA TEGAL', :province_name => 'JAWA TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 3401, :city_name => 'KABUPATEN KULON PROGO', :province_name => 'DI YOGYAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3402, :city_name => 'KABUPATEN BANTUL', :province_name => 'DI YOGYAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3403, :city_name => 'KABUPATEN GUNUNG KIDUL', :province_name => 'DI YOGYAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3404, :city_name => 'KABUPATEN SLEMAN', :province_name => 'DI YOGYAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3471, :city_name => 'KOTA YOGYAKARTA', :province_name => 'DI YOGYAKARTA', :country_name => 'Indonesia')
dati.insert(:code => 3501, :city_name => 'KABUPATEN PACITAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3502, :city_name => 'KABUPATEN PONOROGO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3503, :city_name => 'KABUPATEN TRENGGALEK', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3504, :city_name => 'KABUPATEN TULUNGAGUNG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3505, :city_name => 'KABUPATEN BLITAR', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3506, :city_name => 'KABUPATEN KEDIRI', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3507, :city_name => 'KABUPATEN MALANG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3508, :city_name => 'KABUPATEN LUMAJANG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3509, :city_name => 'KABUPATEN JEMBER', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3510, :city_name => 'KABUPATEN BANYUWANGI', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3511, :city_name => 'KABUPATEN BONDOWOSO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3512, :city_name => 'KABUPATEN SITUBONDO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3513, :city_name => 'KABUPATEN PROBOLINGGO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3514, :city_name => 'KABUPATEN PASURUAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3515, :city_name => 'KABUPATEN SIDOARJO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3516, :city_name => 'KABUPATEN MOJOKERTO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3517, :city_name => 'KABUPATEN JOMBANG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3518, :city_name => 'KABUPATEN NGANJUK', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3519, :city_name => 'KABUPATEN MADIUN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3520, :city_name => 'KABUPATEN MAGETAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3521, :city_name => 'KABUPATEN NGAWI', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3522, :city_name => 'KABUPATEN BOJONEGORO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3523, :city_name => 'KABUPATEN TUBAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3524, :city_name => 'KABUPATEN LAMONGAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3525, :city_name => 'KABUPATEN GRESIK', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3526, :city_name => 'KABUPATEN BANGKALAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3527, :city_name => 'KABUPATEN SAMPANG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3528, :city_name => 'KABUPATEN PAMEKASAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3529, :city_name => 'KABUPATEN SUMENEP', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3571, :city_name => 'KOTA KEDIRI', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3572, :city_name => 'KOTA BLITAR', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3573, :city_name => 'KOTA MALANG', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3574, :city_name => 'KOTA PROBOLINGGO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3575, :city_name => 'KOTA PASURUAN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3576, :city_name => 'KOTA MOJOKERTO', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3577, :city_name => 'KOTA MADIUN', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3578, :city_name => 'KOTA SURABAYA', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3579, :city_name => 'KOTA BATU', :province_name => 'JAWA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 3601, :city_name => 'KABUPATEN PANDEGLANG', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3602, :city_name => 'KABUPATEN LEBAK', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3603, :city_name => 'KABUPATEN TANGERANG', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3604, :city_name => 'KABUPATEN SERANG', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3671, :city_name => 'KOTA TANGERANG', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3672, :city_name => 'KOTA CILEGON', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3673, :city_name => 'KOTA SERANG', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 3674, :city_name => 'KOTA TANGERANG SELATAN', :province_name => 'BANTEN', :country_name => 'Indonesia')
dati.insert(:code => 5101, :city_name => 'KABUPATEN JEMBRANA', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5102, :city_name => 'KABUPATEN TABANAN', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5103, :city_name => 'KABUPATEN BADUNG', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5104, :city_name => 'KABUPATEN GIANYAR', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5105, :city_name => 'KABUPATEN KLUNGKUNG', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5106, :city_name => 'KABUPATEN BANGLI', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5107, :city_name => 'KABUPATEN KARANG ASEM', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5108, :city_name => 'KABUPATEN BULELENG', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5171, :city_name => 'KOTA DENPASAR', :province_name => 'BALI', :country_name => 'Indonesia')
dati.insert(:code => 5201, :city_name => 'KABUPATEN LOMBOK BARAT', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5202, :city_name => 'KABUPATEN LOMBOK TENGAH', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5203, :city_name => 'KABUPATEN LOMBOK TIMUR', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5204, :city_name => 'KABUPATEN SUMBAWA', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5205, :city_name => 'KABUPATEN DOMPU', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5206, :city_name => 'KABUPATEN BIMA', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5207, :city_name => 'KABUPATEN SUMBAWA BARAT', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5208, :city_name => 'KABUPATEN LOMBOK UTARA', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5271, :city_name => 'KOTA MATARAM', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5272, :city_name => 'KOTA BIMA', :province_name => 'NUSA TENGGARA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 5301, :city_name => 'KABUPATEN SUMBA BARAT', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5302, :city_name => 'KABUPATEN SUMBA TIMUR', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5303, :city_name => 'KABUPATEN KUPANG', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5304, :city_name => 'KABUPATEN TIMOR TENGAH SELATAN', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5305, :city_name => 'KABUPATEN TIMOR TENGAH UTARA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5306, :city_name => 'KABUPATEN BELU', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5307, :city_name => 'KABUPATEN ALOR', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5308, :city_name => 'KABUPATEN LEMBATA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5309, :city_name => 'KABUPATEN FLORES TIMUR', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5310, :city_name => 'KABUPATEN SIKKA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5311, :city_name => 'KABUPATEN ENDE', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5312, :city_name => 'KABUPATEN NGADA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5313, :city_name => 'KABUPATEN MANGGARAI', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5314, :city_name => 'KABUPATEN ROTE NDAO', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5315, :city_name => 'KABUPATEN MANGGARAI BARAT', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5316, :city_name => 'KABUPATEN SUMBA TENGAH', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5317, :city_name => 'KABUPATEN SUMBA BARAT DAYA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5318, :city_name => 'KABUPATEN NAGEKEO', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5319, :city_name => 'KABUPATEN MANGGARAI TIMUR', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5320, :city_name => 'KABUPATEN SABU RAIJUA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5321, :city_name => 'KABUPATEN MALAKA', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 5371, :city_name => 'KOTA KUPANG', :province_name => 'NUSA TENGGARA TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6101, :city_name => 'KABUPATEN SAMBAS', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6102, :city_name => 'KABUPATEN BENGKAYANG', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6103, :city_name => 'KABUPATEN LANDAK', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6104, :city_name => 'KABUPATEN MEMPAWAH', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6105, :city_name => 'KABUPATEN SANGGAU', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6106, :city_name => 'KABUPATEN KETAPANG', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6107, :city_name => 'KABUPATEN SINTANG', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6108, :city_name => 'KABUPATEN KAPUAS HULU', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6109, :city_name => 'KABUPATEN SEKADAU', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6110, :city_name => 'KABUPATEN MELAWI', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6111, :city_name => 'KABUPATEN KAYONG UTARA', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6112, :city_name => 'KABUPATEN KUBU RAYA', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6171, :city_name => 'KOTA PONTIANAK', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6172, :city_name => 'KOTA SINGKAWANG', :province_name => 'KALIMANTAN BARAT', :country_name => 'Indonesia')
dati.insert(:code => 6201, :city_name => 'KABUPATEN KOTAWARINGIN BARAT', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6202, :city_name => 'KABUPATEN KOTAWARINGIN TIMUR', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6203, :city_name => 'KABUPATEN KAPUAS', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6204, :city_name => 'KABUPATEN BARITO SELATAN', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6205, :city_name => 'KABUPATEN BARITO UTARA', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6206, :city_name => 'KABUPATEN SUKAMARA', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6207, :city_name => 'KABUPATEN LAMANDAU', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6208, :city_name => 'KABUPATEN SERUYAN', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6209, :city_name => 'KABUPATEN KATINGAN', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6210, :city_name => 'KABUPATEN PULANG PISAU', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6211, :city_name => 'KABUPATEN GUNUNG MAS', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6212, :city_name => 'KABUPATEN BARITO TIMUR', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6213, :city_name => 'KABUPATEN MURUNG RAYA', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6271, :city_name => 'KOTA PALANGKA RAYA', :province_name => 'KALIMANTAN TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 6301, :city_name => 'KABUPATEN TANAH LAUT', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6302, :city_name => 'KABUPATEN KOTA BARU', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6303, :city_name => 'KABUPATEN BANJAR', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6304, :city_name => 'KABUPATEN BARITO KUALA', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6305, :city_name => 'KABUPATEN TAPIN', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6306, :city_name => 'KABUPATEN HULU SUNGAI SELATAN', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6307, :city_name => 'KABUPATEN HULU SUNGAI TENGAH', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6308, :city_name => 'KABUPATEN HULU SUNGAI UTARA', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6309, :city_name => 'KABUPATEN TABALONG', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6310, :city_name => 'KABUPATEN TANAH BUMBU', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6311, :city_name => 'KABUPATEN BALANGAN', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6371, :city_name => 'KOTA BANJARMASIN', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6372, :city_name => 'KOTA BANJAR BARU', :province_name => 'KALIMANTAN SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 6401, :city_name => 'KABUPATEN PASER', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6402, :city_name => 'KABUPATEN KUTAI BARAT', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6403, :city_name => 'KABUPATEN KUTAI KARTANEGARA', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6404, :city_name => 'KABUPATEN KUTAI TIMUR', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6405, :city_name => 'KABUPATEN BERAU', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6409, :city_name => 'KABUPATEN PENAJAM PASER UTARA', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6411, :city_name => 'KABUPATEN MAHAKAM HULU', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6471, :city_name => 'KOTA BALIKPAPAN', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6472, :city_name => 'KOTA SAMARINDA', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6474, :city_name => 'KOTA BONTANG', :province_name => 'KALIMANTAN TIMUR', :country_name => 'Indonesia')
dati.insert(:code => 6501, :city_name => 'KABUPATEN MALINAU', :province_name => 'KALIMANTAN UTARA', :country_name => 'Indonesia')
dati.insert(:code => 6502, :city_name => 'KABUPATEN BULUNGAN', :province_name => 'KALIMANTAN UTARA', :country_name => 'Indonesia')
dati.insert(:code => 6503, :city_name => 'KABUPATEN TANA TIDUNG', :province_name => 'KALIMANTAN UTARA', :country_name => 'Indonesia')
dati.insert(:code => 6504, :city_name => 'KABUPATEN NUNUKAN', :province_name => 'KALIMANTAN UTARA', :country_name => 'Indonesia')
dati.insert(:code => 6571, :city_name => 'KOTA TARAKAN', :province_name => 'KALIMANTAN UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7101, :city_name => 'KABUPATEN BOLAANG MONGONDOW', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7102, :city_name => 'KABUPATEN MINAHASA', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7103, :city_name => 'KABUPATEN KEPULAUAN SANGIHE', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7104, :city_name => 'KABUPATEN KEPULAUAN TALAUD', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7105, :city_name => 'KABUPATEN MINAHASA SELATAN', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7106, :city_name => 'KABUPATEN MINAHASA UTARA', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7107, :city_name => 'KABUPATEN BOLAANG MONGONDOW UTARA', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7108, :city_name => 'KABUPATEN SIAU TAGULANDANG BIARO', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7109, :city_name => 'KABUPATEN MINAHASA TENGGARA', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7110, :city_name => 'KABUPATEN BOLAANG MONGONDOW SELATAN', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7111, :city_name => 'KABUPATEN BOLAANG MONGONDOW TIMUR', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7171, :city_name => 'KOTA MANADO', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7172, :city_name => 'KOTA BITUNG', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7173, :city_name => 'KOTA TOMOHON', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7174, :city_name => 'KOTA KOTAMOBAGU', :province_name => 'SULAWESI UTARA', :country_name => 'Indonesia')
dati.insert(:code => 7201, :city_name => 'KABUPATEN BANGGAI KEPULAUAN', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7202, :city_name => 'KABUPATEN BANGGAI', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7203, :city_name => 'KABUPATEN MOROWALI', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7204, :city_name => 'KABUPATEN POSO', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7205, :city_name => 'KABUPATEN DONGGALA', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7206, :city_name => 'KABUPATEN TOLI-TOLI', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7207, :city_name => 'KABUPATEN BUOL', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7208, :city_name => 'KABUPATEN PARIGI MOUTONG', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7209, :city_name => 'KABUPATEN TOJO UNA-UNA', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7210, :city_name => 'KABUPATEN SIGI', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7211, :city_name => 'KABUPATEN BANGGAI LAUT', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7212, :city_name => 'KABUPATEN MOROWALI UTARA', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7271, :city_name => 'KOTA PALU', :province_name => 'SULAWESI TENGAH', :country_name => 'Indonesia')
dati.insert(:code => 7301, :city_name => 'KABUPATEN KEPULAUAN SELAYAR', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7302, :city_name => 'KABUPATEN BULUKUMBA', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7303, :city_name => 'KABUPATEN BANTAENG', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7304, :city_name => 'KABUPATEN JENEPONTO', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7305, :city_name => 'KABUPATEN TAKALAR', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7306, :city_name => 'KABUPATEN GOWA', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7307, :city_name => 'KABUPATEN SINJAI', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7308, :city_name => 'KABUPATEN MAROS', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7309, :city_name => 'KABUPATEN PANGKAJENE DAN KEPULAUAN', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7310, :city_name => 'KABUPATEN BARRU', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7311, :city_name => 'KABUPATEN BONE', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7312, :city_name => 'KABUPATEN SOPPENG', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7313, :city_name => 'KABUPATEN WAJO', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7314, :city_name => 'KABUPATEN SIDENRENG RAPPANG', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7315, :city_name => 'KABUPATEN PINRANG', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7316, :city_name => 'KABUPATEN ENREKANG', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7317, :city_name => 'KABUPATEN LUWU', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7318, :city_name => 'KABUPATEN TANA TORAJA', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7322, :city_name => 'KABUPATEN LUWU UTARA', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7325, :city_name => 'KABUPATEN LUWU TIMUR', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7326, :city_name => 'KABUPATEN TORAJA UTARA', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7371, :city_name => 'KOTA MAKASSAR', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7372, :city_name => 'KOTA PAREPARE', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7373, :city_name => 'KOTA PALOPO', :province_name => 'SULAWESI SELATAN', :country_name => 'Indonesia')
dati.insert(:code => 7401, :city_name => 'KABUPATEN BUTON', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7402, :city_name => 'KABUPATEN MUNA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7403, :city_name => 'KABUPATEN KONAWE', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7404, :city_name => 'KABUPATEN KOLAKA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7405, :city_name => 'KABUPATEN KONAWE SELATAN', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7406, :city_name => 'KABUPATEN BOMBANA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7407, :city_name => 'KABUPATEN WAKATOBI', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7408, :city_name => 'KABUPATEN KOLAKA UTARA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7409, :city_name => 'KABUPATEN BUTON UTARA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7410, :city_name => 'KABUPATEN KONAWE UTARA', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7411, :city_name => 'KABUPATEN KOLAKA TIMUR', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7412, :city_name => 'KABUPATEN KONAWE KEPULAUAN', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7413, :city_name => 'KABUPATEN MUNA BARAT', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7414, :city_name => 'KABUPATEN BUTON TENGAH', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7415, :city_name => 'KABUPATEN BUTON SELATAN', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7471, :city_name => 'KOTA KENDARI', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7472, :city_name => 'KOTA BAUBAU', :province_name => 'SULAWESI TENGGARA', :country_name => 'Indonesia')
dati.insert(:code => 7501, :city_name => 'KABUPATEN BOALEMO', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7502, :city_name => 'KABUPATEN GORONTALO', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7503, :city_name => 'KABUPATEN POHUWATO', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7504, :city_name => 'KABUPATEN BONE BOLANGO', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7505, :city_name => 'KABUPATEN GORONTALO UTARA', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7571, :city_name => 'KOTA GORONTALO', :province_name => 'GORONTALO', :country_name => 'Indonesia')
dati.insert(:code => 7601, :city_name => 'KABUPATEN MAJENE', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 7602, :city_name => 'KABUPATEN POLEWALI MANDAR', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 7603, :city_name => 'KABUPATEN MAMASA', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 7604, :city_name => 'KABUPATEN MAMUJU', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 7605, :city_name => 'KABUPATEN MAMUJU UTARA', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 7606, :city_name => 'KABUPATEN MAMUJU TENGAH', :province_name => 'SULAWESI BARAT', :country_name => 'Indonesia')
dati.insert(:code => 8101, :city_name => 'KABUPATEN MALUKU TENGGARA BARAT', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8102, :city_name => 'KABUPATEN MALUKU TENGGARA', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8103, :city_name => 'KABUPATEN MALUKU TENGAH', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8104, :city_name => 'KABUPATEN BURU', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8105, :city_name => 'KABUPATEN KEPULAUAN ARU', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8106, :city_name => 'KABUPATEN SERAM BAGIAN BARAT', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8107, :city_name => 'KABUPATEN SERAM BAGIAN TIMUR', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8108, :city_name => 'KABUPATEN MALUKU BARAT DAYA', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8109, :city_name => 'KABUPATEN BURU SELATAN', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8171, :city_name => 'KOTA AMBON', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8172, :city_name => 'KOTA TUAL', :province_name => 'MALUKU', :country_name => 'Indonesia')
dati.insert(:code => 8201, :city_name => 'KABUPATEN HALMAHERA BARAT', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8202, :city_name => 'KABUPATEN HALMAHERA TENGAH', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8203, :city_name => 'KABUPATEN KEPULAUAN SULA', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8204, :city_name => 'KABUPATEN HALMAHERA SELATAN', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8205, :city_name => 'KABUPATEN HALMAHERA UTARA', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8206, :city_name => 'KABUPATEN HALMAHERA TIMUR', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8207, :city_name => 'KABUPATEN PULAU MOROTAI', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8208, :city_name => 'KABUPATEN PULAU TALIABU', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8271, :city_name => 'KOTA TERNATE', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 8272, :city_name => 'KOTA TIDORE KEPULAUAN', :province_name => 'MALUKU UTARA', :country_name => 'Indonesia')
dati.insert(:code => 9101, :city_name => 'KABUPATEN FAKFAK', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9102, :city_name => 'KABUPATEN KAIMANA', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9103, :city_name => 'KABUPATEN TELUK WONDAMA', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9104, :city_name => 'KABUPATEN TELUK BINTUNI', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9105, :city_name => 'KABUPATEN MANOKWARI', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9106, :city_name => 'KABUPATEN SORONG SELATAN', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9107, :city_name => 'KABUPATEN SORONG', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9108, :city_name => 'KABUPATEN RAJA AMPAT', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9109, :city_name => 'KABUPATEN TAMBRAUW', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9110, :city_name => 'KABUPATEN MAYBRAT', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9111, :city_name => 'KABUPATEN MANOKWARI SELATAN', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9112, :city_name => 'KABUPATEN PEGUNUNGAN ARFAK', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9171, :city_name => 'KOTA SORONG', :province_name => 'PAPUA BARAT', :country_name => 'Indonesia')
dati.insert(:code => 9401, :city_name => 'KABUPATEN MERAUKE', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9402, :city_name => 'KABUPATEN JAYAWIJAYA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9403, :city_name => 'KABUPATEN JAYAPURA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9404, :city_name => 'KABUPATEN NABIRE', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9408, :city_name => 'KABUPATEN KEPULAUAN YAPEN', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9409, :city_name => 'KABUPATEN BIAK NUMFOR', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9410, :city_name => 'KABUPATEN PANIAI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9411, :city_name => 'KABUPATEN PUNCAK JAYA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9412, :city_name => 'KABUPATEN MIMIKA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9413, :city_name => 'KABUPATEN BOVEN DIGOEL', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9414, :city_name => 'KABUPATEN MAPPI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9415, :city_name => 'KABUPATEN ASMAT', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9416, :city_name => 'KABUPATEN YAHUKIMO', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9417, :city_name => 'KABUPATEN PEGUNUNGAN BINTANG', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9418, :city_name => 'KABUPATEN TOLIKARA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9419, :city_name => 'KABUPATEN SARMI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9420, :city_name => 'KABUPATEN KEEROM', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9426, :city_name => 'KABUPATEN WAROPEN', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9427, :city_name => 'KABUPATEN SUPIORI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9428, :city_name => 'KABUPATEN MAMBERAMO RAYA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9429, :city_name => 'KABUPATEN NDUGA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9430, :city_name => 'KABUPATEN LANNY JAYA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9431, :city_name => 'KABUPATEN MAMBERAMO TENGAH', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9432, :city_name => 'KABUPATEN YALIMO', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9433, :city_name => 'KABUPATEN PUNCAK', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9434, :city_name => 'KABUPATEN DOGIYAI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9435, :city_name => 'KABUPATEN INTAN JAYA', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9436, :city_name => 'KABUPATEN DEIYAI', :province_name => 'PAPUA', :country_name => 'Indonesia')
dati.insert(:code => 9471, :city_name => 'KOTA JAYAPURA', :province_name => 'PAPUA', :country_name => 'Indonesia')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :items do
it "should return 514 items" do
expect(results.count).to eq 514
end
it "should order confirmed_cases from largest to smallest" do
prices = results.map {|row| row[:confirmed_cases]}
expect(prices).to eq(prices.sort.reverse)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel employees
Column Name | Data Type | Description |
---|---|---|
employee_id | serial |
primary key |
name | string |
Nama Pegawai |
months | integer |
Total Bulan Bekerja |
salary | integer |
Gaji Bulanan |
Buatlah query sql untuk mendapatkan 10 pegawai dengan gaji terbesar.
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :employees do
primary_key :employee_id
String :name
Integer :months
Integer :salary
end
items = DB[:employees] # Create a dataset
# Populate the table
items.insert(:name => 'Ringo Concklin', :months => 30, :salary => 4676243)
items.insert(:name => 'Erie Couche', :months => 12, :salary => 3301125)
items.insert(:name => 'Tripp Summerlie', :months => 1, :salary => 2175831)
items.insert(:name => 'Zulema Plume', :months => 17, :salary => 3115847)
items.insert(:name => 'Vittorio Espine', :months => 12, :salary => 3500024)
items.insert(:name => 'Roz Bumphries', :months => 27, :salary => 9024845)
items.insert(:name => 'Marita De Witt', :months => 11, :salary => 4872515)
items.insert(:name => 'Peggi Gerrets', :months => 24, :salary => 4452181)
items.insert(:name => 'Baily Gulvin', :months => 17, :salary => 3493698)
items.insert(:name => 'Brnaba Dondon', :months => 9, :salary => 4682543)
items.insert(:name => 'Danell Crothers', :months => 14, :salary => 5841335)
items.insert(:name => 'Udell Worster', :months => 25, :salary => 7034337)
items.insert(:name => 'Othilia Flann', :months => 13, :salary => 6788857)
items.insert(:name => 'Jordain Canas', :months => 6, :salary => 6318979)
items.insert(:name => 'Humberto Dict', :months => 9, :salary => 4120323)
items.insert(:name => 'Mandel Blackhall', :months => 7, :salary => 8679583)
items.insert(:name => 'Clementia Sibary', :months => 13, :salary => 1193852)
items.insert(:name => 'Jodee Lexa', :months => 4, :salary => 9972163)
items.insert(:name => 'Ruthy Martina', :months => 1, :salary => 5670042)
items.insert(:name => 'Brook Aveyard', :months => 3, :salary => 6084339)
items.insert(:name => 'Robbi Thorndale', :months => 19, :salary => 6166366)
items.insert(:name => 'Lissy Stapford', :months => 12, :salary => 4390652)
items.insert(:name => 'Jen Kennally', :months => 24, :salary => 2251845)
items.insert(:name => 'Vivi Enrietto', :months => 25, :salary => 5516117)
items.insert(:name => 'Tammie McWhorter', :months => 22, :salary => 3765131)
items.insert(:name => 'Brianna Coxwell', :months => 30, :salary => 1212817)
items.insert(:name => 'Ulick Diable', :months => 20, :salary => 1315339)
items.insert(:name => 'Marshall Cuer', :months => 29, :salary => 8585830)
items.insert(:name => 'Rafaelita Ringrose', :months => 6, :salary => 6094500)
items.insert(:name => 'Geri Cullingworth', :months => 17, :salary => 8163237)
items.insert(:name => 'Arvy Christiensen', :months => 19, :salary => 6986362)
items.insert(:name => 'Zulema Eagling', :months => 18, :salary => 2432231)
items.insert(:name => 'Rosalyn Ackeroyd', :months => 28, :salary => 2146530)
items.insert(:name => 'Elfie Whether', :months => 18, :salary => 8794798)
items.insert(:name => 'Benson Burchatt', :months => 1, :salary => 2145717)
items.insert(:name => 'Rodney Alpe', :months => 18, :salary => 5556641)
items.insert(:name => 'Hedy Caso', :months => 22, :salary => 5532341)
items.insert(:name => 'Cammi Scothorn', :months => 18, :salary => 1847839)
items.insert(:name => 'Andros Pryde', :months => 6, :salary => 9309686)
items.insert(:name => 'Elyse Emlen', :months => 24, :salary => 2191111)
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 10 items" do
expect(results.count).to eq 10
end
it "should order salary from largest to smallest" do
prices = results.map {|row| row[:salary]}
expect(prices).to eq(prices.sort.reverse)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel employees
Column Name | Data Type | Description |
---|---|---|
employee_id | serial |
primary key |
name | string |
Nama Pegawai |
months | integer |
Total Bulan Bekerja |
salary | integer |
Gaji Bulanan |
Buatlah query sql untuk mendapatkan daftar pegawai yang memiliki gaji di atas 5.000.000 dan sudah bekerja selama 12 bulan atau lebih. Urutkan berdasarkan gaji dari yang terbesar ke terkecil.
Contoh
input
employee_id | name | months | salary |
---|---|---|---|
1 | rishad | 10 | 7000000 |
2 | haris | 14 | 3000000 |
3 | tomi | 13 | 6250000 |
4 | somi | 12 | 7250000 |
output
employee_id | name | months | salary |
---|---|---|---|
4 | somi | 12 | 7250000 |
3 | tomi | 13 | 6250000 |
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :employees do
primary_key :employee_id
String :name
Integer :months
Integer :salary
end
items = DB[:employees] # Create a dataset
# Populate the table
items.insert(:name => 'Ringo Concklin', :months => 30, :salary => 4676243)
items.insert(:name => 'Erie Couche', :months => 12, :salary => 3301125)
items.insert(:name => 'Tripp Summerlie', :months => 1, :salary => 2175831)
items.insert(:name => 'Zulema Plume', :months => 17, :salary => 3115847)
items.insert(:name => 'Vittorio Espine', :months => 12, :salary => 3500024)
items.insert(:name => 'Roz Bumphries', :months => 27, :salary => 9024845)
items.insert(:name => 'Marita De Witt', :months => 11, :salary => 4872515)
items.insert(:name => 'Peggi Gerrets', :months => 24, :salary => 4452181)
items.insert(:name => 'Baily Gulvin', :months => 17, :salary => 3493698)
items.insert(:name => 'Brnaba Dondon', :months => 9, :salary => 4682543)
items.insert(:name => 'Danell Crothers', :months => 14, :salary => 5841335)
items.insert(:name => 'Udell Worster', :months => 25, :salary => 7034337)
items.insert(:name => 'Othilia Flann', :months => 13, :salary => 6788857)
items.insert(:name => 'Jordain Canas', :months => 6, :salary => 6318979)
items.insert(:name => 'Humberto Dict', :months => 9, :salary => 4120323)
items.insert(:name => 'Mandel Blackhall', :months => 7, :salary => 8679583)
items.insert(:name => 'Clementia Sibary', :months => 13, :salary => 1193852)
items.insert(:name => 'Jodee Lexa', :months => 4, :salary => 9972163)
items.insert(:name => 'Ruthy Martina', :months => 1, :salary => 5670042)
items.insert(:name => 'Brook Aveyard', :months => 3, :salary => 6084339)
items.insert(:name => 'Robbi Thorndale', :months => 19, :salary => 6166366)
items.insert(:name => 'Lissy Stapford', :months => 12, :salary => 4390652)
items.insert(:name => 'Jen Kennally', :months => 24, :salary => 2251845)
items.insert(:name => 'Vivi Enrietto', :months => 25, :salary => 5516117)
items.insert(:name => 'Tammie McWhorter', :months => 22, :salary => 3765131)
items.insert(:name => 'Brianna Coxwell', :months => 30, :salary => 1212817)
items.insert(:name => 'Ulick Diable', :months => 20, :salary => 1315339)
items.insert(:name => 'Marshall Cuer', :months => 29, :salary => 8585830)
items.insert(:name => 'Rafaelita Ringrose', :months => 6, :salary => 6094500)
items.insert(:name => 'Geri Cullingworth', :months => 17, :salary => 8163237)
items.insert(:name => 'Arvy Christiensen', :months => 19, :salary => 6986362)
items.insert(:name => 'Zulema Eagling', :months => 18, :salary => 2432231)
items.insert(:name => 'Rosalyn Ackeroyd', :months => 28, :salary => 2146530)
items.insert(:name => 'Elfie Whether', :months => 18, :salary => 8794798)
items.insert(:name => 'Benson Burchatt', :months => 1, :salary => 2145717)
items.insert(:name => 'Rodney Alpe', :months => 18, :salary => 5556641)
items.insert(:name => 'Hedy Caso', :months => 22, :salary => 5532341)
items.insert(:name => 'Cammi Scothorn', :months => 18, :salary => 1847839)
items.insert(:name => 'Andros Pryde', :months => 6, :salary => 9309686)
items.insert(:name => 'Elyse Emlen', :months => 24, :salary => 2191111)
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 12 items" do
expect(results.count).to eq 12
end
it "should have all total_price values greater than or equal to 5000000" do
expect(results.all? { |row| row[:salary] >= 5000000 }).to be true
end
it "total number of months they've been working for the company should be more or equal than 12 month" do
expect(results.all? { |row| row[:months] >= 12 }).to be true
end
it "should order salary from largest to smallest" do
prices = results.map {|row| row[:salary]}
expect(prices).to eq(prices.sort.reverse)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi yang customer nya bukan null, urutkan dari nama store terlebih dahulu dari A ke Z, baru urutkan berdasarkan total_price dari terbesar ke terkecil
Contoh
input
transaction_id | date | store | total_price | customer |
---|---|---|---|---|
1 | 2022-01-01 | BIE Store Bandung | 30000 | Bobi |
2 | 2022-01-01 | BIE Store Bandung | 40000 | Abe |
3 | 2022-01-01 | BIE Store Bandung | 50000 | Sude |
4 | 2022-01-01 | BIE Store Ambon | 20000 | Bilal |
output
transaction_id | date | store | total_price | customer |
---|---|---|---|---|
4 | 2022-01-01 | BIE Store Ambon | 20000 | Bilal |
3 | 2022-01-01 | BIE Store Bandung | 50000 | Sude |
2 | 2022-01-01 | BIE Store Bandung | 40000 | Abe |
1 | 2022-01-01 | BIE Store Bandung | 30000 | Bobi |
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 90 items" do
expect(results.count).to eq 90
end
it "should order total_price from largest to smallest" do
prices = results.map {|row| row[:store]}
expect(prices).to eq(prices.sort)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi, urutkan dari total_price paling besar ke paling kecil
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 99 items" do
expect(results.count).to eq 99
end
it "should order total_price from largest to smallest" do
prices = results.map {|row| row[:total_price]}
expect(prices).to eq(prices.sort.reverse)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi, urutkan dari total_price paling kecil ke paling besar
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 99 items" do
expect(results.count).to eq 99
end
it "should order total_price from smallest to largest" do
prices = results.map {|row| row[:total_price]}
expect(prices).to eq(prices.sort)
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi yang huruf awal customer nya D atau E
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "First letter of customer should be either D or E" do
results.each do |row|
expect(row[:customer][0] == 'D' || row[:customer][0] == 'E').to be true
end
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi yang customer nya null
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 90 items" do
expect(results.count).to eq 90
end
it "All customer cannot be null" do
results.each do |row|
expect(row[:customer]).to_not eq nil
end
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list
Perusahaan bernama BIE memiliki tabel transactions yang memilik skema seperti dibawah ini
Column Name | Data Type |
---|---|
transaction_id | serial |
date | date |
store | string |
total_price | float |
customer | string |
Buatlah query sql untuk mendapatkan semua data transaksi yang customer nya null
-- Code Here
# TODO: replace with your own tests (TDD), these are just how-to examples to get you started.
# Ruby/Rspec/Sequel Example:
# While the code section is pure SQL, for testing we use Ruby & Rspec.
# Sequel (https://github.com/jeremyevans/sequel) is used to setup the database and run queries.
# The connection is already made for you, use DB to access.
DB.create_table :transactions do
primary_key :transaction_id
Date :date
String :store
Float :total_price
String :customer
end
items = DB[:transactions] # Create a dataset
# Populate the table
items.insert(:date => '2023-01-27', :store => 'BIE Store Palembang', :total_price => 964172, :customer => 'Ruthi Pepall')
items.insert(:date => '2023-01-06', :store => 'BIE Store Jakarta', :total_price => 419689, :customer => 'Horatius McPhate')
items.insert(:date => '2022-10-16', :store => 'BIE Store Bandung', :total_price => 664220, :customer => 'Romonda Gosker')
items.insert(:date => '2023-02-22', :store => 'BIE Store Malang', :total_price => 147934, :customer => 'Hinda Maldin')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 367084, :customer => 'Cybill Upstone')
items.insert(:date => '2022-09-01', :store => 'BIE Store Jakarta', :total_price => 522890, :customer => nil)
items.insert(:date => '2023-01-12', :store => 'BIE Store Palembang', :total_price => 290499, :customer => 'Leda Soeiro')
items.insert(:date => '2022-06-30', :store => 'BIE Store Malang', :total_price => 677804, :customer => nil)
items.insert(:date => '2022-11-06', :store => 'BIE Store Malang', :total_price => 458234, :customer => 'Zaria Sinnett')
items.insert(:date => '2023-02-11', :store => 'BIE Store Jakarta', :total_price => 181251, :customer => 'Worthy Morkham')
items.insert(:date => '2022-06-02', :store => 'BIE Store Balikpapan', :total_price => 631237, :customer => 'Sonnnie Fantin')
items.insert(:date => '2023-01-08', :store => 'BIE Store Bandung', :total_price => 716369, :customer => 'Georgianna Schuricke')
items.insert(:date => '2023-02-27', :store => 'BIE Store Bandung', :total_price => 252423, :customer => 'Rutherford Nursey')
items.insert(:date => '2022-11-29', :store => 'BIE Store Balikpapan', :total_price => 916700, :customer => 'Daffie Traut')
items.insert(:date => '2022-10-28', :store => 'BIE Store Bandung', :total_price => 921096, :customer => 'Charmine Cabera')
items.insert(:date => '2022-11-17', :store => 'BIE Store Malang', :total_price => 805858, :customer => 'Tuck Carabet')
items.insert(:date => '2022-07-18', :store => 'BIE Store Jakarta', :total_price => 778746, :customer => 'Ted Anney')
items.insert(:date => '2022-08-17', :store => 'BIE Store Jakarta', :total_price => 810906, :customer => 'Stephie Eglin')
items.insert(:date => '2022-10-06', :store => 'BIE Store Palembang', :total_price => 631197, :customer => 'Guglielmo Yellowley')
items.insert(:date => '2023-03-12', :store => 'BIE Store Malang', :total_price => 153729, :customer => 'Woodie Glowacha')
items.insert(:date => '2022-09-23', :store => 'BIE Store Malang', :total_price => 448198, :customer => 'Tressa Dellenbach')
items.insert(:date => '2022-07-02', :store => 'BIE Store Jakarta', :total_price => 626042, :customer => 'Otha McKerton')
items.insert(:date => '2022-10-09', :store => 'BIE Store Jakarta', :total_price => 787232, :customer => nil)
items.insert(:date => '2022-06-18', :store => 'BIE Store Bandung', :total_price => 260135, :customer => 'Daffie Begwell')
items.insert(:date => '2022-10-12', :store => 'BIE Store Bandung', :total_price => 270581, :customer => 'Linn Rentoll')
items.insert(:date => '2022-07-06', :store => 'BIE Store Balikpapan', :total_price => 223795, :customer => 'Chloris Andries')
items.insert(:date => '2022-08-22', :store => 'BIE Store Balikpapan', :total_price => 852629, :customer => 'Isahella Tippler')
items.insert(:date => '2023-02-06', :store => 'BIE Store Balikpapan', :total_price => 439087, :customer => 'Zandra Terrell')
items.insert(:date => '2022-05-25', :store => 'BIE Store Malang', :total_price => 859131, :customer => 'Robert Skokoe')
items.insert(:date => '2023-03-08', :store => 'BIE Store Balikpapan', :total_price => 294759, :customer => 'Melina Oak')
items.insert(:date => '2022-07-15', :store => 'BIE Store Bandung', :total_price => 998789, :customer => 'Milty Guiel')
items.insert(:date => '2022-07-01', :store => 'BIE Store Balikpapan', :total_price => 740784, :customer => 'Wallas Waghorne')
items.insert(:date => '2023-01-28', :store => 'BIE Store Bandung', :total_price => 981498, :customer => 'Shalne Stoffersen')
items.insert(:date => '2022-04-14', :store => 'BIE Store Palembang', :total_price => 377813, :customer => 'Kiley Tappor')
items.insert(:date => '2022-11-19', :store => 'BIE Store Malang', :total_price => 759035, :customer => 'Benton Mockett')
items.insert(:date => '2022-03-23', :store => 'BIE Store Jakarta', :total_price => 103406, :customer => 'Caspar Jenicek')
items.insert(:date => '2022-11-07', :store => 'BIE Store Palembang', :total_price => 614260, :customer => 'Tamara Lewens')
items.insert(:date => '2022-11-11', :store => 'BIE Store Jakarta', :total_price => 298828, :customer => 'Perry Sampey')
items.insert(:date => '2022-11-02', :store => 'BIE Store Malang', :total_price => 541542, :customer => 'Nickolas Garrat')
items.insert(:date => '2022-05-27', :store => 'BIE Store Balikpapan', :total_price => 281571, :customer => 'Anthea Traut')
items.insert(:date => '2022-03-29', :store => 'BIE Store Malang', :total_price => 849457, :customer => 'Rosaleen Elland')
items.insert(:date => '2022-12-14', :store => 'BIE Store Malang', :total_price => 540715, :customer => 'Lorianna Vibert')
items.insert(:date => '2023-01-06', :store => 'BIE Store Balikpapan', :total_price => 60332, :customer => 'Morgana Vasilchikov')
items.insert(:date => '2022-11-13', :store => 'BIE Store Palembang', :total_price => 526603, :customer => 'Reinaldos Agett')
items.insert(:date => '2023-02-02', :store => 'BIE Store Jakarta', :total_price => 13141, :customer => nil)
items.insert(:date => '2022-05-10', :store => 'BIE Store Malang', :total_price => 973437, :customer => 'Slade Herries')
items.insert(:date => '2022-07-18', :store => 'BIE Store Bandung', :total_price => 65234, :customer => 'Stephanus Brouncker')
items.insert(:date => '2022-04-07', :store => 'BIE Store Jakarta', :total_price => 160778, :customer => 'Allissa McGraw')
items.insert(:date => '2023-01-04', :store => 'BIE Store Palembang', :total_price => 766479, :customer => 'Laughton Tooby')
items.insert(:date => '2023-01-24', :store => 'BIE Store Balikpapan', :total_price => 990204, :customer => 'Alexei Glennon')
items.insert(:date => '2022-09-30', :store => 'BIE Store Malang', :total_price => 604567, :customer => 'Carol Whitman')
items.insert(:date => '2022-11-10', :store => 'BIE Store Malang', :total_price => 227458, :customer => nil)
items.insert(:date => '2023-01-13', :store => 'BIE Store Malang', :total_price => 307873, :customer => 'Giordano Wikey')
items.insert(:date => '2023-03-14', :store => 'BIE Store Palembang', :total_price => 161949, :customer => 'Horten Harrell')
items.insert(:date => '2023-01-22', :store => 'BIE Store Jakarta', :total_price => 133532, :customer => 'Harbert O Mullen')
items.insert(:date => '2022-12-13', :store => 'BIE Store Jakarta', :total_price => 665895, :customer => 'Isak Grassot')
items.insert(:date => '2022-09-21', :store => 'BIE Store Jakarta', :total_price => 297254, :customer => 'Lorry Vuitton')
items.insert(:date => '2022-05-14', :store => 'BIE Store Palembang', :total_price => 965124, :customer => 'Cathee Pietzner')
items.insert(:date => '2022-10-15', :store => 'BIE Store Balikpapan', :total_price => 136679, :customer => 'Rutger Balderston')
items.insert(:date => '2022-05-29', :store => 'BIE Store Balikpapan', :total_price => 778746, :customer => 'Lillian Battill')
items.insert(:date => '2022-07-04', :store => 'BIE Store Bandung', :total_price => 469717, :customer => nil)
items.insert(:date => '2023-03-15', :store => 'BIE Store Bandung', :total_price => 175495, :customer => 'Ruby Hawkslee')
items.insert(:date => '2022-07-25', :store => 'BIE Store Balikpapan', :total_price => 479481, :customer => 'Selma Forbear')
items.insert(:date => '2022-11-14', :store => 'BIE Store Malang', :total_price => 490897, :customer => nil)
items.insert(:date => '2022-08-27', :store => 'BIE Store Malang', :total_price => 404408, :customer => 'Chiquita Yurenev')
items.insert(:date => '2022-06-02', :store => 'BIE Store Palembang', :total_price => 811480, :customer => 'Fayth Learie')
items.insert(:date => '2023-01-04', :store => 'BIE Store Bandung', :total_price => 171245, :customer => 'Ashby Houseley')
items.insert(:date => '2023-01-04', :store => 'BIE Store Balikpapan', :total_price => 761026, :customer => 'Marie Goodee')
items.insert(:date => '2022-12-27', :store => 'BIE Store Bandung', :total_price => 813168, :customer => 'Barrett Tolchar')
items.insert(:date => '2022-04-09', :store => 'BIE Store Palembang', :total_price => 262573, :customer => 'Tami Smidmoor')
items.insert(:date => '2022-05-27', :store => 'BIE Store Jakarta', :total_price => 413160, :customer => 'Darn Alennikov')
items.insert(:date => '2022-10-01', :store => 'BIE Store Jakarta', :total_price => 262314, :customer => 'Remington Stammer')
items.insert(:date => '2022-12-20', :store => 'BIE Store Bandung', :total_price => 998974, :customer => 'Marcos Haberjam')
items.insert(:date => '2022-05-26', :store => 'BIE Store Bandung', :total_price => 206664, :customer => 'Daryl McIndoe')
items.insert(:date => '2022-03-26', :store => 'BIE Store Palembang', :total_price => 513994, :customer => 'Doll Shropshire')
items.insert(:date => '2022-03-25', :store => 'BIE Store Balikpapan', :total_price => 507814, :customer => nil)
items.insert(:date => '2022-10-13', :store => 'BIE Store Bandung', :total_price => 100271, :customer => 'Brocky Pudan')
items.insert(:date => '2022-12-16', :store => 'BIE Store Malang', :total_price => 941274, :customer => 'Selina Brunton')
items.insert(:date => '2023-03-11', :store => 'BIE Store Palembang', :total_price => 681016, :customer => 'Dorree Aberdein')
items.insert(:date => '2022-12-11', :store => 'BIE Store Jakarta', :total_price => 121186, :customer => 'Regen Brierley')
items.insert(:date => '2022-11-06', :store => 'BIE Store Bandung', :total_price => 492466, :customer => 'Elianora Binton')
items.insert(:date => '2022-11-26', :store => 'BIE Store Palembang', :total_price => 625147, :customer => 'Wang Mibourne')
items.insert(:date => '2022-05-13', :store => 'BIE Store Palembang', :total_price => 603396, :customer => 'Killian Akehurst')
items.insert(:date => '2022-03-28', :store => 'BIE Store Jakarta', :total_price => 514384, :customer => 'Leta Sinnocke')
items.insert(:date => '2022-12-19', :store => 'BIE Store Palembang', :total_price => 925273, :customer => 'Jordain Labin')
items.insert(:date => '2022-07-22', :store => 'BIE Store Malang', :total_price => 920519, :customer => 'Vania Wyman')
items.insert(:date => '2023-03-01', :store => 'BIE Store Balikpapan', :total_price => 418826, :customer => 'Raye Ellerington')
items.insert(:date => '2022-09-25', :store => 'BIE Store Jakarta', :total_price => 568757, :customer => 'L;urette Casazza')
items.insert(:date => '2022-04-19', :store => 'BIE Store Malang', :total_price => 325586, :customer => 'Hermie Diggin')
items.insert(:date => '2022-04-09', :store => 'BIE Store Jakarta', :total_price => 893002, :customer => 'Cornall Eggar')
items.insert(:date => '2022-09-28', :store => 'BIE Store Balikpapan', :total_price => 681807, :customer => 'Stewart McPhail')
items.insert(:date => '2022-08-16', :store => 'BIE Store Jakarta', :total_price => 103808, :customer => 'Ilsa Allday')
items.insert(:date => '2022-05-06', :store => 'BIE Store Balikpapan', :total_price => 850712, :customer => 'Bobbi Oliphant')
items.insert(:date => '2022-10-20', :store => 'BIE Store Malang', :total_price => 733188, :customer => 'Alicia Balchen')
items.insert(:date => '2022-06-13', :store => 'BIE Store Palembang', :total_price => 326823, :customer => nil)
items.insert(:date => '2022-10-26', :store => 'BIE Store Malang', :total_price => 187993, :customer => 'Fan Youens')
items.insert(:date => '2023-03-09', :store => 'BIE Store Jakarta', :total_price => 600253, :customer => 'Pattin McGrowther')
items.insert(:date => '2022-10-03', :store => 'BIE Store Palembang', :total_price => 57693, :customer => 'Gaby Gumb')
items.insert(:date => '2022-07-23', :store => 'BIE Store Jakarta', :total_price => 828902, :customer => 'Bibbie Oger')
# calling run_sql will print the results and return them so that you can test data within them.
# if you want to test different sets of data, then its best to move this code into its own top level describe
# block. If you are only testing one set though, its better to set the results before you enter a describe block
# so that the results are presented at the top of the output.
results = run_sql
describe :test do
it "Should return 9 items" do
expect(results.count).to eq 9
end
it "All customer should be null" do
results.each do |row|
expect(row[:customer]).to eq nil
end
end
end
# Other tips about using run_sql:
# The SQL/code section supports multiple statements, seperated of course by a ";".
# When multiple SELECT statements are issued:
# run_sql will return an array of arrays, unless only one SELECT statement returned results
# INSERT and UPDATE results will not be included in the list
# SELECT statements that return no results will not be included in the list