sql stringlengths 6 1.05M |
|---|
-- file:union.sql ln:119 expect:true
(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) EXCEPT SELECT 4,5,6
|
<filename>src/test/resources/sql/create_table/4050e633.sql
-- file:domain.sql ln:479 expect:true
create table ddtest2(f1 posint2)
|
SET @iKatID = (SELECT `kateg` FROM `sys_options` WHERE `Name` = 'bx_photos_uploader_switcher');
DELETE FROM `sys_options` WHERE `kateg` = @iKatID;
INSERT INTO `sys_options` (`Name`, `VALUE`, `kateg`, `desc`, `Type`, `check`, `err_text`, `order_in_kateg`, `AvailableValues`) VALUES
('bx_photos_activation', 'on', @iKatID, 'Enable auto-activation for photos', 'checkbox', '', '', 1, ''),
('category_auto_app_bx_photos', 'on', @iKatID, 'Autoapprove categories of photos', 'checkbox', '', '', 2, ''),
('bx_photos_allowed_exts', 'jpg jpeg png gif', @iKatID, 'Allowed extensions', 'digit', '', '', 3, ''),
('bx_photos_profile_album_name', '{nickname}''s photos', @iKatID, 'Default profile album name', 'digit', '', '', 4, ''),
('bx_photos_profile_cover_album_name', '{nickname}''s cover photos', @iKatID, 'Default profile cover album name', 'digit', '', '', 5, ''),
('bx_photos_mode_index', 'last', @iKatID, 'Default sort on main index page<br /> (if enabled in the template)', 'select', '', '', 10, 'last,top'),
('bx_photos_number_index', '9', @iKatID, 'How many photos show on main index page', 'digit', '', '', 12, ''),
('bx_photos_number_home', '12', @iKatID, 'How many photos show on photos home page', 'digit', '', '', 14, ''),
('bx_photos_number_all', '12', @iKatID, 'How many photos show on browse photos page', 'digit', '', '', 16, ''),
('bx_photos_number_top', '6', @iKatID, 'How many photos show in featured, top, and similar sections', 'digit', '', '', 18, ''),
('bx_photos_number_related', '3', @iKatID, 'Number of related photos by user', 'digit', '', '', 20, ''),
('bx_photos_number_previous_rated', '3', @iKatID, 'Number of previous rated photos', 'digit', '', '', 22, ''),
('bx_photos_number_albums_home', '3', @iKatID, 'How many albums show on photos home page', 'digit', '', '', 24, ''),
('bx_photos_number_albums_browse', '9', @iKatID, 'How many albums show on browse albums page', 'digit', '', '', 26, ''),
('bx_photos_number_albums_public_objects', '4', @iKatID, 'Minimum number of photos required to display album in Public Albums block', 'digit', '', '', 28, ''),
('bx_photos_number_view_album', '6', @iKatID, 'How many photos show on view album page', 'digit', '', '', 30, ''),
('bx_photos_file_width', '750', @iKatID, 'Width of main photo unit (in pixels)', 'digit', '', '', 34, ''),
('bx_photos_file_height', '750', @iKatID, 'Height of main photo unit (in pixels)', 'digit', '', '', 35, ''),
('bx_photos_client_width', '2048', @iKatID, 'Width for photo resizing in browser (in pixels)', 'digit', '', '', 38, ''),
('bx_photos_client_height', '2048', @iKatID, 'Height for photo resizing in browser (in pixels)', 'digit', '', '', 39, ''),
('bx_photos_flickr_photo_api', '', @iKatID, 'Flickr API key. You can get Flickr API keys here: http://www.flickr.com/services/api/keys/', 'digit', '', '', 50, ''),
('bx_photos_rss_feed_on', 'on', @iKatID, 'Enable RSS feed', 'checkbox', '', '', 52, ''),
('bx_photos_uploader_switcher', 'html5,record,embed', @iKatID, 'Available uploaders', 'list', '', '', 54, 'html5,regular,record,embed'),
('bx_photos_header_cache', '0', @iKatID, 'Header Cache time (in seconds, leave 0 to disable)', 'digit', '', '', 56, ''),
('bx_photos_cover_rows', '4', @iKatID, 'Number of rows in Photos Home page Cover', 'digit', '', '', 61, ''),
('bx_photos_cover_columns', '10', @iKatID, 'Number of columns in Photos Home page Cover', 'digit', '', '', 62, ''),
('bx_photos_cover_featured', '', @iKatID, 'Use featured photos for Photos Home page Cover', 'checkbox', '', '', 63, '');
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_view' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_view' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_home' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_home' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_album_view' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_album_view' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_albums_my' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_albums_my' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_albums_owner' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_albums_owner' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_rate' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_rate' AND `Column` != 0 AND @iFirstColumn = 0;
SET @iFirstColumn = (SELECT COUNT(*) FROM `sys_page_compose` WHERE `Page` = 'bx_photos_crop' AND `Column` = 1);
UPDATE `sys_page_compose` SET `Column` = `Column` - 1 WHERE `Page` = 'bx_photos_crop' AND `Column` != 0 AND @iFirstColumn = 0;
|
{{
config(
enabled=True
)
}}
{%- set source_model = "v_stg_customers_crm" -%}
{%- set src_pk = "CUSTOMER_PK" -%}
{%- set src_hashdiff = "CUSTOMER_HASHDIFF" -%}
{%- set src_payload = ["age", "country"] -%}
{%- set src_eff = "EFFECTIVE_FROM" -%}
{%- set src_ldts = "LOAD_DATE" -%}
{%- set src_source = "RECORD_SOURCE" -%}
{{ dbtvault.sat(src_pk=src_pk, src_hashdiff=src_hashdiff,
src_payload=src_payload, src_eff=src_eff,
src_ldts=src_ldts, src_source=src_source,
source_model=source_model) }}
|
<reponame>stevenhurwitt/dbt-xdb
{%- macro aggregate_strings(val, delim) -%}
{#
SUPPORTS:
- Postgres
- Snowflake
- BigQuery
#}
{%- if target.type == 'postgres' -%}
string_agg({{ val }}::varchar {{',' if delim else ''}} {{ delim }})
{%- elif target.type == 'bigquery' -%}
string_agg(cast({{val}} as string) {{',' if delim else ''}} {{ delim }})
{%- elif target.type == 'snowflake' -%}
listagg(cast({{ val }} as varchar){{',' if delim else ''}} {{ delim }})
{%- else -%}
{{ xdb.not_supported_exception('aggregate_strings') }}
{%- endif -%}
{%- endmacro -%}
|
<reponame>alexrios/the-amazing-ledger
BEGIN;
CREATE TYPE account_class AS ENUM (
'liability',
'assets',
'income',
'expense',
'equity'
);
CREATE TYPE operation_type AS ENUM (
'debit',
'credit'
);
CREATE TABLE entries (
id UUID primary key,
account_class ACCOUNT_CLASS not null,
account_group TEXT not null,
account_subgroup TEXT not null,
account_id TEXT not null,
operation OPERATION_TYPE not null,
amount INT not null,
version BIGINT not null,
transaction_id UUID not null,
created_at TIMESTAMPTZ not null default CURRENT_TIMESTAMP
);
CREATE INDEX idx_entries_account_class ON entries(account_class);
CREATE INDEX idx_entries_account_group ON entries(account_group);
CREATE INDEX idx_entries_account_subgroup ON entries(account_subgroup);
CREATE INDEX idx_entries_account_id ON entries(account_id);
COMMIT;
|
SELECT * FROM SYSTEMS
ORDER BY INSERT_DATETIME %s
LIMIT ? OFFSET ?;
|
<gh_stars>10-100
select name, arn, id, scope, region
from aws.aws_wafv2_ip_set
where akas::text = '["{{output.resource_aka_global.value}}"]'; |
<gh_stars>1000+
DROP TABLE IF EXISTS {$NAMESPACE}_dashboard.dashboard_dashboard_ngrams;
|
INSERT INTO
TestTable(
_bit
)
values(
@bit
)
/*PARAM* bit, BOOLEAN, TRUE *PARAM*/ |
<filename>src/test/tinc/tincrepo/mpp/gpdb/tests/storage/uao/uao_heap_compaction/sql/stats.sql
-- @Description Tests that the pg_class statistics are updated on
-- lazy vacuum.
--
-- ensure that the scan go through the index
SET enable_seqscan=false;
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo';
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo_index';
DELETE FROM foo WHERE a < 16;
VACUUM foo;
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo';
SELECT relname, reltuples FROM pg_class WHERE relname = 'foo_index';
|
<filename>src/test/tinc/tincrepo/mpp/gpdb/tests/storage/filerep_end_to_end/sync2/sql/sync2_heap_alter_part_add_default_part.sql
-- start_ignore
SET gp_create_table_random_default_distribution=off;
-- end_ignore
--
-- SYNC2 Heap Part Table 1
--
CREATE TABLE sync2_heap_alter_part_add_default_part1 (id int, name text, rank int, year date, gender
char(1)) DISTRIBUTED BY (id, gender, year)
partition by list (gender)
subpartition by range (year)
subpartition template (
start (date '2001-01-01'))
(
values ('M'),
values ('F')
);
--
-- Insert few records into the table
--
insert into sync2_heap_alter_part_add_default_part1 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
-- SYNC2 Heap Part Table 2
--
CREATE TABLE sync2_heap_alter_part_add_default_part2 (id int, name text, rank int, year date, gender
char(1)) DISTRIBUTED BY (id, gender, year)
partition by list (gender)
subpartition by range (year)
subpartition template (
start (date '2001-01-01'))
(
values ('M'),
values ('F')
);
--
-- Insert few records into the table
--
insert into sync2_heap_alter_part_add_default_part2 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
--
-- ALTER TABLE TO ADD DEFAULT PART
--
--
--
-- ALTER SYNC1 Heap Part Add Default Parition
--
alter table sync1_heap_alter_part_add_default_part7 add default partition default_part;
--
-- Insert few records into the table
--
insert into sync1_heap_alter_part_add_default_part7 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
-- ALTER CK_SYNC1 Heap Part Add Default Parition
--
alter table ck_sync1_heap_alter_part_add_default_part6 add default partition default_part;
--
-- Insert few records into the table
--
insert into ck_sync1_heap_alter_part_add_default_part6 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
-- ALTER CT Heap Part Add Default Parition
--
alter table ct_heap_alter_part_add_default_part4 add default partition default_part;
--
-- Insert few records into the table
--
insert into ct_heap_alter_part_add_default_part4 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
-- ALTER RESYNC Heap Part Add Default Parition
--
alter table resync_heap_alter_part_add_default_part2 add default partition default_part;
--
-- Insert few records into the table
--
insert into resync_heap_alter_part_add_default_part2 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
--
-- ALTER SYNC2 Heap Part Add Default Parition
--
alter table sync2_heap_alter_part_add_default_part1 add default partition default_part;
--
-- Insert few records into the table
--
insert into sync2_heap_alter_part_add_default_part1 values (generate_series(1,100),'ann',generate_series(1,100),'2001-01-01','F');
|
<gh_stars>0
CREATE DATABASE taskforce
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
USE taskforce;
CREATE TABLE categories (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`title` VARCHAR(128) NOT NULL,
`title_en` VARCHAR(128) NOT NULL
);
CREATE TABLE proposal (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`comment` VARCHAR(128) NOT NULL,
`task_id` INT NOT NULL,
`budget` INT NULL,
`user_id` INT NOT NULL
);
CREATE TABLE users (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`creation_time` DATETIME DEFAULT NOW() NOT NULL,
`name` VARCHAR(128) NOT NULL,
`email` VARCHAR(128) NOT NULL,
`location_id` INT NULL,
`birthday` DATETIME NULL,
`info` TEXT NULL,
`password` VARCHAR(128) NOT NULL,
`phone` VARCHAR(128) NULL,
`skype` VARCHAR(128) NULL,
`another_messenger` VARCHAR(128) NULL,
`avatar` VARCHAR(128) NULL,
`task_name` VARCHAR(128) NULL,
`show_contacts_for_customer` TINYINT NOT NULL DEFAULT 0,
`hide_profile` TINYINT NOT NULL DEFAULT 0,
`last_visit_time` TIMESTAMP NOT NULL,
`rating` FLOAT NULL ,
`count_orders` INT NULL ,
`popularity` INT NULL,
`now_free` TINYINT NULL DEFAULT 0,
`has_reviews` TINYINT NOT NULL DEFAULT 0,
);
CREATE TABLE favorites (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT NOT NULL,
`favorites_id` INT NOT NULL
);
CREATE TABLE users_categories (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT NOT NULL,
`category_id` INT NOT NULL
);
CREATE TABLE email_settings (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT NOT NULL,
`proposal` TINYINT NOT NULL,
`chat_message` TINYINT NOT NULL,
`refuse` TINYINT NOT NULL,
`start_task` TINYINT NOT NULL,
`completion_task` TINYINT NOT NULL
);
CREATE TABLE reviews (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`creation_time` DATETIME DEFAULT NOW() NOT NULL,
`executor_id` INT NULL,
`customer_id` INT NULL,
`assessment` INT NULL,
`task_id` INT NULL,
`comment` TEXT NULL
);
CREATE TABLE tasks (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`creation_time` DATETIME DEFAULT NOW() NOT NULL,
`name` VARCHAR(128) NOT NULL,
`category_id` INT NOT NULL,
`description` TEXT NULL,
`location_id` INT NULL,
`budget` INT NULL,
`deadline` DATETIME NOT NULL,
`customer_id` INT NOT NULL,
`executor_id` INT NULL,
`status` INT NULL
);
CREATE TABLE chat_messages (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`task_id` INT NOT NULL,
`writer_id` INT NOT NULL,
`comment` TEXT NOT NULL,
`creation_time` DATETIME DEFAULT NOW() NOT NULL,
`viewed` TINYINT NOT NULL
);
CREATE TABLE locations (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`city` VARCHAR(128) NOT NULL,
`lat` VARCHAR(128) NOT NULL,
`long` VARCHAR(128) NOT NULL
);
CREATE TABLE file (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`path` VARCHAR(128) NOT NULL,
`user_id` INT NOT NULL,
`task_id` INT NULL
);
|
DROP FUNCTION IF EXISTS copy_questionnaire(
in_questionnaire_id INTEGER, in_user_id INTEGER
);
CREATE OR REPLACE FUNCTION copy_questionnaire(
in_questionnaire_id INTEGER, in_user_id INTEGER
) RETURNS INTEGER
LANGUAGE sql AS $$
WITH copied_questionnaires AS (
INSERT INTO questionnaires (
user_id,
last_editor_id,
administrator_remarks,
questionnaire_date,
header_file_name,
header_content_type,
header_file_size,
header_updated_at,
status,
display_in_tab_max_level,
delegation_enabled,
help_pages,
translator_visible,
private_documents,
created_at,
updated_at,
activated_at,
last_edited,
original_id
)
SELECT
in_user_id,
in_user_id,
administrator_remarks,
questionnaire_date,
header_file_name,
header_content_type,
header_file_size,
header_updated_at,
0, -- not started
display_in_tab_max_level,
delegation_enabled,
help_pages,
translator_visible,
private_documents,
current_timestamp,
current_timestamp,
NULL,
NULL,
id
FROM questionnaires
WHERE id = in_questionnaire_id
RETURNING *
), copied_questionnaire_fields AS (
INSERT INTO questionnaire_fields (
questionnaire_id,
language,
title,
introductory_remarks,
is_default_language,
email_subject,
email,
email_footer,
submit_info_tip,
created_at,
updated_at
)
SELECT
copied_questionnaires.id,
t.language,
'COPY ' || TO_CHAR(copied_questionnaires.created_at, 'DD/MM/YYYY') || ': ' || t.title,
t.introductory_remarks,
t.is_default_language,
t.email_subject,
t.email,
t.email_footer,
t.submit_info_tip,
copied_questionnaires.created_at,
copied_questionnaires.updated_at
FROM questionnaire_fields t
JOIN copied_questionnaires
ON copied_questionnaires.original_id = t.questionnaire_id
)
SELECT id FROM copied_questionnaires;
$$;
|
--+ holdcas on;
--add two new users
create user test1 password '<PASSWORD>';
create user test2 password '<PASSWORD>';
--check current user level
SELECT CURRENT_USER;
--login use test1 without password, this operation will be success as current user is dba, will not check password
CALL login ('test1', '') ON CLASS db_user;
--check current user level
SELECT CURRENT_USER;
--login use test2 without wrong password, error will be returned
CALL login ('test2', '<PASSWORD>') ON CLASS db_user;
--login use test2 without blank password, error will be returned
CALL login ('test2', '') ON CLASS db_user;
--login use dba again
CALL login('dba','') on CLASS db_user;
--check current user level
SELECT CURRENT_USER;
--check if use a wrong password will be login as current user is dba
CALL login('test1','<PASSWORD>') on CLASS db_user;
--check current user level
SELECT CURRENT_USER;
CALL login('dba','') on CLASS db_user;
drop user test1;
drop user test2;
--+ holdcas off;
|
<filename>pset7/fiftyville/log.sql
-- Keep a log of any SQL queries you execute as you solve the mystery.
-- All you know is that the theft took place on July 28, 2020 and that it took place on Chamberlin Street.
-- Get description of the crime scene report on the day of the crime
SELECT description
FROM crime_scene_reports
WHERE
year = 2020
AND month = 7
AND day = 28
AND street = 'Chamberlin Street';
-- Theft of the CS50 duck took place at 10:15am at the Chamberlin Street courthouse.
-- Interviews were conducted today with three witnesses who were present
-- at the time — each of their interview transcripts mentions the courthouse.
-- Get witness statement in the courtroom on the day of the crime
SELECT transcript
FROM interviews
WHERE
year = 2020
AND month = 7
AND day = 28
AND transcript LIKE '%courthouse%';
-- Sometime within ten minutes of the theft,
-- I saw the thief get into a car in the courthouse parking lot and drive away.
-- If you have security footage from the courthouse parking lot,
-- you might want to look for cars that left the parking lot in that time frame.
-- I don't know the thief's name, but it was someone I recognized.
-- Earlier this morning, before I arrived at the courthouse,
-- I was walking by the ATM on Fifer Street and saw the thief there withdrawing some money.
-- As the thief was leaving the courthouse, they called someone who talked to them for less than a minute.
-- In the call, I heard the thief say that they were planning to take
-- the earliest flight out of Fiftyville tomorrow.
-- The thief then asked the person on the other end of the phone to purchase the flight ticket.
-- Get Thief by intersecting suspect names in every witness statement
-- Sometime within ten minutes of the theft,
-- I saw the thief get into a car in the courthouse parking lot and drive away.
SELECT name
FROM people
JOIN courthouse_security_logs
ON people.license_plate = courthouse_security_logs.license_plate
WHERE
year = 2020
AND month = 7
AND day = 28
AND hour = 10
AND minute BETWEEN 15 AND 25 -- within ten minutes
AND activity = 'exit' -- thief drive away
INTERSECT
-- Earlier this morning, before I arrived at the courthouse,
-- I was walking by the ATM on Fifer Street and saw the thief there withdrawing some money.
SELECT name
FROM people
JOIN bank_accounts
ON people.id = bank_accounts.person_id
JOIN atm_transactions
ON atm_transactions.account_number = bank_accounts.account_number
WHERE
year = 2020
AND month = 7
AND day = 28
AND atm_location = 'Fifer Street' -- walking on Fifer Street
AND transaction_type = 'withdraw' -- thief withdrawing some money
INTERSECT
-- As the thief was leaving the courthouse, they called someone who talked to them for less than a minute.
SELECT name
FROM people
JOIN phone_calls -- phone call
ON people.phone_number = phone_calls.caller
WHERE
year = 2020
AND month = 7
AND day = 28
AND duration < 60 -- less than a minute
INTERSECT
-- In the call, I heard the thief say that they were planning to take
-- the earliest flight out of Fiftyville tomorrow.
SELECT name
FROM people
JOIN passengers
ON people.passport_number = passengers.passport_number
WHERE flight_id IN (
SELECT id
FROM flights
WHERE
year = 2020
AND month = 7
AND day = 29 -- tomorrow: 28 + 1
ORDER BY -- the earliest flight out
hour,
minute
LIMIT 1 -- the earliest flight out
);
-- Thief is Ernest
-- Get thief destination
-- In the call, I heard the thief say that they were planning to take
-- the earliest flight out of Fiftyville tomorrow.
-- The thief then asked the person on the other end of the phone to purchase the flight ticket.
SELECT city
FROM airports
WHERE id IN (
SELECT destination_airport_id
FROM flights
WHERE
year = 2020
AND month = 7
AND day = 29
ORDER BY -- the earliest flight out
hour,
minute
LIMIT 1 -- the earliest flight out
);
-- Thief destination is London
-- Get thief accomplice
-- As the thief was leaving the courthouse, they called someone who talked to them for less than a minute.
SELECT name
FROM people
JOIN phone_calls -- phone call
ON people.phone_number = phone_calls.receiver
WHERE
year = 2020
AND month = 7
AND day = 28
AND duration < 60 -- less than a minute
AND caller IN (
SELECT phone_number
FROM people
WHERE name = "Ernest" -- thief
);
-- Thief accomplice is Berthold
|
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Waktu pembuatan: 13 Nov 2019 pada 23.35
-- Versi server: 5.7.19
-- Versi PHP: 7.1.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `batik`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `barangs`
--
CREATE TABLE `barangs` (
`id` bigint(20) UNSIGNED NOT NULL,
`nama_barang` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`gambar` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`harga` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`stok` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`keterangan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data untuk tabel `barangs`
--
INSERT INTO `barangs` (`id`, `nama_barang`, `gambar`, `harga`, `stok`, `keterangan`, `created_at`, `updated_at`) VALUES
(1, 'Pisang oreo Original', 'menu 1.png', '7000', '5', 'Pisang plus oreo berbalut panir dan selimuti coklat', '2019-11-13 17:00:00', '2019-11-13 17:00:00'),
(2, 'Pisang oreo plus toping', 'menu 2.png', '7000', '10', 'Pisang plus oreo dengan tambahan toping (+1k)', '2019-11-13 17:00:00', '2019-11-13 17:00:00'),
(3, 'Pisan Geprek MIX 3', 'menu 3.png', '7000', '8', 'Pisang geprek dengan 3 toping nikmat', '2019-11-13 17:00:00', '2019-11-13 17:00:00');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `barangs`
--
ALTER TABLE `barangs`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `barangs`
--
ALTER TABLE `barangs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
INSERT INTO `music_lyricists` VALUES ('agape_no_saisyu_teiri','wotaku','2020-01-01 00:00:00','2020-03-04 14:09:05'),('ai_ga_areba','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('ame_to_cappuccino','nabuna','2020-01-01 00:00:00','2020-03-04 07:30:45'),('anonatsu_ga_howasuru','kanzaki_iori','2020-01-01 00:00:00','2020-02-29 03:26:59'),('bitter_choco_deco','syudou','2020-01-01 00:00:00','2020-02-27 14:07:39'),('cagayake_girls','omori_shoko','2020-01-01 00:00:00','2020-03-01 09:56:16'),('cult','dustcell','2020-01-01 00:00:00','2020-02-29 02:43:47'),('cutie_panther','hataaki','2020-01-01 00:00:00','2020-02-27 14:07:39'),('dadadada_tenshi','nayutan_seijin','2020-01-01 00:00:00','2020-03-02 12:28:51'),('disney_medley','unknown','2020-01-01 00:00:00','2020-03-04 07:30:45'),('el_tango_egoista','nyanyannya','2020-01-01 00:00:00','2020-02-29 12:28:06'),('fantasy_forest','jin','2020-01-01 00:00:00','2020-02-27 14:07:39'),('go_go_maniac','omori_shoko','2020-01-01 00:00:00','2020-03-01 08:54:27'),('happy_hollow','nanou','2020-01-01 00:00:00','2020-02-29 11:42:33'),('heaven_and_hell','dustcell','2020-01-01 00:00:00','2020-02-29 02:32:04'),('home_sweet_home','neko_hacker','2020-01-01 00:00:00','2020-02-27 14:07:39'),('inochi_ni_kirawareteiru','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('kafu_ito','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('kafu_majo','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('karashina','a_ii','2020-01-01 00:00:00','2020-02-29 03:00:01'),('kimagure_romantic','mizuno_yoshiki','2020-01-01 00:00:00','2020-02-28 17:01:16'),('kinsei_no_dance','nayutan_seijin','2020-01-01 00:00:00','2020-02-28 14:45:04'),('kohaku_oen_v','sato_takafumi','2020-01-01 00:00:00','2020-03-04 21:51:10'),('kokoronashi','papiyon','2020-01-01 00:00:00','2020-02-29 04:52:36'),('kuhaku','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('lazy','dustcell','2020-01-01 00:00:00','2020-02-29 02:43:47'),('lemon','yonezu_kenshi','2020-01-01 00:00:00','2020-02-27 14:07:39'),('little_cry_of_the_abyss','sasakure_uk','2020-01-01 00:00:00','2020-02-27 14:07:39'),('marunouchi_sadistic','sina_ringo','2020-01-01 00:00:00','2020-02-29 03:22:37'),('matane_ga_areba','chinmari_p','2020-01-01 00:00:00','2020-02-27 14:07:39'),('mawaru_sorausagi','orange_star','2020-01-01 00:00:00','2020-02-27 14:07:39'),('moudoku_ga_osou','hifumi','2020-01-01 00:00:00','2020-02-27 14:07:39'),('orange_sapphire','funta3','2020-01-01 00:00:00','2020-03-02 11:46:23'),('poisoned','ema','2020-01-01 00:00:00','2020-02-29 03:12:59'),('pride_kakumei','honeyworks','2020-01-01 00:00:00','2020-03-02 07:37:16'),('q','powapowa_p','2020-01-01 00:00:00','2020-02-27 14:07:39'),('replay','onuma_paseri','2020-01-01 00:00:00','2020-02-27 14:07:39'),('re_i_am','sawano_hiroyuki','2020-01-01 00:00:00','2020-03-04 07:30:45'),('sayonara_midnight','oshiba_hiroki','2020-01-01 00:00:00','2020-02-27 14:07:39'),('shindeshimattanodarouka','guiano','2020-01-01 00:00:00','2020-02-27 14:07:39'),('shinzou_to_karakuri','kanzaki_iori','2020-01-01 00:00:00','2020-02-27 14:07:39'),('shirushi','lisa','2020-01-01 00:00:00','2020-03-02 10:56:01'),('soldier_game','hataaki','2020-01-01 00:00:00','2020-02-27 14:07:39'),('stigma','dustcell','2020-01-01 00:00:00','2020-02-29 02:43:47'),('uchiage_hanabi','yonezu_kenshi','2020-01-01 00:00:00','2020-02-27 14:07:39'),('utauyo_miracle','omori_shoko','2020-01-01 00:00:00','2020-03-01 09:00:30'),('virtual_to_live','kz','2020-01-01 00:00:00','2020-02-29 07:41:47'),('yankee_girl_yankee_boy','to-ma','2020-01-01 00:00:00','2020-02-27 14:07:39'),('yoake_to_hotaru','nabuna','2020-01-01 00:00:00','2020-02-27 14:07:39'); |
------------------------------区域/地址相关--------------------------------
SET NAMES utf8mb4;
----------------------------省份----------------------------------
DROP TABLE IF EXISTS `province`;
CREATE TABLE `province` (
`code` varchar(16) NOT NULL COMMENT '省份 code',
`name` varchar(16) NOT NULL COMMENT '省份',
PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `province` WRITE;
INSERT INTO `province` (`code`, `name`)
VALUES ('65','新疆维吾尔自治区');
UNLOCK TABLES;
----------------------------省份----------------------------------
----------------------------城市----------------------------------
DROP TABLE IF EXISTS `city`;
CREATE TABLE `city` (
`code` varchar(16) NOT NULL COMMENT '城市 code',
`province_code` varchar(16) NOT NULL COMMENT '所属省份',
`name` varchar(20) NOT NULL COMMENT '城市',
PRIMARY KEY (`code`),
KEY `province_code` (`province_code`),
CONSTRAINT `city_ibfk_1` FOREIGN KEY (`province_code`) REFERENCES `province` (`code`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `city` WRITE;
INSERT INTO `city` (`code`, `province_code`, `name`)
VALUES ('1306','13','保定市');
UNLOCK TABLES;
----------------------------城市----------------------------------
----------------------------区县----------------------------------
DROP TABLE IF EXISTS `district`;
CREATE TABLE `district` (
`code` varchar(16) NOT NULL COMMENT '区县 code',
`province_code` varchar(16) NOT NULL COMMENT '所属省份',
`city_code` varchar(16) NOT NULL COMMENT '所属城市',
`name` varchar(255) NOT NULL COMMENT '区县',
PRIMARY KEY (`code`),
KEY `province_code` (`province_code`),
KEY `city_code` (`city_code`),
CONSTRAINT `district_ibfk_1` FOREIGN KEY (`province_code`) REFERENCES `province` (`code`) ON UPDATE CASCADE,
CONSTRAINT `district_ibfk_2` FOREIGN KEY (`city_code`) REFERENCES `city` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `district` WRITE;
INSERT INTO `district` (`code`, `province_code`, `city_code`, `name`)
VALUES ('110101','11','1101','东城区');
UNLOCK TABLES;
----------------------------区县----------------------------------
----------------------------街道----------------------------------
DROP TABLE IF EXISTS `street`;
CREATE TABLE `street` (
`code` varchar(16) NOT NULL COMMENT '街道 code',
`province_code` varchar(16) NOT NULL COMMENT '所属省份',
`city_code` varchar(16) NOT NULL COMMENT '所属城市',
`district_code` varchar(16) NOT NULL COMMENT '所属区县',
`name` varchar(255) NOT NULL COMMENT '街道',
PRIMARY KEY (`code`),
KEY `province_code` (`province_code`),
KEY `city_code` (`city_code`),
KEY `district_code` (`district_code`),
CONSTRAINT `street_ibfk_1` FOREIGN KEY (`province_code`) REFERENCES `province` (`code`) ON UPDATE CASCADE,
CONSTRAINT `street_ibfk_2` FOREIGN KEY (`city_code`) REFERENCES `city` (`code`) ON UPDATE CASCADE,
CONSTRAINT `street_ibfk_3` FOREIGN KEY (`district_code`) REFERENCES `district` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
LOCK TABLES `street` WRITE;
INSERT INTO `street` (`code`, `province_code`, `city_code`, `district_code`, `name`)
VALUES ('110101001','11','1101','110101','东华门街道');
UNLOCK TABLES;
----------------------------街道----------------------------------
----------------------------村、小区----------------------------------
DROP TABLE IF EXISTS `village`;
CREATE TABLE `village` (
`code` varchar(16) NOT NULL COMMENT '村、小区 code',
`province_code` varchar(16) NOT NULL COMMENT '所属省份',
`city_code` varchar(16) NOT NULL COMMENT '所属城市',
`district_code` varchar(16) NOT NULL COMMENT '所属区县',
`street_code` varchar(16) NOT NULL COMMENT '所属街道',
`name` varchar(255) NOT NULL COMMENT '村、小区',
PRIMARY KEY (`code`),
KEY `province_code` (`province_code`),
KEY `city_code` (`city_code`),
KEY `district_code` (`district_code`),
KEY `street_code` (`street_code`),
CONSTRAINT `village_ibfk_1` FOREIGN KEY (`province_code`) REFERENCES `province` (`code`) ON UPDATE CASCADE,
CONSTRAINT `village_ibfk_2` FOREIGN KEY (`city_code`) REFERENCES `city` (`code`) ON UPDATE CASCADE,
CONSTRAINT `village_ibfk_3` FOREIGN KEY (`district_code`) REFERENCES `district` (`code`) ON UPDATE CASCADE,
CONSTRAINT `village_ibfk_4` FOREIGN KEY (`street_code`) REFERENCES `street` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
----------------------------村、小区----------------------------------
|
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "user" (
"id" INTEGER,
"username" TEXT NOT NULL UNIQUE,
"password" TEXT NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE TABLE IF NOT EXISTS "active_session" (
"id" TEXT,
PRIMARY KEY("id")
);
INSERT INTO "user" VALUES (4,'pera','<PASSWORD>');
INSERT INTO "user" VALUES (5,'mika','<PASSWORD>');
COMMIT;
|
<filename>ridr.sql
-- MySQL dump 10.13 Distrib 5.7.9, for osx10.9 (x86_64)
--
-- Host: localhost Database: rydr_db
-- ------------------------------------------------------
-- Server version 5.5.42
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `comments`
--
DROP TABLE IF EXISTS `comments`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comments` (
`comment_id` int(11) NOT NULL,
`comment_content` text,
`comments_created_at` datetime DEFAULT NULL,
`comments_updated_at` datetime DEFAULT NULL,
`rides_ride_id` int(11) NOT NULL,
`users_user_id` int(11) NOT NULL,
PRIMARY KEY (`comment_id`),
KEY `fk_comments_rides1_idx` (`rides_ride_id`),
KEY `fk_comments_users1_idx` (`users_user_id`),
CONSTRAINT `fk_comments_rides1` FOREIGN KEY (`rides_ride_id`) REFERENCES `rides` (`ride_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_comments_users1` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `comments`
--
LOCK TABLES `comments` WRITE;
/*!40000 ALTER TABLE `comments` DISABLE KEYS */;
/*!40000 ALTER TABLE `comments` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `friends`
--
DROP TABLE IF EXISTS `friends`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `friends` (
`users_user_id` int(11) NOT NULL,
`users_friend_id` int(11) NOT NULL,
PRIMARY KEY (`users_user_id`,`users_friend_id`),
KEY `fk_users_has_users_users2_idx` (`users_friend_id`),
KEY `fk_users_has_users_users1_idx` (`users_user_id`),
CONSTRAINT `fk_users_has_users_users1` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_users_has_users_users2` FOREIGN KEY (`users_friend_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `friends`
--
LOCK TABLES `friends` WRITE;
/*!40000 ALTER TABLE `friends` DISABLE KEYS */;
/*!40000 ALTER TABLE `friends` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `locations`
--
DROP TABLE IF EXISTS `locations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `locations` (
`location_id` int(11) NOT NULL,
`street_1` varchar(255) DEFAULT NULL,
`street_2` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`state` varchar(3) DEFAULT NULL,
`postal_code` varchar(15) DEFAULT NULL,
`country` varchar(255) DEFAULT 'US',
`location_created_at` datetime DEFAULT NULL,
`location_updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `locations`
--
LOCK TABLES `locations` WRITE;
/*!40000 ALTER TABLE `locations` DISABLE KEYS */;
/*!40000 ALTER TABLE `locations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `messages`
--
DROP TABLE IF EXISTS `messages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `messages` (
`message_id` int(11) NOT NULL AUTO_INCREMENT,
`message_content` text,
`messages_created_at` datetime DEFAULT NULL,
`messages_updated_at` datetime DEFAULT NULL,
`recipient_id` int(11) DEFAULT NULL,
`users_user_id` int(11) NOT NULL,
PRIMARY KEY (`message_id`),
KEY `fk_messages_users1_idx` (`users_user_id`),
CONSTRAINT `fk_messages_users1` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `messages`
--
LOCK TABLES `messages` WRITE;
/*!40000 ALTER TABLE `messages` DISABLE KEYS */;
/*!40000 ALTER TABLE `messages` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ratings`
--
DROP TABLE IF EXISTS `ratings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ratings` (
`rating_id` int(11) NOT NULL AUTO_INCREMENT,
`star_value` int(11) DEFAULT NULL,
`user_rating_id` int(11) DEFAULT NULL,
`ratings_content` text,
`ratings_created_at` datetime DEFAULT NULL,
`ratings_updated_at` datetime DEFAULT NULL,
`users_user_id` int(11) NOT NULL,
PRIMARY KEY (`rating_id`),
KEY `fk_ratings_users1_idx` (`users_user_id`),
CONSTRAINT `fk_ratings_users1` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ratings`
--
LOCK TABLES `ratings` WRITE;
/*!40000 ALTER TABLE `ratings` DISABLE KEYS */;
/*!40000 ALTER TABLE `ratings` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `rides`
--
DROP TABLE IF EXISTS `rides`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rides` (
`ride_id` int(11) NOT NULL AUTO_INCREMENT,
`ride_datetime` datetime DEFAULT NULL,
`public` tinyint(1) DEFAULT NULL,
`ride_description` varchar(45) DEFAULT NULL,
`ride_image` varchar(45) DEFAULT NULL,
`from` int(11) DEFAULT NULL,
`to` int(11) DEFAULT NULL,
`ride_created_at` datetime DEFAULT NULL,
`ride_updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`ride_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `rides`
--
LOCK TABLES `rides` WRITE;
/*!40000 ALTER TABLE `rides` DISABLE KEYS */;
/*!40000 ALTER TABLE `rides` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(45) DEFAULT NULL,
`fb_user_id` int(11) DEFAULT NULL,
`first_name` varchar(205) DEFAULT NULL,
`last_name` varchar(205) DEFAULT NULL,
`username` varchar(105) DEFAULT NULL,
`profile_pic` varchar(255) DEFAULT NULL,
`bio` text,
`carma` int(11) DEFAULT NULL,
`users_created_at` datetime DEFAULT NULL,
`users_updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users_rides`
--
DROP TABLE IF EXISTS `users_rides`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users_rides` (
`users_user_id` int(11) NOT NULL,
`rides_ride_id` int(11) NOT NULL,
PRIMARY KEY (`users_user_id`,`rides_ride_id`),
KEY `fk_users_has_rides_rides1_idx` (`rides_ride_id`),
KEY `fk_users_has_rides_users_idx` (`users_user_id`),
CONSTRAINT `fk_users_has_rides_users` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_users_has_rides_rides1` FOREIGN KEY (`rides_ride_id`) REFERENCES `rides` (`ride_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users_rides`
--
LOCK TABLES `users_rides` WRITE;
/*!40000 ALTER TABLE `users_rides` DISABLE KEYS */;
/*!40000 ALTER TABLE `users_rides` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-06-29 11:01:05
|
CREATE TABLE flokkur(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255)
);
INSERT INTO
flokkur(nafn)
VALUES
("Sóló"),
("Hljómsveit"),
("Dúó");
CREATE TABLE utgefandi(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255)
);
INSERT INTO
utgefandi(nafn)
VALUES
("Columbia Records"),
("Cleveland International Records"),
("EMI Records");
CREATE TABLE tegund(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255)
);
INSERT INTO
tegund(nafn)
VALUES
("Folk Rock"),
("Hard Rock"),
("Progressive Rock"),
("Rock"),
("Pop/Soul");
CREATE TABLE flytjandi(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255),
faedingardagur INT,
lysing VARCHAR(555),
danardagur INT,
flokkur_flytjanda INT,
FOREIGN KEY (flokkur_flytjanda) REFERENCES flokkur(ID)
);
INSERT INTO
flytjandi(nafn,faedingardagur,lysing,danardagur,flokkur_flytjanda)
VALUES
("<NAME>",1957,"<NAME> er dúó sem samanstendur af <NAME> og <NAME>. Þeir voru eitt af bestu böndunum í kringum 1960. Vinsælustu lögin þeirra eru án efa Mrs. Robinson og Sound Of Silence",1970,3),
("Aerosmith",1970,"Aerosmith er amerísk rokkhljómsveit sem stundum er kölluð 'The Bad Boys from Boston'. Hljómsveitin samanstendur af <NAME>, <NAME>, <NAME>, Tom Hamilton og <NAME>. Vinsælustu lögin þeirra hljóta að vera Dream On, sem var samplað af Eminem fyrir lagið Sing For The Moment, og I Don't Wanna Miss A Thing.",NULL,2),
("<NAME>",1963,"<NAME>acos Panayiotou, betur þekktur sem <NAME>, (fæddur í London) var breskur tónlistarmaður. Hann reis til frægðar með tvíeykinu Wham! á 9. áratugnum og hélt svo áfram með sólóferil.",2016,1),
("<NAME>",1947,"<NAME>, <NAME>, <NAME> eru þrjú nöfn sem þessi einstaki tónlistarmaður hefur. Hann hefur unnið margoft með <NAME>, sem skrifaði til dæmis Holding out for a Hero með <NAME>.",NULL,1),
("Queen",1970,"Queen var bresk rokkhljómsveit sem kom fram á sjónarsviðið 1970. Hún var stofnuð af <NAME> söngvara sveitarinnar, <NAME> trommuleikara og <NAME> gítarleikara í London sama ár. Félagarnir fengu ýmsa bassaleikara til liðs við sig áður en <NAME> var ráðinn bassaleikari sveitarinnar 1971. Hljómsveitin var með allra vinsælustu rokk-hljómsveitunum á áttunda og níunda áratugnum og frá henni hafa komið heimsþekkt lög á borð við „Bohemian Rhapsody“, „We Will Rock You“ og „Killer Queen“.",NULL,2);
CREATE TABLE diskur(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255),
utgafudagur INT,
utgefandi INT,
flytjandi INT,
FOREIGN KEY (utgefandi) REFERENCES utgefandi(ID),
FOREIGN KEY (flytjandi) REFERENCES flytjandi(ID)
);
INSERT INTO
diskur(nafn,utgafudagur,utgefandi,flytjandi)
VALUES
("Sounds of Silence",19640301,1,1),
("Parsley, Sage, Rosemary and Thyme",19651201,1,1),
("News of the World",19771028,3,5),
("Aerosmith",19730105,1,2),
("Faith",19871030,1,3),
("Bat Out of Hell",19771021,2,4),
("Toys in the Attic",19750408,1,2),
("Music from Another Dimension!",20121106,1,2);
CREATE TABLE lag(
ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
nafn VARCHAR(255),
lengd_sek INT,
texti TEXT,
diskur INT,
flytjandi INT,
tegund INT,
FOREIGN KEY (diskur) REFERENCES diskur(ID),
FOREIGN KEY (flytjandi) REFERENCES flytjandi(ID),
FOREIGN KEY (tegund) REFERENCES tegund(ID)
);
INSERT INTO
lag(nafn,lengd_sek,texti,diskur,flytjandi,tegund)
VALUES
("Spread Your Wings",274,"Sammy was low
Just watching the show
Over and over again
Knew it was time
He'd made up his mind
To leave his dead life behind
His boss said to him
Boy you'd better begin
To get those crazy notions right out of your head
Sammy who do you think that you are?
You should've been sweeping up the Emerald Bar
Spread your wings and fly away
Fly away, far away
Spread your little wings and fly away
Fly away, far away
Pull yourself together
'Cos you know you should do better
That's because you're a free man
He spends his evenings alone in his hotel room
Keeping his thoughts to himself, he'd be leaving soon
Wishing he was miles and miles away
Nothing in this world, nothing would make him stay
Since he was small
Had no luck at all
Nothing came easy to him
Now it was time
He'd made up his mind
This could be my last chance
His boss said to him, Now listen boy!
You're always dreaming
You've got no real ambition, you won't get very far
Sammy boy, don't you know who you are?
Why can't you be happy at the Emerald Bar?
So honey
Spread your wings and fly away
Fly away, far away
Spread your little wings and fly away
Fly away, far away
Pull yourself together
'Cos you know you should do better
That's because you're a free man",3,5,4),
("We Are the Champions",179,"I've paid my dues
Time after time.
I've done my sentence
But committed no crime.
And bad mistakes ‒
I've made a few.
I've had my share of sand kicked in my face
But I've come through.
(And I need just go on and on, and on, and on)
We are the champions, my friends,
And we'll keep on fighting 'til the end.
We are the champions.
We are the champions.
No time for losers
'Cause we are the champions of the world.
I've taken my bows
And my curtain calls.
You brought me fame and fortune, and everything that goes with it.
I thank you all.
But it's been no bed of roses,
No pleasure cruise.
I consider it a challenge before the whole human race,
And I ain't gonna lose.
(And I need just go on and on, and on, and on)
We are the champions, my friends,
And we'll keep on fighting 'til the end.
We are the champions.
We are the champions.
No time for losers
'Cause we are the champions of the world.
We are the champions, my friends,
And we'll keep on fighting 'til the end.
We are the champions.
We are the champions.
No time for losers
'Cause we are the champions.
[Not in the original version:] Of the world",3,5,4),
("We Will Rock You",121,"Buddy you're a boy make a big noise
Playin' in the street gonna be a big man some day
You got mud on yo' face
You big disgrace
Kickin' your can all over the place
Singin'
We will we will rock you
We will we will rock you
Buddy you're a young man hard man
Shoutin' in the street gonna take on the world some day
You got blood on yo' face
You big disgrace
Wavin' your banner all over the place
We will we will rock you
(Sing it!)
We will we will rock you
Buddy you're an old man poor man
Pleadin' with your eyes gonna make you some peace some day
You got mud on your face
Big disgrace
Somebody better put you back into your place
We will we will rock you
(Sing it!)
We will we will rock you
(Everybody)
We will we will rock you
We will we will rock you
(Alright)",3,5,4),
("Father Figure",336,"That's all I wanted:
Something special, something sacred
In your eyes.
For just one moment
To be bold and naked
At your side.
Sometimes I think that you never
Understand me (understand me).
Maybe this time is forever.
Say it can be, whoa.
That's all you wanted:
Something special, someone sacred
In your life.
Just for one moment
To be warm and naked
At my side.
Sometimes I think that you never
Understand me (understand me).
But something tells me together
We'd be happy, oh, oh.
(baby)
I will be your father figure.
(oh, baby)
Put your tiny hand in mine.
(I'd love to)
I will be your preacher teacher.
(be your daddy)
Anything you have in mind.
(it would make me)
I will be your father figure.
(very happy)
I have had enough of crime.
(please let me)
I will be the one who loves you
'Til the end of time (of time).
That's all I wanted,
But sometimes love can be mistaken
For a crime.
That's all I wanted:
Just to see my baby's
Blue eyes shine.
This time I think that my lover
Understands me (understands me).
Please
If we have faith in each other
Then we can be
Strong.
(baby)
I will be your father figure.
Put your tiny hand in mine.
(my baby)
I will be your preacher teacher.
Anything you have in mind.
I will be your father figure.
I have had enough of crime.
I will be the one who loves you
'Til the end of time.
If you are the desert
I'll be the sea.
If you ever hunger
Hunger for me.
Whatever you ask for
That's what I'll be.
So when you remember the ones who have lied,
Who said that they cared,
But then laughed as you cried,
Beautiful darling,
Don't think of me.
Because all I ever wanted...
It's in your eyes, baby, baby.
And love can't lie.
No.
Greet me with the eyes of a child.
My love is always tellin' me so.
Heaven is a kiss and a smile.
Just hold on, hold on.
And I won't let you go, my baby.
I will be your father figure.
Put your tiny hand in mine.
I will be your preacher teacher.
Anything you have in mind, baby.
I will be your father figure.
And I have had enough of crime.
I will be the one who loves you—
So, I am gonna love you—
'Til the end of time.
I will be your father.
(I will be your...)
I will be your preacher.
(...father)
I will be your father.
I'll be your daddy, whoa.
I will be the one who loves you
'Til the end of time.",5,3,5),
("Faith",136,"Well I guess it would be nice
If I could touch your body
I know not everybody
Has got a body like you
But I've got to think twice
Before I give my heart away
And I know all the games you play
Because I play them too
Oh but I
Need some time off from that emotion
Time to pick my heart up off the floor
Oh when that love comes down
Without devotion
Well it takes a strong man baby
But I'm showing you the door
‘Cause I gotta have faith
I gotta have faith
‘Cause I gotta have faith, faith
‘Cause I gotta have faith, faith, faith
Baby,
I know you're asking me to stay
Say please, please, please don't go away
You say I'm giving you the blues
Maybe
You mean every word you say
Can't help but think of yesterday
And another who tied me down to loverboy rules
Before this river
Becomes an ocean
Before you throw my heart back on the floor
Oh oh baby I reconsider
My foolish notion
Well I need someone to hold me
But I'll wait for something more
Yes I've gotta have faith…
Mmm, I gotta have faith
‘Cause I gotta have faith, faith, faith
I gotta have faith-a-faith-a-faith
Before this river
Becomes an ocean
Before you throw my heart back on the floor
Oh oh baby I reconsider
My foolish notion
Well I need someone to hold me
But I'll wait for something more
Cause I gotta have faith
Mmm I gotta have faith
Because I got to have faith-a-faith-a-faith
I gotta have faith-a-faith-a-faith",5,3,5),
("For Crying Out Loud",525,"I was lost till you were found
But I never knew how far down
I was falling
Before I reached the bottom
I was cold and you were fire
And I never knew how the pyre
Could be burning
On the edge of the ice field
And now the chilly Californian wind
Is blowing down our bodies again
And we're sinking deeper and deeper
In the chilly Californian sand
Oh I know you belong inside my aching heart
And can't you see my faded Levis bursting apart
And don't you here me crying
'Oh Babe, don't go'
And don't you hear me screaming
'How was I to know'
I'm in the middle of nowhere
Near the end of the line
But there's a border to somewhere waiting
And there's a tankful of time
Oh give me just another moment
To see the light of the day
And take me to another land
Where I don't have to stay
And I'm gonna need somebody
To make me feel like you do
And I will receive somebody
With open arms, open eyes
Open up the sky and let the planet
That I love shine through
For crying out loud
You know I love you
I was damned and you were saved
And I never knew how enslaved
I was kneeling
In the chains of my master
I could laugh but you could cry
And I never knew just how high
I was flying
Ah with you right above me
And now the chilly Californian wind
Is blowing down our bodies again
And we're sinking deeper and deeper
In the chilly Californian sand
Oh I know you belong inside my aching heart
And can't you see my faded Levis bursting apart
And don't you here me crying
'Oh Babe, don't go'
And don't you hear me screaming
'How was I to know'
I'm in the middle of nowhere
Near the end of the line
But there's a border to somewhere waiting
And there's a tankful of time
Oh give me just another moment
To see the light of the day
And take me to another land
Where I don't have to stay
And I'm gonna need somebody
To make me feel like you do
And I will receive somebody
With open arms, open eyes
Open up the sky and let the planet
That I love shine through
For crying out loud
You know I love you
For taking in the rain when I'm feeling so dry
For giving me the answers when I'm asking you why
My oh my, for that I thank you
For taking in the sun when I'm feeling so cold
For giving me a child when my body is old
Don't you know for that I need you
For coming to my room when you know I'm alone
For finding me a highway and for driving me home
For that I serve you
For pulling me away when I'm starting to fall
For revving me up when I'm starting to stall
And all in all for that I want you
For taking and for giving and for playing the game
For praying for my future in the days that remain
Oh Lord for that I hold you
Ah but most of all
For crying out loud
For that I love you
When you're crying out loud
You know I love you",6,4,3),
("Paradise by the Dashboard Light",508,"[Boy:]
I remember every little thing
As if it happened only yesterday
Parking by the lake
And there was not another cat in sight
And I never had a girl
Looking any better than you did
And all the kids at school
They were wishing they were me that night
And now our bodies are, oh, so close and tight
It never felt so good, it never felt so right
And we're glowing like the metal on the edge of a knife
Glowing like the metal on the edge of a knife
C'mon, hold on tight
C'mon, hold on tight
Though it's cold and lonely in the deep dark night
I can see paradise by the dashboard light
[Girl:]
Ain't no doubt about it we were doubly blessed
'Cause we were barely seventeen and we were barely dressed
[Both:]
Ain't no doubt about it
Baby, got to go out and shout it
Ain't no doubt about it
We were doubly blessed
[Boy:]
'Cause we were barely seventeen
And we were barely dressed
Baby, don't you hear my heart
You got it drowning out the radio
I've been waiting so long
For you to come along and have some fun
And I gotta let you know
No, you're never gonna regret it
So open up your eyes,
I got a big surprise
It'll feel all right
Well, I wanna make your motor run
And now our bodies are, oh, so close and tight
It never felt so good, it never felt so right
And we're glowing like the metal on the edge of a knife
Glowing like the metal on the edge of a knife
C'mon, hold on tight
C'mon, hold on tight
[Both:]
Though it's cold and lonely in the deep dark night
I can see paradise by the dashboard light
Though it's cold and lonely in the deep dark night
Paradise by the dashboard light
You got to do what you can
And let Mother Nature do the rest
Ain't no doubt about it
We were doubly blessed
'Cause we were barely seventeen
And we were barely
[3x]
We're gonna go all the way tonight
We're gonna go all the way
And tonight's the night
[Radio Broadcast:]
OK, here we go, we got a real pressure cooker going here
Two down, nobody on, no score, bottom of the ninth
There's the wind-up, and there it is
A line shot up the middle, look at him go
This boy can really fly
He's rounding first and really turning it on now
He's not letting up at all, he's gonna try for second
The ball is bobbled out in the center
And here comes the throw and what a throw
He's gonna slide in head first
Here he comes, he's out
No, wait, safe, safe at second base
This kid really makes things happen out there
Batter steps up to the plate
Here's the pitch, he's going
And what a jump he's got
He's trying for third
Here's the throw
It's in the dirt, safe a third
Holy cow, stolen base
He's taking a pretty big lead out there
Almost daring them to pick him off
The pitcher glances over, winds-up and it's bunted
Bunted down the third base line
The suicide squeeze is on
Here he comes, squeeze play, it's gonna be close
Here's the throw, here's the play at the plate
Holy cow, I think he's gonna make it
[Girl:]
Stop right there
I gotta know right now
Before we go any further
Do you love me?
Will you love me forever?
Do you need me?
Will you never leave me?
Will you make me so happy
For the rest of my life?
Will you take me away
And will you make me your wife?
Do you love me?
Will you love me forever?
Do you need me?
Will you never leave me?
Will you make me so happy
For the rest of my life?
Will you take me away
And will you make me your wife?
I gotta know right now
Before we go any further
Do you love me?
Will you love me forever?
[Boy:]
Let me sleep on it
Baby, baby, let me sleep on it
Let me sleep on it
And I'll give you an answer in the morning
Let me sleep on it
Baby, baby, let me sleep on it
Let me sleep on it
And I'll give you an answer in the morning
Let me sleep on it
Baby, baby, let me sleep on it
Let me sleep on it
And I'll give you an answer in the morning
[Girl:]
I gotta know right now
Do you love me?
Will you love me forever?
Do you need me?
Will you never leave me?
Will you make me so happy
For the rest of my life?
Will you take me away
And will you make me your wife?
I gotta know right now
Before we go any further
Do you love me?
And will you love me forever?
What's it gonna be, boy?
Come on, I can wait all night.
What's it gonna be, boy?
Yes or no?
What's it gonna be, boy?
Yes or no?
[Boy:]
Let me sleep on it
Baby, baby, let me sleep on it
Let me sleep on it
And I'll give you an answer in the morning
Let me sleep on it
[Girl:]
I gotta know right now
Do you love me
Will you love me forever
Do you need me
Will you never leave me
Will you make me so happy
For the rest of my life
Will you take me away
And will you make me your wife
I gotta know right now
Before we go any further
Do you love me
Will you love me forever
[Boy:]
Let me sleep on it
Baby, baby let me sleep on it
Let me sleep on it
And I'll give you an answer in the morning
I gotta know right now
Before we go any further
Do you love me?
And will you love me forever?
[Boy:]
Let me sleep on it
[Girl:]
Will you love me forever
[Boy:]
I couldn't take it any longer
Lord I was crazed
And when the feeling came upon me
Like a tidal wave
I started swearing to my god
And on my mother's grave
That I would love you to the end of time
I swore I would love you to the end of time
So now I'm praying for the end of time
To hurry up and arrive
'Cause if I gotta spend another minute with you
I don't think that I can really survive
I'll never break my promise or forget my vow
But God only knows what I can do right now
I'm praying for the end of time
It's all I can do (ooh, ooh)
I'm praying for the end of time
So I can end my time with you
[Boy:]
It was long ago and it was far away,
And it was so much better than it is today.
[Girl:]
It never felt so good, it never felt so right
And we were glowing like the metal on the edge of a knife.",6,4,3),
("Two Out of Three Ain't Bad",323,"Baby we can talk all night
But that ain't getting us nowhere
I told you everything I possibly can
There's nothing left inside of here
And maybe you can cry all night
But that'll never change the way that I feel
The snow is really piling up outside
I wish you wouldn't make me leave here
I poured it on and I poured it out
I tried to show you just how much I care
I'm tired of words and I'm too hoarse to shout
But you've been cold to me so long
I'm crying icicles instead of tears
And all I can do is keep on telling you
I want you
I need you
But there ain't no way
I'm ever gonna love you
Now don't be sad
'Cause two out of three ain't bad
Now don't be sad
'Cause two out of three ain't bad
You'll never find your gold on a sandy beach
You'll never drill for oil on a city street
I know you're looking for a ruby
In a mountain of rocks
But there ain't no Coupe de Ville hiding
At the bottom of a Cracker Jack box
I can't lie
I can't tell you that I'm something I'm not
No matter how I try
I'll never be able to give you something
Something that I just haven't got
There's only one girl that I will ever love
And that was so many years ago
And though I know I'll never get her out of my heart
She never loved me back, ooh I know
Well I remember how she left me on a stormy night
Oh she kissed me and got out of our bed
And though I pleaded and I begged her
Not to walk out that door
She packed her bags and turned right away
And she kept on telling me
She kept on telling me
She kept on telling me
I want you
I need you
But there ain't no way
I'm ever gonna love you
Now don't be sad
'Cause two out of three ain't bad
I want you
I need you
But there ain't no way
I'm ever gonna love you
Now don't be sad
'Cause two out of three ain't bad
Now don't be sad
'Cause two out of three ain't bad
Baby we can talk all night
But that ain't getting us nowhere",6,4,3),
("You Took the Words Right Out of My Mouth",304,"It was a hot summer night
and the beach was burning.
There was fog crawling over the sand.
When I listen to your heart
I hear the whole world turning.
I see the shooting stars falling
through your trembling hands.
You were licking your lips
and your lipstick shining.
I was dying just to ask for a taste.
We were lying together in a silver lining
by the the light of the moon.
You know there's not another moment
Not another moment
Not another moment to waste.
You hold me so close that my knees grow weak.
But my soul is flying high above the ground.
I'm trying to speak but no matter what I do
I just can't seem to make any sound.
And then you took the words right out of my mouth.
Oh it must have been while you were kissing me.
You took the words right out of my mouth.
And I swear it's true,
I was just about to say I love you.
And then you took the words right out of my mouth.
Oh it must have been while you were kissing me.
You took the words right out of my mouth.
And I swear it's true,
I was just about to say I love you.
Now my body is shaking like a wave on the water
And I guess that I'm beginning to grin.
Oh we're finally alone and we can do what we want to.
The night is young
And Ain't no-one gonna know where you
No-one gonna know where you
No-one's gonna know where you've been.
You were licking your lips
and your lipstick shining.
I was dying just to ask for a taste.
We were lying together in a silver lining
by the the light of the moon.
You know there's not another moment
Not another moment
Not another moment to waste.
And then you took the words right out of my mouth.
Oh it must have been while you were kissing me.
You took the words right out of my mouth.
And I swear it's true,
I was just about to say I love you.
And then you took the words right out of my mouth.
Oh it must have been while you were kissing me.
You took the words right out of my mouth.
And I swear it's true,
I was just about to say I love you.",6,4,3),
("Bat Out of Hell",588,"The sirens are screaming and the fires are howling
Way down in the valley tonight.
There's a man in the shadows with a gun in his eye
And a blade shining, oh, so bright.
There's evil in the air and there's thunder in sky,
And a killer's on the bloodshot streets.
Oh, and down in the tunnel where the deadly are rising,
Oh, I swear I saw a young boy down in the gutter,
He was starting to foam in the heat.
Oh, baby, you're the only thing in this whole world,
That's pure and good and right.
And wherever you are and wherever you go,
There's always gonna be some light.
But I gotta get out,
I gotta break it out now,
Before the final crack of dawn.
So we gotta make the most of our one night together.
When it's over you know,
We'll both be so alone.
Like a bat out of hell
I'll be gone when the morning comes.
When the night is over
Like a bat out of hell
I'll be gone-gone-gone.
Like a bat out of hell
I'll be gone when the morning comes.
But when the day is done, and the sun goes down,
And the moonlight's shining through,
Then like a sinner before the gates of heaven,
I'll come crawling on back to you.
I'm gonna hit the highway like a battering ram
On a silver black phantom bike.
When the metal is hot and the engine is hungry,
And we're all about to see the light.
Nothing ever grows in this rotting old hole.
And everything is stunted and lost.
And nothing really rocks
And nothing really rolls
And nothing's ever worth the cost.
And I know that I'm damned if I never get out,
And maybe I'm damned if I do,
But with every other beat I've got left in my heart,
You know I'd rather be damned with you.
Well, if I gotta be damned you know I wanna be damned
Dancing through the night with you.
Well, if I gotta be damned you know I wanna be damned—
Gotta be damned, you know I wanna be damned—
Gotta be damned, you know I wanna be damned
Dancing through the night—
Dancing through the night—
Dancing through the night with you.
Oh, baby, you're the only thing in this whole world,
That's pure and good and right.
And wherever you are and wherever you go,
There's always gonna be some light.
But I gotta get out,
I gotta break it out now,
Before the final crack of dawn.
So we gotta make the most of our one night together.
When it's over you know
We'll both be so alone.
Like a bat out of hell
I'll be gone when the morning comes.
When the night is over
Like a bat out of hell
I'll be gone gone gone.
Like a bat out of hell
I'll be gone when the morning comes.
But when the day is done and the sun goes down,
And the moonlight's shining through,
Then like a sinner before the gates of heaven,
I'll come crawling on back to you.
Then like a sinner before the gates of heaven,
I'll come crawling on back to you.
I can see myself tearing up the road
Faster than any other boy has ever gone.
And my skin is raw but my soul is ripe.
No one's gonna stop me now,
I'm gonna make my escape.
But I can't stop thinking of you,
And I never see the sudden curve until it's way too late.
And I never see the sudden curve 'til it's way too late.
Then I'm dying at the bottom of a pit in the blazing sun.
Torn and twisted at the foot of a burning bike.
And I think somebody somewhere must be tolling a bell.
And the last thing I see is my heart
Still beating,
Breaking out of my body and flying away,
Like a bat out of hell.
Then I'm dying at the bottom of a pit in the blazing sun.
Torn and twisted at the foot of a burning bike.
And I think somebody somewhere must be tolling a bell.
And the last thing I see is my heart
Still beating, still beating,
Breaking out of my body and flying away,
Like a bat out of hell.
Like a bat out of hell.
Like a bat out of hell.
Oh, like a bat out of hell!
Like a bat out of hell!
Like a bat out of hell!",6,4,3),
("The 59th Street Bridge Song ",103,"Slow down, you move too fast
You got to make the morning last
Just kicking down the cobblestones
Looking for fun and feelin' groovy
Ba da da da da da da, feelin' groovy
Hello, lamppost, what'cha knowin'?
I've come to watch your flowers growin'
Ain't'cha got no rhymes for me?
Doot-in doo-doo, feelin' groovy
Ba da da da da da da, feelin' groovy
I got no deeds to do
No promises to keep
I'm dappled and drowsy and ready to sleep
Let the morning time drop all its petals on me
Life, I love you
All is groovy",2,1,1),
("The Big Bright Green Pleasure Machine",164,"Do people have a tendency to dump on you?
Does your group have more cavities than theirs?
Do all the hippies seem to get the jump on you?
Do you sleep alone when other sleep in pairs?
Well there's no need to complain,
We'll eliminate your pain.
We can neutralize your brain.
You'll feel just fine
Now.
Buy a big bright green pleasure machine!
Do figures of authority just shoot you down?
Is life within the business world a drag?
Did your boss just mention that you'd better shop around
To find yourself a more productive bag?
Are you worried and distressed?
Can't seem to get no rest?
Put our product to the test.
You'll feel just fine
Now.
Buy a big bright green pleasure machine!
You better hurry up and order one.
Our limited supply is very nearly gone.
Do you nervously await the blows of cruel fate?
Do your checks bounce higher than a rubber ball?
Are you worried 'cause your girlfriend's just a little late?
Are you looking for a way to chuck it all?
We can end your daily strife
At a reasonable price.
You've seen it advertised in Life.
You'll feel just fine
Now.
Buy a big bright green pleasure machine.",2,1,1),
("Patterns",162,"The night sets softly
With the hush of falling leaves
Casting shivering shadows
On the houses through the trees
And the light from a street lamp
Paints a pattern on my wall
Like the pieces of a puzzle
Or a child's uneven scrawl
Up a narrow flight of stairs
In a narrow little room
As I lie upon my bed
In the early evening gloom
Impaled on my wall
My eyes can dimly see
The pattern of my life
And the puzzle that is me
From the moment of my birth
To the instant of my death
There are patterns I must follow
Just as I must breathe each breath
Like a rat in a maze
The path before me lies
And the pattern never alters
Until the rat dies
And the pattern still remains
On the wall where darkness fell
And it's fitting that it should
For in darkness I must dwell
Like the color of my skin
Or the day that I grow old
My life is made of patterns
That can scarcely be controlled",2,1,1),
("A Most Peculiar Man",154,"He was a most peculiar man.
That's what <NAME> said and she should know;
She lived upstairs from him
She said he was a most peculiar man.
He was a most peculiar man.
He lived all alone within a house,
Within a room, within himself,
A most peculiar man.
He had no friends, he seldom spoke
And no one in turn ever spoke to him,
'Cause he wasn't friendly and he didn't care
And he wasn't like them.
Oh, no! he was a most peculiar man.
He died last Saturday.
He turned on the gas and he went to sleep
With the windows closed so he'd never wake up
To his silent world and his tiny room;
And <NAME> says he has a brother somewhere
Who should be notified soon.
And all the people said, What a shame that he's dead,
But wasn't he a most peculiar man?",1,1,1),
("I Am a Rock",170,"A winter's day
In a deep and dark December
I am alone
Gazing from my window
To the streets below
On a freshly fallen, silent shroud of snow
I am a rock
I am an island
I've built walls
A fortress, steep and mighty
That none may penetrate
I have no need of friendship
Friendship causes pain.
It's laughter and it's loving I disdain.
I am a rock
I am an island
Don't talk of love
Well, I've heard the words before
It's sleeping in my memory
And I won't disturb the slumber
Of feelings that have died
If I never loved, I never would have cried
I am a rock
I am an island
I have my books
And my poetry to protect me
I am shielded in my armor
Hiding in my room
Safe within my womb
I touch no one and no one touches me
I am a rock
I am an island
And a rock feels no pain
And an island never cries",1,1,1),
("The Sound of Silence",183,"Hello darkness, my old friend
I've come to talk with you again
Because a vision softly creeping
Left its seeds while I was sleeping
And the vision that was planted in my brain
Still remains
Within the sound of silence
In restless dreams I walked alone
Narrow streets of cobblestone
‘Neath the halo of a streetlamp
I turned my collar to the cold and damp
When my eyes were stabbed by the flash of a neon light
That split the night
And touched the sound of silence
And in the naked light I saw
Ten thousand people, maybe more
People talking without speaking
People hearing without listening
People writing songs that voices never share
No one dare
Disturb the sound of silence
“Fools” said I, “You do not know
Silence like a cancer grows
Hear my words that I might teach you
Take my arms that I might reach you”
But my words like silent raindrops fell
And echoed in the wells of silence
And the people bowed and prayed
To the neon god they made
And the sign flashed out its warning
In the words that it was forming
And the sign said “The words of the prophets
Are written on the subway walls
And tenement halls
And whispered in the sounds of silence”",1,1,1),
("Toys in the Attic",187,"In the attic lights
Voices scream
Nothing's seen
Real's a dream
Leaving the things that are real behind
Leaving the things that you love from mind
All of the things that you learned from fears
Nothing is left for the years
Voices scream
Nothing's seen
Real's a dream
Toys, toys, toys in the attic
Toys, toys, toys in the attic
Toys, toys, toys in the attic
Toys, toys, toys in the attic
Lights
Voices scream
Nothing's seen
Real's a dream
Leaving the things that are real behind
Leaving the things that you love from mind
All of the things that you learned from fears
Nothing is left for the years
Voices scream
Nothing's seen
Real's a dream
Toys, toys, toys in the attic
Toys, toys, toys in the attic
Toys, toys, toys in the attic
Toys, toys, toys in the attic",7,2,2),
("Make It",221,"Good evening people, welcome to the show!
Got something here I want you all to know
When laughin' people bring on primal screams
You got to think of what it's gonna take to make your dreams!
Make it!
Don't break it
I said make it!
Don't break it
Do then ya feel like the world's coming down on you
You know that history repeats itself!
But you just learned, so by somebody else
You know you do, you gotta think up fast
You gotta figure what it's gonna take to make it last!
Make it!
Don’t fake it
I said make it!
Don’t fake it
Then you do
Better weather, pull yourself together
Don't be catchin' the blues!
Better weather, pull yourself together
What have you got to lose!
You're only paying your dues!
Too stinkin’ proud but you’re gonna pay!
If you’re gone I’ll get you anyway
Although you know what you’ve been goin’ through!
Your only dreams feel like a tattoo!
Make it!
Don’t break it
I said make it!
Don’t break it
Then you do
Better weather, pull yourself together
Don't be catchin' the blues!
Better weather, pull yourself together
What have you got to lose!",4,2,2),
("Dream On",268,"Every time I look in the mirror
All these lines on my face getting clearer
The past is gone
It went by like dusk to dawn
Isn't that the way?
Everybody's got their dues in life to pay
Yeah, I know nobody knows
Where it comes and where it goes
I know it's everybody's sin
You got to lose to know how to win
Half my life's in books' written pages
Live and learn from fools and from sages
You know it's true
All the things come back to you
Sing with me, sing for the year
Sing for the laughter, sing for the tear
Sing with me if it's just for today
Maybe tomorrow the good Lord will take you away
Yeah, sing with me, sing for the year
Sing for the laughter, sing for the tear
Sing with me if it's just for today
Maybe tomorrow the good Lord will take you away
Dream on, dream on, dream on,
Dream yourself a dream come true
Dream on, dream on, dream on,
Dream until your dreams come true
Dream on, dream on, dream on,
Dream on, dream on,
Dream on, dream on, ah
Sing with me, sing for the year
Sing for the laughter, sing for the tear
Sing with me if it's just for today
Maybe tomorrow, the good Lord will take you away
Sing with me, sing for the year
Sing for the laughter, sing for the tear
Sing with me just for today
Maybe tomorrow, the good Lord will take you away...",4,2,2),
("Walk This Way",220,"Backstroke lover
Always hidin' 'neath the covers
'Til I talked to your daddy, he say
He said, You ain't seen nothin'
'Til you're down on a muffin
Then you're sure to be a-changin' your ways.
I met a cheerleader,
Was a real young bleeder
Oh, the times I could reminisce
'Cause the best things of lovin'
With her sister and her cousin
Only started with a little kiss
Like this!
Seesaw swingin' with the boys in the school
And your feet flyin' up in the air
Singing, Hey diddle diddle
With your kitty in the middle
Of the swing like you didn't care
So I took a big chance
At the high school dance
With a missy who was ready to play
Wasn't me she was foolin'
'Cause she knew what she was doin'
And I knowed love was here to stay
When she told me to...
Walk this way [8x]
Just gimme a kiss
Like this!
Schoolgirl sweetie with a classy kinda sassy
Little skirt's climbin' way up the knee
There was three young ladies in the school gym locker
When I noticed they was lookin' at me
I was a high school loser, never made it with a lady
'Til the boys told me somethin' I missed
Then my next door neighbor with a daughter had a favor
So I gave her just a little kiss
Like this!
Seesaw swingin' with the boys in the school
And your feet flyin' up in the air
Singing, Hey diddle diddle
With your kitty in the middle
Of the swing like you didn't care
So I took a big chance
At the high school dance
With a missy who was ready to play
Wasn't me she was foolin'
'Cause she knew what she was doin'
When she told me how to walk this way,
She told me to...
Walk this way [8x]
Just gimme a kiss
Like this!",7,2,2),
("Legendary Child",255,"Legendary child
I'll tell you what I'm talking about
Making love at 17, yeah we had the luck
But we traded them toys for other joys
And we didn't give a...
(Whoa whoa whoa)
I took a chance at the high school dance
Never knowing wrong from right
And that same show 40 years ago
Being televised tonight
Cause getting from inside my head to the Taj Mahal
I went from never having none to wanna have it all
I wanna keep that dream alive
And eat that honey from the hive
With all the noise and all the glamour
No surprise, you know I am a
Legendary child
I think that what I'm trying to say is
Sticks and stones may break your bones
At least they'll rearrange
I'll drop a dime, and every time
I get myself a nickel's change
(Whoa whoa whoa)
They say we don't know jack
At the plant we proved them wrong
We traded in our soul tonight and sold them for a song
And if Satan had a lady friend, her name was <NAME>
I never wondered why she tried to drive us quite insane
And how we got that golden fleece
From toking on that pipe of peace
Yea as far as I can see
There is a God 'cause I got me a
Legendary child
Legendary child
Legendary child
Legendary child
Legendary
Legendary child
Legendary",8,2,2); |
CREATE DATABASE IF NOT EXISTS `cc` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `cc`;
-- MySQL dump 10.13 Distrib 5.5.44, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: cc
-- ------------------------------------------------------
-- Server version 5.5.44-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `fk_accounts_features`
--
DROP TABLE IF EXISTS `fk_accounts_features`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fk_accounts_features` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`accounts_id` bigint(20) unsigned NOT NULL,
`features_id` int(11) NOT NULL,
`status` tinyint(4) DEFAULT '1' COMMENT '1: Active, 0: Inactive',
`features_settings` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
KEY `fk_fk_accounts_features_1_idx` (`accounts_id`),
KEY `fk_fk_accounts_features_2_idx` (`features_id`),
CONSTRAINT `fk_fk_accounts_features_1` FOREIGN KEY (`accounts_id`) REFERENCES `cc_accounts` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_fk_accounts_features_2` FOREIGN KEY (`features_id`) REFERENCES `cc_features` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `fk_accounts_features`
--
LOCK TABLES `fk_accounts_features` WRITE;
/*!40000 ALTER TABLE `fk_accounts_features` DISABLE KEYS */;
INSERT INTO `fk_accounts_features` VALUES (1,227,1,1,NULL);
/*!40000 ALTER TABLE `fk_accounts_features` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cc_features`
--
DROP TABLE IF EXISTS `cc_features`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cc_features` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`feature_name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`feature_level` int(11) NOT NULL,
`account_type` int(11) NOT NULL,
`service_info` text COLLATE utf8_unicode_ci,
`feature_settings` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cc_features`
--
LOCK TABLES `cc_features` WRITE;
/*!40000 ALTER TABLE `cc_features` DISABLE KEYS */;
INSERT INTO `cc_features` VALUES (1,'Change Favicon BL',1,3,'',NULL),(2,'Google Analytics EL',2,3,NULL,NULL),(3,'Change Favicon EL',2,3,NULL,NULL),(4,'Change Favicon SL',3,3,NULL,NULL),(5,'Google Analytics SL',3,3,NULL,NULL);
/*!40000 ALTER TABLE `cc_features` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2015-10-01 16:05:44
|
UPDATE book SET price = 0.9 * price
WHERE amount BETWEEN 5 AND 10;
SELECT * FROM book;
|
<reponame>KungFuni0812/Burger2Sequelize
INSERT INTO burgers (burger_name) VALUES ('Southern Charm Burger');
INSERT INTO burgers (burger_name) VALUES ('Whiskey River Burger');
INSERT INTO burgers (burger_name) VALUES ('Banzai Burger');
INSERT INTO burgers (burger_name) VALUES ('Bacon Cheese Burger'); |
-- Procedure GenericListColumnOption_GetChoices
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [GenericListColumnOption_GetChoices]
(
@ColumnId int
)
AS
SET NOCOUNT ON
SELECT o.Id, o.ColumnId, o.OptionTypeId, o.Rank, o.Caption, o.DefaultValue, ot.Id AS Expr1, ot.Label, ot.Template
FROM GenericListColumnOption AS o INNER JOIN
GenericListColumnOptionType AS ot ON o.OptionTypeId = ot.Id
WHERE (o.ColumnId = @ColumnId)
ORDER BY o.Rank
RETURN
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
|
/* NULL, INNER JOIN, LEFT JOIN, RIGHT JOIN
1.
List the teachers who have NULL for their department.
Why we cannot use =
You might think that the phrase dept=NULL would work
here but it doesn't - you can use the phrase dept IS NULL
That's not a proper explanation. */
SELECT name
FROM teacher
WHERE dept IS NULL
/* 2.
Note the INNER JOIN misses the teachers with no department and the departments with no teacher. */
SELECT teacher.name, dept.name
FROM teacher INNER JOIN dept
ON (teacher.dept=dept.id)
/* 3.
Use a different JOIN so that all teachers are listed. */
SELECT teacher.name, dept.name
FROM teacher
LEFT JOIN dept ON dept = dept.id
/* 4.
Use a different JOIN so that all departments are listed. */
SELECT teacher.name, dept.name
FROM teacher
RIGHT JOIN dept ON dept = dept.id
/*
Using the COALESCE function */
/* 5.
Use COALESCE to print the mobile number. Use the number '07986 444 2266' if there is no number given.
Show teacher name and mobile number or '07986 444 2266' */
SELECT name, COALESCE (mobile, '07986 444 2266')
FROM teacher
/* 6.
Use the COALESCE function and a LEFT JOIN to print the teacher name and department name.
Use the string 'None' where there is no department. */
SELECT teacher.name, COALESCE ( dept.name, 'None')
FROM teacher
LEFT JOIN dept ON dept.id = dept
/* 7.
Use COUNT to show the number of teachers and the number of mobile phones. */
SELECT count(name), (SELECT count(mobile)
FROm teacher
WHERE mobile IS NOT NULL)
FROM teacher
WHERE name IS NOT NULL
/* 8.
Use COUNT and GROUP BY dept.name to show each department and the number of staff.
Use a RIGHT JOIN to ensure that the Engineering department is listed. */
SELECT dept.name, count(teacher.name)
FROM teacher
RIGHT JOIN dept ON teacher.dept = dept.id
GROUP BY dept.name
/* Using CASE
9.
Use CASE to show the name of each
teacher followed by 'Sci' if the teacher is in dept 1 or 2 and 'Art' otherwise. */
SELECT teacher.name, CASE WHEN teacher.dept = 1 THEN 'Sci' WHEN teacher.dept = 2 THEN 'Sci' ELSE 'Art' END
FROM teacher
/* 10.
Use CASE to show the name of each teacher followed by 'Sci' if the teacher is in dept 1 or 2, show 'Art'
if the teacher's dept is 3 and 'None' otherwise. */
SELECT teacher.name, CASE WHEN teacher.dept = 1 THEN 'Sci' WHEN teacher.dept = 2 THEN 'Sci' ELSE 'None' END
FROM teacher
|
SELECT * FROM employees;
SELECT id, name, age
FROM employees
WHERE id=1;
SELECT name, age
FROM employees
WHERE salary>=20000;
SELECT MAX(age)
FROM employees
WHERE salary>=20000;
SELECT age, COUNT(*), AVG(salary)
FROM employees
GROUP BY age;
/***********************************************/
SELECT * FROM employees
INNER JOIN teams ON(employees.id=teams.member);
SELECT employees.*, teams.manager AS manager_id
FROM employees INNER JOIN teams ON(employees.id=teams.member);
SELECT employees1.name as member_name, employees2.name AS manager_name
FROM employees AS employees1
INNER JOIN teams ON(employees1.id=teams.member)
INNER JOIN employees AS employees2 ON(employees2.id=teams.manager);
SELECT teams.manager AS manager_id, COUNT(*) AS num_of_workers, AVG(salary) AS avg_salary
FROM employees INNER JOIN teams ON(employees.id=teams.member)
GROUP BY manager_id;
|
<gh_stars>1-10
INSERT INTO LAYER_GROUP (NAME, GROUP_ORDER) VALUES ('Geologian tutkimuskeskus', (SELECT MAX(GROUP_ORDER) + 1 FROM LAYER_GROUP));
|
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
--:r .\dssdsds.sql
GO
GO
MERGE INTO dbo.NoUpdate
AS TARGET
USING (VALUES (1, 'Edsdsdsdsds', 1), (200000, 'Beer', 0), (9999, 'HASTINGS', 1)) AS SOURCE(Id, name, fun) ON [SOURCE].[Id] = [TARGET].[Id]
WHEN NOT MATCHED BY TARGET THEN INSERT ([Id], [name], [fun]) VALUES ([SOURCE].[Id], [SOURCE].[name], [SOURCE].[fun])
WHEN NOT MATCHED BY SOURCE THEN DELETE;
GO
MERGE INTO dbo.NoDelete
AS TARGET
USING (VALUES (1, 'Ed', 1), (2, 'Ian', 0)) AS SOURCE(Id, name, fun) ON [SOURCE].[Id] = [TARGET].[Id]
WHEN NOT MATCHED BY TARGET THEN INSERT ([Id], [name], [fun]) VALUES ([SOURCE].[Id], [SOURCE].[name], [SOURCE].[fun])
WHEN MATCHED AND (NULLIF ([SOURCE].[fun], [TARGET].[fun]) IS NOT NULL
OR NULLIF ([SOURCE].[name], [TARGET].[name]) IS NOT NULL
OR NULLIF ([SOURCE].[Id], [TARGET].[Id]) IS NOT NULL) THEN UPDATE
SET [TARGET].[Id] = [SOURCE].[Id],
[TARGET].[name] = [SOURCE].[name],
[TARGET].[fun] = [SOURCE].[fun];
GO
MERGE INTO dbo.NoSchema
AS TARGET
USING (VALUES (1, 'Ed', 1), (2, 'Ian', 0)) AS SOURCE(Id, name, fun) ON [SOURCE].[Id] = [TARGET].[Id]
WHEN NOT MATCHED BY TARGET THEN INSERT ([Id], [name], [fun]) VALUES ([SOURCE].[Id], [SOURCE].[name], [SOURCE].[fun])
WHEN MATCHED AND (NULLIF ([SOURCE].[fun], [TARGET].[fun]) IS NOT NULL
OR NULLIF ([SOURCE].[name], [TARGET].[name]) IS NOT NULL
OR NULLIF ([SOURCE].[Id], [TARGET].[Id]) IS NOT NULL) THEN UPDATE
SET [TARGET].[Id] = [SOURCE].[Id],
[TARGET].[name] = [SOURCE].[name],
[TARGET].[fun] = [SOURCE].[fun]
WHEN NOT MATCHED BY SOURCE THEN DELETE;
GO
MERGE INTO dbo.NoInsert
AS TARGET
USING (VALUES (1, 'Ed', 1), (2, 'Ian', 0)) AS SOURCE(Id, name, fun) ON [SOURCE].[Id] = [TARGET].[Id]
WHEN MATCHED AND (NULLIF ([SOURCE].[fun], [TARGET].[fun]) IS NOT NULL
OR NULLIF ([SOURCE].[name], [TARGET].[name]) IS NOT NULL
OR NULLIF ([SOURCE].[Id], [TARGET].[Id]) IS NOT NULL) THEN UPDATE
SET [TARGET].[Id] = [SOURCE].[Id],
[TARGET].[name] = [SOURCE].[name],
[TARGET].[fun] = [SOURCE].[fun]
WHEN NOT MATCHED BY SOURCE THEN DELETE;
GO
MERGE INTO NoInlineTable
As Target
USING TheTable AS SOURCE ON SOURCE.[Id] = TARGET.[Id]
WHEN NOT MATCHED BY TARGET THEN INSERT (Id, name, fun) VALUES (SOURCE.Id, SOURCE.name, SOURCE.fun)
WHEN MATCHED AND (NULLIF (SOURCE.fun, TARGET.fun) IS NOT NULL
OR NULLIF (SOURCE.name, TARGET.name) IS NOT NULL
OR NULLIF (SOURCE.Id, TARGET.Id) IS NOT NULL) THEN UPDATE
SET TARGET.Id = SOURCE.Id,
TARGET.name = SOURCE.name,
TARGET.fun = SOURCE.fun
WHEN NOT MATCHED BY SOURCE THEN DELETE;
GO
MERGE INTO dbo.TheTable
AS TARGET
USING (VALUES (1, 'Ed', 1), (2, 'Ian', 0)) AS SOURCE(Id, name, fun) ON SOURCE.[Id] = TARGET.[Id]
WHEN NOT MATCHED BY TARGET THEN INSERT (Id, name, fun) VALUES (SOURCE.Id, SOURCE.name, SOURCE.fun)
WHEN MATCHED AND (NULLIF (SOURCE.fun, TARGET.fun) IS NOT NULL
OR NULLIF (SOURCE.name, TARGET.name) IS NOT NULL
OR NULLIF (SOURCE.Id, TARGET.Id) IS NOT NULL) THEN UPDATE
SET TARGET.Id = SOURCE.Id,
TARGET.name = SOURCE.name,
TARGET.fun = SOURCE.fun
WHEN NOT MATCHED BY SOURCE THEN DELETE; |
CREATE TABLE subdivision_RS (id VARCHAR(6) NOT NULL, name VARCHAR(255), level VARCHAR(64) NOT NULL, PRIMARY KEY(id));
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-00', E'Belgrad', E'city');
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-02', E'Kesk-Banat', E'district');
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-03', E'Põhja-Banat', E'district');
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-01', E'Põhja-Bačka', E'district');
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-04', E'Lõuna-Banat', E'district');
INSERT INTO "subdivision_RS" ("id", "name", "level") VALUES (E'RS-07', E'Sremi ringkond', E'district');
|
<filename>data/train/sql/2bca992de4f821143e81c4393c6fb533503d0228init_data.sql
DECLARE @i_new_id INTEGER;
EXECUTE sp_com_new_post
@nvc_sender_id = 'cfvbaibai',
@nvc_content = 'Test Post 1',
@i_new_id = @i_new_id OUTPUT;
EXECUTE sp_com_new_reply
@i_reply_to = @i_new_id,
@nvc_sender_id = 'ohaoha',
@nvc_content = 'Test Reply 11';
EXECUTE sp_com_new_reply
@i_reply_to = @i_new_id,
@nvc_sender_id = 'ohaoha',
@nvc_content = 'Test Reply 12';
EXECUTE sp_com_new_post
@nvc_sender_id = 'cfvbaibai',
@nvc_content = 'Test Post 2',
@i_new_id = @i_new_id OUTPUT;
EXECUTE sp_com_new_reply
@i_reply_to = @i_new_id,
@nvc_sender_id = 'xxccc',
@nvc_content = 'Test Reply 21';
EXECUTE sp_com_new_post
@nvc_sender_id = 'cfvbaibai',
@nvc_content = 'Test Post 3',
@i_new_id = @i_new_id OUTPUT; |
CREATE TABLE [Metrics].[CollectionPeriodTolerance]
(
[Id] INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_CollectionPeriodTolerance PRIMARY KEY CLUSTERED,
[AcademicYear] SMALLINT NOT NULL,
[CollectionPeriod] TINYINT NOT NULL,
[SubmissionToleranceLower] DECIMAL(15,5) NOT NULL,
[SubmissionToleranceUpper] DECIMAL(15,5) NOT NULL,
[PeriodEndToleranceLower] DECIMAL(15,5) NOT NULL,
[PeriodEndToleranceUpper] DECIMAL(15,5) NOT NULL,
INDEX IX_CollectionPeriodTolerance__AcademicYear_CollectionPeriod (AcademicYear, CollectionPeriod),
CONSTRAINT UQ_CollectionPeriodTolerance UNIQUE (AcademicYear, CollectionPeriod)
);
GO
|
<reponame>HenrikBauer/T-SQL-AsyncAgent
CREATE PROCEDURE [AgentTests].[Test Started Agent job is running]
AS
BEGIN
-- Align
DECLARE @ExpectedJob NVARCHAR(128) = N'Test job';
DECLARE @ActualJob NVARCHAR(128) = NULL;
-- Act
EXEC [AsyncAgent].[Private_CreateJob] @JobName = @ExpectedJob;
EXEC [AsyncAgent].[Private_AddTsqlJobStep]
@JobName = @ExpectedJob
,@StepName = N'Wait for 5 seconds'
,@Command = N'WAITFOR DELAY N''00:00:10'';'
,@ValidateSyntax = 1
;
-- Job cannot be started if its creation is yet uncommitted.
-- WARNING: This is mandatory for testing but will break tSQLt transaction handling!
COMMIT;
EXEC [AsyncAgent].[Private_StartJob] @JobName = @ExpectedJob;
-- Wait for the job to be started
WAITFOR DELAY N'00:00:02';
SET @ActualJob = (
SELECT TOP 1 [Job].[name]
FROM [msdb].[dbo].[sysjobactivity] AS [Activity]
INNER JOIN [msdb].[dbo].[sysjobs] AS [Job] ON
[Activity].[job_id] = [Job].[job_id]
AND [Job].[name] = @ExpectedJob
WHERE
[run_requested_date] <= GETDATE()
AND [start_execution_date] IS NOT NULL
AND [stop_execution_date] IS NULL
);
-- Cleanup manually, as tSQLt won't roll back
EXEC [msdb].[dbo].[sp_delete_job] @job_name = @ExpectedJob;
EXEC [msdb].[dbo].[sp_delete_category] @class = N'JOB', @name = N'Async';
-- Assert
BEGIN TRAN -- Mandatory, as ROLLBACK is called by tSQLt right after this assertion.
EXEC [tSQLt].[AssertEquals] @Expected = @ExpectedJob, @Actual = @ActualJob;
RETURN 0;
END
|
# This patch creates the new videos table
# It will not fill it with data at this time
DROP TABLE IF EXISTS videos;
CREATE TABLE videos (
id MEDIUMINT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Show''s ID to be used in other tables as reference.',
type TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 = TV, 1 = Film, 2 = Anime',
title VARCHAR(180) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the video.',
countries_id CHAR(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Two character country code (FK to countries table).',
started DATETIME NOT NULL COMMENT 'Date (UTC) of production''s first airing.',
imdb MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for IMDB site (without the ''tt'' prefix).',
tmdb MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for TMDB site.',
trakt MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for TraktTV site.',
tvdb MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for TVDB site',
tvmaze MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for TVMaze site.',
tvrage MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'ID number for TVRage site.',
source TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Which site did we use for info?',
PRIMARY KEY (id),
UNIQUE KEY ix_videos_title (title, type, started, countries_id),
KEY ix_videos_imdb (imdb),
KEY ix_videos_tmdb (tmdb),
KEY ix_videos_trakt (trakt),
KEY ix_videos_tvdb (tvdb),
KEY ix_videos_tvmaze (tvmaze),
KEY ix_videos_tvrage (tvrage),
KEY ix_videos_type_source (type, source)
)
ENGINE = MyISAM
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8
COLLATE = utf8_unicode_ci;
|
INSERT INTO todos
VALUES (1, 'Task 1', 'WAITING', current_timestamp, null);
INSERT INTO todos
VALUES (2, 'Task 2', 'WAITING', current_timestamp, null);
INSERT INTO todos
VALUES (3, 'Task 3', 'WAITING', current_timestamp, null);
INSERT INTO todos
VALUES (4, 'Task 4', 'DONE', current_timestamp, null); |
-- ======================================================================
-- Table: railway_point
-- Description: Entries from planet_osm_point where railway IS NOT NULL
-- Created: 2018-10-19
-- ======================================================================
CREATE SCHEMA IF NOT EXISTS railway;
DROP TABLE IF EXISTS railway.railway_point CASCADE;
CREATE TABLE railway.railway_point
AS SELECT * FROM planet_osm_point WHERE railway IS NOT NULL;
CREATE INDEX railway_point_id_idx
ON railway.railway_point
USING btree (osm_id);
CREATE INDEX railway_point_railway_idx
ON railway.railway_point
USING btree (railway);
CREATE INDEX railway_point_way_idx
ON railway.railway_point
USING gist (way);
ALTER TABLE railway.railway_point
CLUSTER ON railway_point_way_idx;
|
<gh_stars>0
SELECT
test_cal_dt.week_beg_dt
,test_category_groupings.meta_categ_name
,test_category_groupings.upd_user
,test_category_groupings.upd_date
,test_kylin_fact.leaf_categ_id
,test_category_groupings.leaf_categ_id
,test_kylin_fact.lstg_site_id
,test_category_groupings.site_id
,sum(price) as GMV, count(*) as TRANS_CNT
FROM test_kylin_fact
inner JOIN test_cal_dt
ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
inner JOIN test_category_groupings
ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id
AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
where
test_category_groupings.upd_date='2012-09-11 20:26:04'
group by test_cal_dt.week_beg_dt
,test_category_groupings.meta_categ_name
,test_category_groupings.upd_user
,test_category_groupings.upd_date
,test_kylin_fact.leaf_categ_id
,test_category_groupings.leaf_categ_id
,test_kylin_fact.lstg_site_id
,test_category_groupings.site_id
|
<reponame>kevin-at-datical/liquibase-test-harness<filename>src/main/resources/liquibase/harness/change/expectedSql/sqlite/enableTrigger.sql
INVALID TEST
Liquibase does not support enableTrigger changeType for SQLite
-- See https://docs.liquibase.com/change-types/enable-trigger.html |
DROP TABLE IF EXISTS user;
CREATE TABLE user
(
id BIGINT(20) NOT NULL COMMENT '主键ID',
tenant_id BIGINT(20) NOT NULL COMMENT '租户ID',
name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名',
PRIMARY KEY (id)
); |
CREATE TABLE "DR$FLAT_TEXT_INDEX$K"
( "DOCID" NUMBER(38,0),
"TEXTKEY" ROWID,
PRIMARY KEY ("TEXTKEY") ENABLE
) ORGANIZATION INDEX NOCOMPRESS |
<filename>ingest/src/main/resources/selectStar-lite.sql<gh_stars>1-10
select
's3://S3_BUCKET_HERE/' || p.path as fname,
p.path as relpath,
p.size,
p.shasum256 as shasum_256,
p.collection,
u.universe,
u.validity as universe_validity,
a.timeout as arlington_timeout,
a.exit_value as arlington_exit_value,
mc.stderr mc_warn,
mc.stdout mc_stdout,
mc.exit_value mc_exit,
case
when mc.stderr like 'error: cannot authenticate password%' then 'encrypted'
when mc.path is null then 'missing'
when mc.timeout=true then 'timeout'
when mc.exit_value <> 0 then 'crash'
when length(mc.stderr) > 5 then 'warn'
else 'success'
end as mc_status,
case
when pc.stderr like 'error: cannot authenticate password%' then 'encrypted'
when pc.path is null then 'missing'
when pc.timeout=true then 'timeout'
when pc.exit_value <> 0 then 'crash'
when length(pc.stderr) > 5 then 'warn'
else 'success'
end as pc_status,
case
when cpu.stderr like 'pdfcpu: please provide the correct password%' then 'encrypted'
when cpu.path is null then 'missing'
when cpu.timeout=true then 'timeout'
when cpu.exit_value <> 0 then 'crash'
when length(cpu.stderr) > 5 then 'warn'
else 'success'
end as cpu_status,
cpu.stderr as cpu_warn,
pid.stderr pid_stderr,
pid.stdout pid_stdout,
pid.exit_value pid_exit,
case
when pid.stdout ~ '/Encrypt [1-9]' then 'encrypted'
when pid.path is null then 'missing'
when pid.timeout=true then 'timeout'
when pid.exit_value <> 0 then 'crash'
when length(pid.stderr) > 5 then 'warn'
else 'success'
end as pid_status,
pinfo.stderr pinfo_stderr,
pinfo.stdout pinfo_stdout,
pinfo.exit_value pinfo_exit,
case
when pinfo.stderr like 'Command Line Error: Incorrect password%' then 'encrypted'
when pinfo.path is null then 'missing'
when pinfo.timeout=true then 'timeout'
when pinfo.exit_value <> 0 then 'crash'
when length(pinfo.stderr) > 5 then 'warn'
else 'success'
end as pinfo_status,
case
when t.stderr like 'org.apache.tika.exception.EncryptedDocumentException%' then 'encrypted'
when t.path is null then 'missing'
when t.timeout=true then 'timeout'
when t.exit_value <> 0 then 'crash'
when length(t.stderr) > 5 then 'warn'
else 'success'
end as tk_status,
t.exit_value tk_exit,
t.stderr tk_stderr,
q.stderr q_stderr,
q.exit_value q_exit,
case
when q.path is null then 'missing'
when q.timeout=true then 'timeout'
when q.exit_value <> 0 then 'crash'
when length(q.stderr) > 5 then 'warn'
else 'success'
end as q_status,
c.stdout clamav,
c.stderr c_stderr,
c.exit_value c_exit,
case
when c.path is null then 'missing'
when c.timeout=true then 'timeout'
when c.exit_value <> 0 then 'crash'
when length(c.stderr) > 5 then 'warn'
else 'success'
end as c_status,
cd.stdout cd,
cd.stderr cd_warn,
cd.exit_value cd_exit,
case
when cd.path is null then 'missing'
when cd.timeout=true then 'timeout'
when cd.exit_value <> 0 then 'crash'
when length(cd.stderr) > 5 then 'warn'
else 'success'
end as cd_status,
pr.stdout pr,
pr.stderr pr_warn,
pr.exit_value pr_exit,
case
when pr.path is null then 'missing'
when pr.timeout=true then 'timeout'
when pr.exit_value <> 0 then 'crash'
when length(pr.stderr) > 5 then 'warn'
else 'success'
end as pr_status,
pb.stdout pdfbytes_stdout,
case
when pb.path is null then 'missing'
when pb.timeout=true then 'timeout'
when pb.exit_value <> 0 then 'crash'
when length(pb.stderr) > 5 then 'warn'
else 'success'
end as pb_status,
xpf.stdout xpdffonts_stdout,
xpf.stderr xpdffonts_stderr,
case
when xpf.path is null then 'missing'
when xpf.timeout=true then 'timeout'
when xpf.exit_value <> 0 then 'crash'
when length(xpf.stderr) > 5 then 'warn'
else 'success'
end as xpf_status
--if using itext encrypted: com.itextpdf.text.exceptions.BadPasswordException
from profiles p
left join arlington a on a.path = p.path
left join mutoolclean mc on mc.path=p.path
left join pdfbytes pb on pb.path = p.path
left join mutooltext mt on mt.path = p.path
left join pdfchecker pc on pc.path = p.path
left join pdfcpu cpu on cpu.path = p.path
left join pdfid pid on pid.path = p.path
--left join pdfimages pim on pim.path = p.path
left join pdfinfo pinfo on pinfo.path = p.path
--left join pdfminerdump pmd on pmd.path = p.path
--left join pdfminertext pmt on pmt.path = p.path
--left join pdftoppm ppm on ppm.path = p.path
--left join pdftops ps on ps.path = p.path
left join pdftotext ptt on ptt.path = p.path
left join qpdf q on q.path = p.path
left join tika t on t.path = p.path
left join clamav c on c.path = p.path
left join caradoc cd on cd.path = p.path
left join pdfresurrect pr on pr.path = p.path
left join xpdffonts xpf on xpf.path = p.path
left join universes u on u.path = p.path |
-- 20210812 this code runs on SAP HANA Cloud QRC2
-- This script complements and extends the Jupyter Notebook showcasing the hana-ml python client:
-- see: https://github.com/SAP-samples/hana-graph-examples/tree/main/NOTEBOOKS/WELLINGTON_STORMWATER
-- We will demonstrate how to use some advanced spatial and graph features via SQL to analyze a water network.
-- Stormwater network data was downloaded from the Wellington Water Open Data Portal
-- See: https://data-wellingtonwater.opendata.arcgis.com/datasets/d70eead642bf49e393a3b199f0c63e8c_15/explore?location=-41.309742%2C174.802830%2C13.35
-- In essence, we will calculate Voronoi cells to estimate the catchment area and thus the amount of water pushing into each vertex individually.
-- Then, we use a Graph procedure to propagate and accumulate the load to the "downstream" parts of the network.
-- Last, we will compare the load to the pipe's cross-section to identify the network sections which might get "under pressure" first.
-- 1 Load and inspect the data and create the Graph Workspace
-- 2 Identify weakly connected components
-- 3 Calcluate the catchment area for each stormwater node to estimate the water load
-- 4 Estimate the potential water load for each network vertex/edge
/******************************************/
-- Install the spatial reference system in which the data is defined
CREATE PREDEFINED SPATIAL REFERENCE SYSTEM IDENTIFIED BY 2193;
/******************************************/
-- 1 Load and inspect the data and create the Graph Workspace
-- Use a HANA Database Explorer, right-click on your HANA Cloud system and choose import catalogue objects to import
-- 2021Q3_HANA_CLOUD_EXPORT_STORMWATER_NETWORK.tar.gz
-- The file contains two tables:
SELECT * FROM "STORMWATER"."STORMWATER_VERTICES";
SELECT * FROM "STORMWATER"."STORMWATER_EDGES";
-- The stormwater network is a directed (mostly acyclic) graph
CREATE GRAPH WORKSPACE "STORMWATER"."STORMWATER"
EDGE TABLE "STORMWATER"."STORMWATER_EDGES"
SOURCE COLUMN "SOURCE"
TARGET COLUMN "TARGET"
KEY COLUMN "ID"
VERTEX TABLE "STORMWATER"."STORMWATER_VERTICES"
KEY COLUMN "ID";
/**********************************************/
-- 2 Identify weakly connected components
-- The stormwater network is not connected, i.e. there are multiple "components".
-- Let's identify these components using a GRAPH procedure.
-- Create a table type for the result of the procedure:
CREATE TYPE "STORMWATER"."TT_OUT_VERTICES" AS TABLE ("ID" NVARCHAR(20), "$COMPONENT" BIGINT);
-- The procedure returns the number of components and assigns each vertex a component number.
CREATE OR REPLACE PROCEDURE "STORMWATER"."GS_CONNECTED_COMPONENTS" (
OUT o_components BIGINT,
OUT o_res "STORMWATER"."TT_OUT_VERTICES"
)
LANGUAGE GRAPH READS SQL DATA AS
BEGIN
GRAPH g = Graph("STORMWATER", "STORMWATER");
-- add a temporary attribute to store the component number
ALTER g ADD TEMPORARY VERTEX ATTRIBUTE (BIGINT "$COMPONENT" = 0L);
BIGINT i = 0L;
-- For each vertes we'll check if it is alerady assigned to a component.
-- If not, we'll assign the vertex and all of it's neighbors/reachable vertices.
FOREACH v_start IN Vertices(:g){
IF(:v_start."$COMPONENT" == 0L) {
i = :i + 1L;
-- all reachable neighbors are assigned the same component number > 0
FOREACH v_reachable IN REACHABLE_VERTICES(:g, :v_start, 'ANY') {
v_reachable."$COMPONENT" = :i;
}
}
}
o_components = :i;
o_res = SELECT :v."ID", :v."$COMPONENT" FOREACH v IN Vertices(:g);
END;
-- Call the procedure:
CALL "STORMWATER"."GS_CONNECTED_COMPONENTS"(?, ?);
-- Let' store the result of the procedure. We will add the component numerb to both vertices and edges.
-- Add a new column to both tables:
ALTER TABLE "STORMWATER"."STORMWATER_VERTICES" ADD ("COMPONENT" BIGINT);
ALTER TABLE "STORMWATER"."STORMWATER_EDGES" ADD ("COMPONENT" BIGINT);
-- Call the procedure and update the tables with the procedure's result. We'll use a so called anonymous block for this:
DO ()
LANGUAGE SQLSCRIPT
BEGIN
DECLARE o_components BIGINT;
CALL "STORMWATER"."GS_CONNECTED_COMPONENTS"(o_components, o_res);
MERGE INTO "STORMWATER"."STORMWATER_VERTICES" AS SV
USING :o_res AS WCC
ON SV."ID" = WCC."ID"
WHEN MATCHED THEN UPDATE SET SV."COMPONENT" = WCC."$COMPONENT";
MERGE INTO "STORMWATER"."STORMWATER_EDGES" AS SE
USING :o_res AS WCC
ON SE."SOURCE" = WCC."ID"
WHEN MATCHED THEN UPDATE SET SE."COMPONENT" = WCC."$COMPONENT";
END;
-- Inspect the data: which are the biggest weakly connected components?
SELECT "COMPONENT", COUNT(*) AS C FROM "STORMWATER"."STORMWATER_VERTICES" GROUP BY "COMPONENT" ORDER BY C DESC;
/**********************************************/
-- 3 Calcluate the catchment area for each stormwater node to estimate the water load
-- 3.1 For each component, we calculate its alphashape which serves as a bounding polygon
-- 3.2 for each node, we calculate the voronoi cell (=catchment area for each node) and intersect with the components' alphashape
/**********************************************/
-- Alphashapes (bounding polygons for each network component)
-- Let's create a table to store the alpha shapes
CREATE COLUMN TABLE "STORMWATER"."STORMWATER_ALPHASHAPES"(
"COMPONENT" BIGINT,
"ALPHA_SHAPE" ST_GEOMETRY(2193),
"CONCAVE_HULL" ST_GEOMETRY(2193),
"NUM_POINTS" BIGINT
);
-- We'll calculate the alpha shapes for the components with more than 500 vertices
SELECT "COMPONENT", ST_AlphaShapeAggr("SHAPE", 500) AS "ALPHA_SHAPE", ST_ConcaveHullAggr("SHAPE") AS "CONCAVE_HULL", COUNT(*) AS "NUM_POINTS"
FROM "STORMWATER"."STORMWATER_VERTICES"
GROUP BY "COMPONENT"
HAVING COUNT(*) > 500
INTO "STORMWATER"."STORMWATER_ALPHASHAPES";
-- Inspect the data
SELECT * FROM "STORMWATER"."STORMWATER_ALPHASHAPES";
/**********************************************/
-- Voronoi cells (catchment area for each individual vertex)
SELECT "ID", "SHAPE", ST_VoronoiCell("SHAPE", 10.0) OVER () AS "VORONOI_CELL"
FROM "STORMWATER"."STORMWATER_VERTICES"
WHERE "COMPONENT" = 2;
-- Now we intersect the voronoi cells with the component's alpha shape
-- We'll wrap this logic in a view:
CREATE OR REPLACE VIEW "STORMWATER"."V_STORMWATER_VERTICES_COVERED_AREA" AS (
-- Calculate the cutted cells area
SELECT "ID", "CUTTED_VORONOI_CELL" AS "VORONOI_CELL", "CUTTED_VORONOI_CELL".ST_AREA('meter') AS "AREA_M2" FROM (
-- Calculate the intersection
SELECT V."ID", "VORONOI_CELL".ST_Intersection("ALPHA_SHAPE") AS "CUTTED_VORONOI_CELL" FROM
-- The voronoi cells:
(SELECT "ID", "COMPONENT", ST_VoronoiCell("SHAPE", 10.0) OVER () AS "VORONOI_CELL"
FROM "STORMWATER"."STORMWATER_VERTICES"
WHERE "COMPONENT" IN (SELECT "COMPONENT" FROM "STORMWATER"."STORMWATER_ALPHASHAPES")) AS V
LEFT JOIN
-- The alpha shapes:
(SELECT "COMPONENT", "ALPHA_SHAPE"
FROM "STORMWATER"."STORMWATER_ALPHASHAPES") AS A
ON V."COMPONENT" = A."COMPONENT" AND V."VORONOI_CELL".ST_Intersects(A."ALPHA_SHAPE") = 1
)
);
-- Persist the voronoi polygons in a separate table
CREATE COLUMN TABLE "STORMWATER"."STORMWATER_VERTICES_COVERED_AREA" (
"ID" NVARCHAR(20), "VORONOI_CELL" ST_GEOMETRY(2193), "AREA_M2" DOUBLE
);
SELECT * FROM "STORMWATER"."V_STORMWATER_VERTICES_COVERED_AREA" INTO "STORMWATER"."STORMWATER_VERTICES_COVERED_AREA";
-- For the calculation of the load later, we just need the catchment area in the vertices table
ALTER TABLE "STORMWATER"."STORMWATER_VERTICES" ADD ("AREA_M2" DOUBLE);
MERGE INTO "STORMWATER"."STORMWATER_VERTICES" AS SV
USING "STORMWATER"."V_STORMWATER_VERTICES_COVERED_AREA" AS CA
ON SV."ID" = CA."ID"
WHEN MATCHED THEN UPDATE SET SV."AREA_M2" = CA."AREA_M2";
/**********************************************/
-- 4 Estimate the poential water load for each network vertex/edge
-- The water load for each vertex/edge depends on the catchment area of all upstream nodes.
-- We'll use a Graph procedure for this.
-- Creat table types first.
CREATE TYPE "STORMWATER"."TT_LOAD_EDGES" AS TABLE (
"ID" INT, "SOURCE" NVARCHAR(20), "TARGET" NVARCHAR(20),
"$LOAD" DOUBLE, "$DIAMETER_M" DOUBLE, "$LOAD_PER_DIAMETER" DOUBLE, "$LOAD_PER_CROSSSECTION" DOUBLE
);
CREATE TYPE "STORMWATER"."TT_LOAD_VERTICES" AS TABLE (
"ID" NVARCHAR(20), "$SUM_COVERED_AREA_M2_UPSTREAM" DOUBLE, "$OUT_DEG" BIGINT
);
-- The Graph procedure
CREATE OR REPLACE PROCEDURE "STORMWATER"."P_CALC_LOAD" (
OUT o_vertices "STORMWATER"."TT_LOAD_VERTICES",
OUT o_edges "STORMWATER"."TT_LOAD_EDGES"
)
LANGUAGE GRAPH READS SQL DATA AS
BEGIN
GRAPH g = Graph("STORMWATER", "STORMWATER");
ALTER g ADD TEMPORARY VERTEX ATTRIBUTE(DOUBLE "$SUM_COVERED_AREA_M2_UPSTREAM"); -- to store the sum of the catchment area of all upstream nodes, same as the load
ALTER g ADD TEMPORARY VERTEX ATTRIBUTE(BIGINT "$OUT_DEG"); -- TO store the number OF outgoing edges
ALTER g ADD TEMPORARY EDGE ATTRIBUTE(DOUBLE "$LOAD"); -- TO store the load provided BY the vertex AND fed INTO this pipe
ALTER g ADD TEMPORARY EDGE ATTRIBUTE(DOUBLE "$LOAD_PER_DIAMETER");
ALTER g ADD TEMPORARY EDGE ATTRIBUTE(DOUBLE "$LOAD_PER_CROSSSECTION");
DOUBLE sum_area_m2 = 0.0;
DOUBLE sum_dia_m = 0.0;
DOUBLE sum_cs_m2 = 0.0;
DOUBLE pipe_load = 0.0;
MULTISET<Edge> ms_e = MULTISET<Edge>(:g);
-- we'll just loop over all vertices
FOREACH v IN Vertices(:g){
sum_area_m2 = 0.0;
sum_dia_m = 0.0;
sum_cs_m2 = 0.0;
v."$OUT_DEG" = OUT_DEGREE(:v);
-- and sum up the area(=load) of all upstream vertices
FOREACH v_upstream IN REACHABLE_VERTICES(:g, :v, 'INCOMING'){
sum_area_m2 = :sum_area_m2 + :v_upstream."AREA_M2";
}
v."$SUM_COVERED_AREA_M2_UPSTREAM" = :sum_area_m2;
-- from each vertex, we will distrubte the load into downstream edges proportially
ms_e = OUT_EDGES(:v);
FOREACH e_out IN :ms_e {
sum_dia_m = :sum_dia_m + :e_out."DIAMETER_M";
sum_cs_m2 = :sum_cs_m2 + (:e_out."DIAMETER_M"*:e_out."DIAMETER_M");
}
FOREACH e_out IN :ms_e {
pipe_load = :sum_area_m2 * ((:e_out."DIAMETER_M" * :e_out."DIAMETER_M") / :sum_cs_m2);
e_out."$LOAD" = :pipe_load;
e_out."$LOAD_PER_DIAMETER" = :pipe_load / :e_out."DIAMETER_M" ;
e_out."$LOAD_PER_CROSSSECTION" = :pipe_load / (:e_out."DIAMETER_M" * :e_out."DIAMETER_M") ;
}
}
o_vertices = SELECT :v."ID", :v."$SUM_COVERED_AREA_M2_UPSTREAM", :v."$OUT_DEG" FOREACH v IN Vertices(:g);
o_edges = SELECT :e."ID", :e."SOURCE", :e."TARGET", :e."$LOAD", :e."DIAMETER_M", :e."$LOAD_PER_DIAMETER", :e."$LOAD_PER_CROSSSECTION" FOREACH e IN Edges(:g);
END;
-- Call the procedure. It returns load information for edges and vertices.
CALL "STORMWATER"."P_CALC_LOAD"(?,?);
-- Next, we need to store the graph procedure's results in the tables.
ALTER TABLE "STORMWATER"."STORMWATER_VERTICES" ADD("SUM_COVERED_AREA_M2_UPSTREAM" DOUBLE);
ALTER TABLE "STORMWATER"."STORMWATER_VERTICES" ADD("OUT_DEG" DOUBLE);
ALTER TABLE "STORMWATER"."STORMWATER_EDGES" ADD("LOAD" DOUBLE);
ALTER TABLE "STORMWATER"."STORMWATER_EDGES" ADD("LOAD_PER_DIAMETER" DOUBLE);
ALTER TABLE "STORMWATER"."STORMWATER_EDGES" ADD("LOAD_PER_CROSSSECTION" DOUBLE);
DO ()
LANGUAGE SQLSCRIPT
BEGIN
CALL "STORMWATER"."P_CALC_LOAD"(o_vertices, o_edges);
MERGE INTO "STORMWATER"."STORMWATER_VERTICES" AS v
USING :o_vertices AS l
ON v."ID" = l."ID"
WHEN MATCHED THEN UPDATE SET v."SUM_COVERED_AREA_M2_UPSTREAM" = l."$SUM_COVERED_AREA_M2_UPSTREAM", v."OUT_DEG" = l."$OUT_DEG";
MERGE INTO "STORMWATER"."STORMWATER_EDGES" AS e
USING :o_edges AS l
ON e."ID" = l."ID"
WHEN MATCHED THEN UPDATE SET e."LOAD" = l."$LOAD", e."LOAD_PER_DIAMETER" = l."$LOAD_PER_DIAMETER", e."LOAD_PER_CROSSSECTION" = l."$LOAD_PER_CROSSSECTION";
END;
-- The edges with the highest risk are the ones with the worst load/crosssection ratio.
SELECT * FROM "STORMWATER"."STORMWATER_EDGES" ORDER BY "LOAD_PER_CROSSSECTION" DESC;
|
INSERT INTO waffle_sample (name, percent, note)
VALUE ('elastic-search', 0, 'How often should we redirect to search/es?');
|
<filename>business_server/src/main/resources/business.sql
/*
Navicat Premium Data Transfer
Source Server : 172.16.17.32_31260
Source Server Type : MySQL
Source Server Version : 80021
Source Host : 172.16.17.32:31260
Source Schema : business
Target Server Type : MySQL
Target Server Version : 80021
File Encoding : 65001
Date: 18/11/2020 15:00:22
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for department
-- ----------------------------
DROP TABLE IF EXISTS `department`;
CREATE TABLE `department` (
`id` int(0) NOT NULL AUTO_INCREMENT,
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门名称',
`parent_id` int(0) NULL DEFAULT NULL,
`dep_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`enabled` tinyint(1) NULL DEFAULT 1,
`is_parent` tinyint(1) NULL DEFAULT 0,
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for employee
-- ----------------------------
DROP TABLE IF EXISTS `employee`;
CREATE TABLE `employee` (
`id` bigint(0) NOT NULL COMMENT '员工编号',
`name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '员工姓名',
`gender` char(4) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别',
`birthday` date NULL DEFAULT NULL COMMENT '出生日期',
`idCard` char(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '身份证号',
`wedlock` enum('已婚','未婚','离异') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '婚姻状况',
`nationId` int(0) NULL DEFAULT NULL COMMENT '民族',
`nativePlace` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '籍贯',
`politicId` int(0) NULL DEFAULT NULL COMMENT '政治面貌',
`email` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话号码',
`address` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系地址',
`departmentId` int(0) NULL DEFAULT NULL COMMENT '所属部门',
`jobLevelId` int(0) NULL DEFAULT NULL COMMENT '职称ID',
`posId` int(0) NULL DEFAULT NULL COMMENT '职位ID',
`engageForm` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '聘用形式',
`tiptopDegree` enum('博士','硕士','本科','大专','高中','初中','小学','其他') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最高学历',
`specialty` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属专业',
`school` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '毕业院校',
`beginDate` date NULL DEFAULT NULL COMMENT '入职日期',
`workState` enum('在职','离职') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '在职' COMMENT '在职状态',
`workID` char(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工号',
`contractTerm` double NULL DEFAULT NULL COMMENT '合同期限',
`conversionTime` date NULL DEFAULT NULL COMMENT '转正日期',
`notWorkDate` date NULL DEFAULT NULL COMMENT '离职日期',
`beginContract` date NULL DEFAULT NULL COMMENT '合同起始日期',
`endContract` date NULL DEFAULT NULL COMMENT '合同终止日期',
`workAge` int(0) NULL DEFAULT NULL COMMENT '工龄',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for menu
-- ----------------------------
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
`id` bigint(0) NOT NULL,
`url` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '请求url',
`path` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '组件路径',
`component` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组件名称',
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单名称',
`icon_cls` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标样式',
`keep_alive` tinyint(1) NULL DEFAULT NULL COMMENT '是否激活',
`require_auth` tinyint(1) NULL DEFAULT NULL COMMENT '权限',
`parent_id` bigint(0) NULL DEFAULT 0 COMMENT '父级菜单',
`enabled` tinyint(1) NULL DEFAULT 1 COMMENT '可用不可用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of menu
-- ----------------------------
INSERT INTO `menu` VALUES (6, '/sys', '/sys', 'Home', '系统管理', 'fa fa-windows', NULL, 1, 0, 1);
INSERT INTO `menu` VALUES (7, '/sys/menu', '/sys/menu', 'Menu', '菜单', 'fa fa-windows', NULL, 1, 6, 1);
INSERT INTO `menu` VALUES (8, '/sys/role', '/sys/role', 'Role', '权限', 'fa fa-windows', NULL, 1, 6, 1);
INSERT INTO `menu` VALUES (9, '/user', '/user', 'Home', '用户管理', 'fa fa-windows', NULL, 1, 0, 1);
INSERT INTO `menu` VALUES (10, '/user/sysUser', '/user/sysUser', 'SysUser', '用户', 'fa fa-windows', NULL, 1, 9, 1);
INSERT INTO `menu` VALUES (11, '/user/department', '/user/department', 'Department', '部门', 'fa fa-windows', NULL, 1, 9, 1);
INSERT INTO `menu` VALUES (12, '/sys/manager', '/sys/manager', 'Manager', '系统管理员', 'fa fa-windows', NULL, 1, 6, 1);
INSERT INTO `menu` VALUES (1327278169165734000, '/sys/emp', '/sys/emp', 'emp', '人员管理', 'cclss', NULL, 1, 0, 1);
INSERT INTO `menu` VALUES (1327650317017317377, '2', '1', '1', '人员', '1', NULL, NULL, 1327278169165734000, 1);
-- ----------------------------
-- Table structure for menu_role
-- ----------------------------
DROP TABLE IF EXISTS `menu_role`;
CREATE TABLE `menu_role` (
`mid` bigint(0) NOT NULL,
`rid` bigint(0) NOT NULL,
PRIMARY KEY (`rid`, `mid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of menu_role
-- ----------------------------
INSERT INTO `menu_role` VALUES (6, 6);
INSERT INTO `menu_role` VALUES (7, 6);
INSERT INTO `menu_role` VALUES (8, 6);
INSERT INTO `menu_role` VALUES (9, 6);
INSERT INTO `menu_role` VALUES (10, 6);
INSERT INTO `menu_role` VALUES (11, 6);
INSERT INTO `menu_role` VALUES (12, 6);
INSERT INTO `menu_role` VALUES (6, 1328035910570336098);
INSERT INTO `menu_role` VALUES (9, 1328035910570336098);
INSERT INTO `menu_role` VALUES (10, 1328035910570336098);
INSERT INTO `menu_role` VALUES (12, 1328035910570336098);
INSERT INTO `menu_role` VALUES (0, 1328047084242857985);
INSERT INTO `menu_role` VALUES (6, 1328047084242857985);
INSERT INTO `menu_role` VALUES (9, 1328047084242857985);
INSERT INTO `menu_role` VALUES (10, 1328047084242857985);
INSERT INTO `menu_role` VALUES (1327278169165734000, 1328047084242857985);
INSERT INTO `menu_role` VALUES (1327650317017317377, 1328047084242857985);
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`id` bigint(0) NOT NULL,
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`nameZh` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名称',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`group_id` bigint(0) NULL DEFAULT NULL COMMENT '组id',
`super_admin` tinyint(0) NULL DEFAULT 0 COMMENT '管理员',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES (6, 'super_admin', '超级管理员', NULL, '0', '0', '2020-11-18 13:39:14', NULL, 1);
INSERT INTO `role` VALUES (1328035910570336098, 'admin', '普通管理员', NULL, '0', '0', '2020-11-18 13:39:19', NULL, 1);
INSERT INTO `role` VALUES (1328047084242857985, 'user', '普通用户', NULL, '0', '0', '2020-11-18 14:08:51', NULL, 0);
-- ----------------------------
-- Table structure for role_group
-- ----------------------------
DROP TABLE IF EXISTS `role_group`;
CREATE TABLE `role_group` (
`id` bigint(0) NOT NULL COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限组名字',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sys_group
-- ----------------------------
DROP TABLE IF EXISTS `sys_group`;
CREATE TABLE `sys_group` (
`id` int(0) NOT NULL AUTO_INCREMENT,
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门名称',
`parent_id` int(0) NULL DEFAULT NULL,
`dep_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`enabled` tinyint(1) NULL DEFAULT 1,
`is_parent` tinyint(1) NULL DEFAULT 0,
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 104 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of sys_group
-- ----------------------------
INSERT INTO `sys_group` VALUES (1, '超级管理员', 0, '.1', 1, 1, '', '0', '0', '2020-11-07 23:58:41');
INSERT INTO `sys_group` VALUES (2, '普通管理员', 1, '.1.2', 1, 1, NULL, '1', '0', '2020-11-12 11:12:57');
INSERT INTO `sys_group` VALUES (3, '总公司管理', 1, '.1.3', 1, 1, NULL, '0', '0', '2020-11-08 00:57:16');
INSERT INTO `sys_group` VALUES (93, '一级管理', 2, '.1.2.93', 1, 0, NULL, '1', '2020-11-06 23:34:16', '2020-11-12 10:56:00');
INSERT INTO `sys_group` VALUES (94, '二级管理', 2, '.1.2.94', 1, 1, NULL, '1', '2020-11-06 23:36:40', '2020-11-12 11:12:57');
INSERT INTO `sys_group` VALUES (95, '1312', 1, '.1.95', 1, 1, NULL, '1', '2020-11-08 00:56:01', '2020-11-08 00:56:33');
INSERT INTO `sys_group` VALUES (96, '12312', 95, '.1.95.96', 1, 0, NULL, '1', '2020-11-08 00:56:25', '2020-11-08 00:56:31');
INSERT INTO `sys_group` VALUES (97, '公司管理', 3, '.1.3.97', 1, 1, NULL, '0', '2020-11-08 00:57:16', '2020-11-12 11:13:36');
INSERT INTO `sys_group` VALUES (98, '小组管理', 94, '.172.16.31.10', 1, 0, NULL, '0', '2020-11-08 00:59:50', '2020-11-08 00:59:50');
INSERT INTO `sys_group` VALUES (99, NULL, 94, '.172.16.31.10', 1, 0, NULL, '1', '2020-11-08 12:48:54', '2020-11-08 12:49:06');
INSERT INTO `sys_group` VALUES (100, NULL, 94, '.172.16.17.32', 1, 0, NULL, '1', '2020-11-08 12:48:57', '2020-11-08 12:49:09');
INSERT INTO `sys_group` VALUES (101, '团队管理', 1, '.1.101', 1, 0, NULL, '1', '2020-11-12 11:13:19', '2020-11-12 11:13:26');
INSERT INTO `sys_group` VALUES (102, '团队管理', 97, '.1.3.97.102', 1, 0, NULL, '0', '2020-11-12 11:13:36', '2020-11-12 11:13:36');
INSERT INTO `sys_group` VALUES (103, NULL, 97, '.1.3.97.103', 1, 0, NULL, '1', '2020-11-12 11:17:14', '2020-11-12 11:17:19');
-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` bigint(0) NOT NULL COMMENT 'hrID',
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
`phone` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码',
`telephone` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '住宅电话',
`address` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系地址',
`enabled` tinyint(1) NULL DEFAULT 1,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
`userface` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`remove_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '删除状态 0-未删除 1-已删除',
`create_at` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_at` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`group_id` int(0) NOT NULL COMMENT '分组id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user_info
-- ----------------------------
INSERT INTO `user_info` VALUES (12312341213123, '系统管理员', '18568887789', '029-82881234', '深圳南山', 1, 'admin12', '123', 'http://47.113.206.36:8098/2020/11/17/20/1328678212783443968_exc.png', 'ces', '0', '0', '2020-11-17 23:47:53', 1);
INSERT INTO `user_info` VALUES (12312341243123, '系统管理员', '18568887789', '029-82881234', '深圳南山', 1, 'admin', 'admin123', 'http://thirdwx.qlogo.cn/mmopen/icGs6iaDL9HHcibh7DLgu4b1CCD9Cnfa5VIqibgHC66tN6hrJSo4noK73GZlyruDbicaD4EK6UQuc8ibOdMyE1rKA1YNdO7pWkZBics/132', 'ces', '0', '0', '2020-11-17 23:45:56', 1);
INSERT INTO `user_info` VALUES (123123411213123, '系统管理员', '18568887789', '029-82881234', '深圳南山', 1, 'admin12', '123', 'http://47.113.206.36:8098/2020/11/17/20/1328681351645368320_qq.png', 'ces', '0', '0', '2020-11-17 23:48:33', 1);
INSERT INTO `user_info` VALUES (1328588848588394498, '张三', '18568887789', '21', '江西宜春', 1, 'test', 'test', 'http://47.113.206.36:8098/2020/11/17/20/1328679906351124480_phone.png', NULL, '0', '0', '2020-11-17 23:46:31', 3);
INSERT INTO `user_info` VALUES (1328722223199977473, '张三', '123', '123', '123', 1, '123', '1', 'http://172.16.17.32:8098/2020/11/18/00/1328736682836627456_login_bg.1161fa5f.png', NULL, '0', '0', '2020-11-18 00:28:07', 102);
-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
`user_id` bigint(0) NOT NULL,
`rid` bigint(0) NOT NULL,
PRIMARY KEY (`user_id`, `rid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user_role
-- ----------------------------
INSERT INTO `user_role` VALUES (12312341213123, 1328035910570336098);
INSERT INTO `user_role` VALUES (12312341243123, 6);
INSERT INTO `user_role` VALUES (12312341243123, 1328035910570336098);
INSERT INTO `user_role` VALUES (1328588848588394498, 1328035910570336098);
INSERT INTO `user_role` VALUES (1328722223199977473, 1328047084242857985);
SET FOREIGN_KEY_CHECKS = 1;
|
<reponame>moldovanpaul75/city-building-education
DROP DATABASE IF EXISTS city_building;
CREATE DATABASE IF NOT EXISTS city_building;
USE city_building;
CREATE TABLE IF NOT EXISTS city(
cityId INT NOT NULL AUTO_INCREMENT,
cityName VARCHAR(150) NOT NULL,
lat FLOAT(10,6) NOT NULL,
lon FLOAT(10,6) NOT NULL,
PRIMARY KEY(cityId)
);
CREATE TABLE IF NOT EXISTS district(
districtId INT NOT NULL AUTO_INCREMENT,
cityId INT NOT NULL,
districtName VARCHAR(150) NOT NULL,
xStart INT NOT NULL,
xEnd INT NOT NULL,
yStart INT NOT NULL,
yEnd INT NOT NULL,
PRIMARY KEY(districtId),
FOREIGN KEY (cityId) REFERENCES city(cityId)
);
CREATE TABLE IF NOT EXISTS layerType(
layerId INT NOT NULL AUTO_INCREMENT,
layerName VARCHAR(30) NOT NULL,
PRIMARY KEY(layerId)
);
CREATE TABLE IF NOT EXISTS tileType(
tileTypeId INT NOT NULL AUTO_INCREMENT,
layerId INT NOT NULL,
tileName VARCHAR(30) NOT NULL,
rating INT NOT NULL,
iconPath VARCHAR(100) NOT NULL,
PRIMARY KEY(tileTypeId),
FOREIGN KEY (layerId) REFERENCES layerType(layerId)
);
CREATE TABLE IF NOT EXISTS contact(
contactId INT NOT NULL AUTO_INCREMENT,
telephoneNb INT NOT NULL,
email VARCHAR(30) NOT NULL,
PRIMARY KEY(contactId)
);
CREATE TABLE IF NOT EXISTS address(
addressId INT NOT NULL AUTO_INCREMENT,
district INT NOT NULL,
street VARCHAR(100) NOT NULL,
PRIMARY KEY(addressId),
FOREIGN KEY (district) REFERENCES district(districtId)
);
CREATE TABLE IF NOT EXISTS info(
infoId INT NOT NULL AUTO_INCREMENT,
capacity INT NOT NULL,
availability INT NOT NULL,
address INT NOT NULL,
contact INT NOT NULL,
PRIMARY KEY(infoId),
FOREIGN KEY (contact) REFERENCES contact(contactId),
FOREIGN KEY (address) REFERENCES address(addressId)
);
CREATE TABLE IF NOT EXISTS tile(
tileId INT NOT NULL AUTO_INCREMENT,
tileType INT NOT NULL,
tileInfo INT NULL,
xCoord INT NOT NULL,
yCoord INT NOT NULL,
PRIMARY KEY(tileId),
FOREIGN KEY (tileType) REFERENCES tileType(tileTypeId),
FOREIGN KEY (tileInfo) REFERENCES info(infoId)
);
INSERT INTO layerType(layerName) VALUES ('land layer');
INSERT INTO layerType(layerName) VALUES ('hydro layer');
INSERT INTO layerType(layerName) VALUES ('places layer');
INSERT INTO tileType(layerId, tileName, rating, iconPath) VALUES (1, 'grass', 5, 'img/grass.png');
INSERT INTO tileType(layerId, tileName, rating, iconPath) VALUES (2, 'river', 6, 'img/river.png');
INSERT INTO tileType(layerId, tileName, rating, iconPath) VALUES (2, 'sea', 3, 'img/sea.png');
INSERT INTO tileType(layerId, tileName, rating, iconPath) VALUES (3, 'house', 3, 'img/house1.png');
INSERT INTO city(cityName, lat, lon) VALUES ('city1', 17.3, 9.3);
INSERT INTO city(cityName, lat, lon) VALUES ('city2', 3.2, -73.5);
INSERT INTO district(cityId, districtName, xStart, xEnd, yStart, yEnd) VALUES (1, 'district1', 2, 8, 3, 8);
INSERT INTO district(cityId, districtName, xStart, xEnd, yStart, yEnd) VALUES (2, 'district2', 13, 18, 12, 19);
INSERT INTO address(district, street) VALUES (1, 'street1 nb100');
INSERT INTO address(district, street) VALUES (2, 'street2 nb203');
INSERT INTO contact(telephoneNb, email) VALUES (03495, '<EMAIL>');
INSERT INTO contact(telephoneNb, email) VALUES (06445, '<EMAIL>');
INSERT INTO info(capacity, availability, address, contact) VALUES (5, 9, 1, 1);
INSERT INTO info(capacity, availability, address, contact) VALUES (5, 9, 2, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (2, 0, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 1, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 2, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 3, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 4, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 5);
INSERT INTO tile(tileType, tileInfo, xCoord, yCoord) VALUES (4, 1, 5, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 5, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 6, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 7, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 8, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 9, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 10, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 11, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 12, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 13, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 14, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 15, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 14);
INSERT INTO tile(tileType, tileInfo, xCoord, yCoord) VALUES (4, 2, 16, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 16, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 17, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (1, 18, 19);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 0);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 1);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 2);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 3);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 4);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 5);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 6);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 7);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 8);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 9);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 10);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 11);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 12);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 13);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 14);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 15);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 16);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 17);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 18);
INSERT INTO tile(tileType, xCoord, yCoord) VALUES (3, 19, 19); |
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 18, 2020 at 11:09 AM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `qlyphonghop2`
--
-- --------------------------------------------------------
--
-- Table structure for table `cuochop`
--
CREATE TABLE `cuochop` (
`id` int(11) NOT NULL,
`tencuochop` int(11) NOT NULL,
`noidungcuochop` varchar(10000) COLLATE utf8_unicode_ci NOT NULL,
`trangthai` int(11) NOT NULL,
`noidungtongket` varchar(10000) COLLATE utf8_unicode_ci NOT NULL,
`idphong` int(11) NOT NULL,
`idfiledinhkem` int(11) NOT NULL,
`thoigianbatdau` datetime NOT NULL,
`thoigianketthuc` datetime NOT NULL,
`idlichtrinh` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `file`
--
CREATE TABLE `file` (
`id` int(11) NOT NULL,
`tenfile` int(11) NOT NULL,
`linkfile` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `lichtrinh.vue`
--
CREATE TABLE `lichtrinh` (
`id` int(11) NOT NULL,
`idphong` int(11) NOT NULL,
`idnguoidat` int(11) NOT NULL,
`thoigianbatdau` datetime NOT NULL,
`thoigianketthuc` datetime NOT NULL,
`loailichtrinh` int(11) NOT NULL,
`trangthai` int(11) NOT NULL COMMENT 'trạng thái lịch trình'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `phonghop`
--
CREATE TABLE `phonghop` (
`id` int(11) NOT NULL,
`ten_phong` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`mo_ta` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`trang_thai` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `phonghop`
--
INSERT INTO `phonghop` (`id`, `ten_phong`, `mo_ta`, `trang_thai`, `created_at`, `updated_at`) VALUES
(3, 'phòng 2', 'đây là phòng 2', 'Rảnh', '2020-04-15 19:35:39', '2020-04-15 19:35:39'),
(4, 'Phòng 3', 'Đây là phòng 3', 'Rảnh', '2020-04-15 19:39:11', '2020-04-15 12:39:11');
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
CREATE TABLE `settings` (
`id` int(10) UNSIGNED NOT NULL,
`option` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `tests`
--
CREATE TABLE `tests` (
`id` int(11) NOT NULL,
`hoTen` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`moTa` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `thanhvien`
--
CREATE TABLE `thanhvien` (
`id` int(11) NOT NULL,
`email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`id_cuochop` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `thongbao`
--
CREATE TABLE `thongbao` (
`id` int(11) NOT NULL,
`tieude` int(11) NOT NULL,
`noidung` int(11) NOT NULL,
`userid` int(11) NOT NULL,
`loaithongbao` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`role` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'user',
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `role`, `remember_token`, `created_at`, `updated_at`) VALUES
(5, '<NAME>', '<EMAIL>', <PASSWORD>', 'user', NULL, '2020-03-25 09:59:43', '2020-03-29 11:57:27'),
(10, '3AE Shop', '<EMAIL>', <PASSWORD>', 'user', NULL, '2020-03-25 10:20:15', '2020-03-25 10:20:15'),
(11, '<NAME>2', '<EMAIL>', '$2y$10$m4iO7xmrsISmN5IwueTJzeePHafXpFxbkHUK5kw8h23v.fcZfH/sy', 'user', NULL, '2020-03-25 10:21:27', '2020-03-25 10:21:27'),
(14, 'Đoàn <NAME>ống222', '<EMAIL>', '$2y$10$5KjC730NDrTYZxjEOJLKuOSB7IIDR.c0A3.UNc4BcpOREOEbfg/7.', 'user', NULL, '2020-03-25 10:24:37', '2020-03-25 10:24:37'),
(15, 'Đoàn <NAME>ống222', '<EMAIL>', '$2y$10$5KjC730NDrTYZxjEOJLKuOSB7IIDR.c0A3.UNc4BcpOREOEbfg/7.', 'user', '', '2020-03-25 10:24:37', '2020-03-25 10:24:37'),
(16, '<NAME>', '<EMAIL>', '$2y$10$Ty7oCPZCWeZSoLbEXeBEPelV19qwFBVXfZbYcqkn1kLjxcTkjSVc2', 'admin', '', '2020-03-17 08:57:43', '2020-03-17 08:57:43'),
(17, 'Đ<NAME>', '<EMAIL>', '$2y$10$754GVeBX1RvnJVQI.naDFeFBqNIO2xplML1EhMZ0k6pgc16IAveQi', 'user', '', '2020-03-25 09:59:43', '2020-03-25 09:59:43'),
(18, '3AE Shop', '<EMAIL>', '$2y$10$DzISZZr9Ypezw.HS./x3K.az/2ELSHI2rsEErZfe8/ZTYRmN8Ypai', 'user', '', '2020-03-25 10:15:43', '2020-03-25 10:15:43'),
(19, '3AE Shop', '<EMAIL>', '$2y$10$o12juS7CLmgh5X61Jel0CuwtBSjqJAzq/RYJNrq.1pcuI0n6rJ4j2', 'user', '', '2020-03-25 10:20:15', '2020-03-25 10:20:15'),
(20, 'NGUYỄN VĂN THIỆN222', '<EMAIL>', '$2y$10$m4iO7xmrsISmN5IwueTJzeePHafXpFxbkHUK5kw8h23v.fcZfH/sy', 'user', '', '2020-03-25 10:21:27', '2020-03-25 10:21:27'),
(21, 'Đoàn Cảnh Thống222', '<EMAIL>', '$2y$10$5KjC730NDrTYZxjEOJLKuOSB7IIDR.c0A3.UNc4BcpOREOEbfg/7.', 'user', '', '2020-03-25 10:24:37', '2020-03-25 10:24:37'),
(22, '<NAME>', '<EMAIL>', '$2y$10$5KjC730NDrTYZxjEOJLKuOSB7IIDR.c0A3.UNc4BcpOREOEbfg/7.', 'user', '', '2020-03-25 10:24:37', '2020-03-25 10:24:37'),
(23, 'Người dùng 1', '<EMAIL>', '$2y$10$hd4P2ycs4QnDQ9wDox2Xxun4tzqEh7BLDPzWjuExaZck6ItRoICbm', 'user', NULL, '2020-03-28 05:25:33', '2020-03-28 05:25:33'),
(24, 'ng<NAME>1', '<EMAIL>', '$2y$10$QnG5Be6PpYll6IHvyetmi.NKHemQOo.KJ3/I/TtK4ZqJuQleWS3Xe', 'user', NULL, '2020-03-29 10:44:45', '2020-03-29 10:45:54'),
(25, 'aaaaaaaaa', '<EMAIL>', '$2y$10$WG3Rq7/Bsx5//92buYnPIeVUGEXYrnjQslON72/7UQcpb8jhAWqo6', 'user', NULL, '2020-04-15 11:27:28', '2020-04-15 11:27:28');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cuochop`
--
ALTER TABLE `cuochop`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_CUOCHOP_PHONGHOP` (`idphong`),
ADD KEY `FK_FILE` (`idfiledinhkem`);
--
-- Indexes for table `file`
--
ALTER TABLE `file`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `lichtrinh.vue`
--
ALTER TABLE `lichtrinh`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_PHONGHOP_LT` (`idphong`),
ADD KEY `FK_USER` (`idnguoidat`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `phonghop`
--
ALTER TABLE `phonghop`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `tests`
--
ALTER TABLE `tests`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `thanhvien`
--
ALTER TABLE `thanhvien`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_CUOCHOP` (`id_cuochop`);
--
-- Indexes for table `thongbao`
--
ALTER TABLE `thongbao`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_USER_TB` (`userid`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `cuochop`
--
ALTER TABLE `cuochop`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `file`
--
ALTER TABLE `file`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `lichtrinh.vue`
--
ALTER TABLE `lichtrinh`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `phonghop`
--
ALTER TABLE `phonghop`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tests`
--
ALTER TABLE `tests`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `thanhvien`
--
ALTER TABLE `thanhvien`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `thongbao`
--
ALTER TABLE `thongbao`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `cuochop`
--
ALTER TABLE `cuochop`
ADD CONSTRAINT `FK_CUOCHOP_PHONGHOP` FOREIGN KEY (`idphong`) REFERENCES `phonghop` (`id`),
ADD CONSTRAINT `FK_FILE` FOREIGN KEY (`idfiledinhkem`) REFERENCES `file` (`id`);
--
-- Constraints for table `lichtrinh.vue`
--
ALTER TABLE `lichtrinh`
ADD CONSTRAINT `FK_PHONGHOP_LT` FOREIGN KEY (`idphong`) REFERENCES `phonghop` (`id`),
ADD CONSTRAINT `FK_USER` FOREIGN KEY (`idnguoidat`) REFERENCES `users` (`id`);
--
-- Constraints for table `thanhvien`
--
ALTER TABLE `thanhvien`
ADD CONSTRAINT `FK_CUOCHOP` FOREIGN KEY (`id_cuochop`) REFERENCES `cuochop` (`id`);
--
-- Constraints for table `thongbao`
--
ALTER TABLE `thongbao`
ADD CONSTRAINT `FK_USER_TB` FOREIGN KEY (`userid`) REFERENCES `users` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
ALTER TABLE [dbo].[CostShareRecordEntries]
ADD CONSTRAINT [FK_CostShareRecordEntries_Entries] FOREIGN KEY ([ID]) REFERENCES [dbo].[Entries] ([ID]) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
<gh_stars>0
-- credentials and database name should be changes for production instances
-- this following scripts should be run separately from the DB table and DATA scripts as ROOT
create database cp default character set utf8 default collate utf8_general_ci;
create user cp;
grant all on cp.* to cp@localhost identified by 'cp';
-- tables and database scripts
-- should be run as the user created from the above step
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+05:00";
SET names utf8;
--
-- Table structure for table `ads`
--
CREATE TABLE IF NOT EXISTS `ads` (
`ad_id` int(11) NOT NULL AUTO_INCREMENT,
`ad_name` varchar(50) DEFAULT NULL,
`img_url` varchar(100) DEFAULT NULL,
`ad_url` varchar(100) DEFAULT NULL,
`impressions` int(11) DEFAULT '0',
`clicks` int(11) DEFAULT '0',
`position` varchar(5) DEFAULT NULL,
`pick_id` int(11) DEFAULT '0',
`category_id` int(11) DEFAULT '0',
`ad_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`display` char(1) COLLATE utf8_german2_ci NOT NULL DEFAULT 'Y',
PRIMARY KEY (`ad_id`),
KEY `on_impression` (`impressions`),
KEY `on_clicks` (`clicks`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `ads`
--
INSERT INTO `ads` (`ad_id`, `ad_name`, `img_url`, `ad_url`, `impressions`, `clicks`, `position`, `pick_id`, `category_id`, `ad_date`, `display`) VALUES
(1, 'Disney Preschool', 'images/ads/disney_preschool.jpg', 'http://disney.go.com/preschool/', 116755, 887, 'R1', 1, 1, '2017-12-22 20:46:53', 'Y'),
(2, '<NAME>', 'images/ads/nickjr_kids.jpg', 'http://www.nickjr.com/kids/', 116694, 803, 'R2', 2, 1, '2017-12-22 20:46:53', 'Y'),
(3, 'Treehouse TV', 'images/ads/treehouse.jpg', 'http://www.treehousetv.com/', 233301, 1126, 'R3', 3, 1, '2017-12-22 20:46:53', 'Y'),
(4, 'Kids'' CBC', 'images/ads/kids_cbc.jpg', 'http://www.cbc.ca/kidscbc/', 123011, 907, 'L1', 5, 1, '2017-12-22 19:41:02', 'Y'),
(5, 'PBS Kids', 'images/ads/pbs_kids.jpg', 'http://www.pbskids.org/', 119748, 868, 'L2', 4, 1, '2017-12-22 20:46:53', 'Y'),
(6, 'Webkinz World', 'images/ads/webkinz.jpg', 'http://www.webkinz.com/', 117802, 859, 'L3', 7, 1, '2017-12-22 20:46:53', 'Y'),
(7, 'Webkinz World', 'images/ads/webkinz.jpg', 'http://www.webkinz.com/', 32494, 431, 'R3', 20, 2, '2017-12-22 23:19:02', 'Y'),
(8, 'AppleStore', 'images/ads/apple.jpg', 'http://store.apple.com', 13797, 504, 'R1', 32, 3, '2017-12-22 14:19:44', 'Y'),
(9, 'Disney', 'images/ads/disney.jpg', 'http://www.disney.com', 32494, 450, 'R1', 29, 2, '2017-12-22 23:19:02', 'Y'),
(10, 'Facebook', 'images/ads/facebook.jpg', 'http://www.facebook.com', 32494, 497, 'R2', 18, 2, '2017-12-22 23:19:02', 'Y'),
(11, 'Facebook', 'images/ads/facebook.jpg', 'http://www.facebook.com', 13797, 474, 'R2', 24, 3, '2017-12-22 14:19:03', 'Y'),
(12, 'YouTube', 'images/ads/youtube.jpg', 'http://www.youtube.com', 16248, 420, 'L1', 19, 2, '2017-12-22 23:19:02', 'Y'),
(13, 'YouTube', 'images/ads/youtube.jpg', 'http://www.youtube.com', 13812, 486, 'L1', 25, 3, '2017-12-22 14:19:03', 'Y'),
(14, 'Barbie', 'images/ads/barbie.jpg', 'http://www.barbie.com', 32494, 523, 'L2', 16, 2, '2017-12-22 23:19:02', 'Y'),
(15, 'Barbie', 'images/ads/barbie.jpg', 'http://www.barbie.com', 119747, 984, 'L2', 22, 1, '2017-12-22 19:41:02', 'Y'),
(16, 'Rainbow Magic', 'images/ads/rainbowmagic.jpg', 'http://www.rainbowmagiconline.com', 123011, 890, 'L1', 9, 1, '2017-12-22 20:46:53', 'Y'),
(17, 'Rainbow Magic', 'images/ads/rainbowmagic.jpg', 'http://www.rainbowmagiconline.com', 16247, 416, 'L1', 21, 2, '2017-12-22 23:18:56', 'Y'),
(18, 'Polly Pocket', 'images/ads/pollypocket.jpg', 'http://www.pollypocket.com', 117801, 933, 'L3', 23, 1, '2017-12-22 19:41:02', 'Y'),
(19, 'Polly Pocket', 'images/ads/pollypocket.jpg', 'http://www.pollypocket.com', 32494, 439, 'L3', 17, 2, '2017-12-22 23:19:02', 'Y'),
(20, 'Twitter', 'images/ads/twitter.jpg', 'http://www.twitter.com', 13812, 544, 'L2', 26, 3, '2017-12-22 14:19:03', 'Y'),
(21, 'TVO Kids', 'images/ads/tvokids.jpg', 'http://www.tvokids.com', 116693, 1220, 'R2', 12, 1, '2017-12-22 19:41:02', 'Y'),
(22, 'Wiggle Time', 'images/ads/wiggletime.jpg', 'http://www.wiggletime.com/public/home.aspx/', 116754, 822, 'R1', 10, 1, '2017-12-22 19:41:02', 'Y'),
(23, 'Picnik', 'images/ads/picnik.jpg', 'http://www.picnik.com', 13797, 455, 'R3', 30, 3, '2017-12-22 14:19:03', 'Y'),
(24, 'DJBooth', 'images/ads/djbooth.jpg', 'http://www.djbooth.net', 6923, 413, 'L3', 28, 3, '2017-12-22 14:19:03', 'Y'),
(25, 'GrooveShark', 'images/ads/grooveshark.jpg', 'http://listen.grooveshark.com', 6922, 454, 'L3', 27, 3, '2017-12-22 14:16:14', 'Y');
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE IF NOT EXISTS `categories` (
`category_id` int(11) NOT NULL AUTO_INCREMENT,
`category_name` varchar(50) DEFAULT NULL,
`category_desc` varchar(100) DEFAULT NULL,
PRIMARY KEY (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `categories`
--
INSERT INTO `categories` (`category_id`, `category_name`, `category_desc`) VALUES
(1, 'kids', 'A central jump-point for kid-safe websites'),
(2, 'youths', 'A central jump-point for youth-safe websites'),
(3, 'teens', 'A central jump-point for teen-safe websites'),
(4, 'adult', NULL),
(5, 'seniors', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`pick_id` int(11) DEFAULT NULL,
`review` varchar(512) NOT NULL,
`name` varchar(64) DEFAULT NULL,
`city` varchar(64) DEFAULT NULL,
`country` varchar(64) DEFAULT NULL,
`cdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`recommended` char(1) DEFAULT 'Y',
`approved` char(1) DEFAULT 'N',
PRIMARY KEY (`comment_id`),
KEY `on_date` (`cdate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`comment_id`, `pick_id`, `review`, `name`, `city`, `country`, `cdate`, `recommended`, `approved`) VALUES
(1, 37, 'This is a great site for kids to learn while having fun. This site is recommended by the public school board of Ontario.', 'anonymous', 'not provided', 'not provided', '2010-10-04 04:12:40', 'Y', 'Y'),
(3, 6, 'I want playskoolkids to come back this year.\r\nI miss that website. It will be back this winter.\r\nIt is my favorite hasbro website featuring Digger the Dog, Kitty Kandu, Go-Go Dino and Tubby Turtle.\r\nMy favorite playskool characters are Digger the Dog, Kitty Kandu, Go-Go Dino and Tubby Turtle.\r\n\r\n', 'Mason', 'Crystal Lake', 'United States', '2011-07-29 05:09:05', 'Y', 'Y'),
(10, 6, 'Hasbro, can you bring back old Hasbro websites from 2005-2010, including Playskoolkids, please?', 'Mason', 'Crystal Lake', 'United States', '2017-01-10 18:11:33', 'Y', 'Y');
-- --------------------------------------------------------
--
-- Table structure for table `picks`
--
CREATE TABLE IF NOT EXISTS `picks` (
`pick_id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) DEFAULT '0',
`url` varchar(128) NOT NULL,
`title` varchar(50) NOT NULL,
`desc` varchar(512) DEFAULT NULL,
`clicks` int(11) DEFAULT '0',
`comments` int(11) DEFAULT '0',
`positive` int(11) DEFAULT '0',
`negative` int(11) DEFAULT '0',
`reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`approved` char(1) NOT NULL DEFAULT 'N',
`thumb_img` varchar(100) DEFAULT NULL,
PRIMARY KEY (`pick_id`),
KEY `on_category` (`category_id`),
KEY `on_clicks` (`clicks`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `picks`
--
INSERT INTO `picks` (`pick_id`, `category_id`, `url`, `title`, `desc`, `clicks`, `comments`, `positive`, `negative`, `reg_date`, `approved`, `thumb_img`) VALUES
(1, 1, 'http://disney.go.com/preschool/', 'Disney Preschool', 'Games, activities, music and videos for you child with the magic of Disney.', 2155, 0, 0, 0, '2017-12-22 09:27:39', 'Y', 'images/thumbs/disney_preschool_thumb.jpg'),
(2, 1, 'http://www.nickjr.com/kids/', '<NAME>.', 'Play games, see videos and do activities with all your favourite kid-tv characters.', 1978, 0, 0, 0, '2017-12-22 14:16:33', 'Y', 'images/thumbs/nickjr_thumb.jpg'),
(3, 1, 'http://www.treehousetv.com/', 'Treehouse', 'You're playing games, colouring and watching videos from all your favourite characters from Treehouse tv.', 2488, 0, 0, 0, '2017-12-22 09:27:42', 'Y', 'images/thumbs/treehouse_thumb.jpg'),
(4, 1, 'http://www.pbskids.org/', 'PBS Kids', 'Educational games videos and activities for kids with all your favourite PBS Kids characters.', 2012, 0, 0, 0, '2017-12-22 09:27:31', 'Y', 'images/thumbs/pbskids_thumb.jpg'),
(5, 1, 'http://www.cbc.ca/kidscbc/', 'Kids'' CBC', 'Fun interactive games, activities and videos with your favourite Kids''CBC morning characters.', 1961, 1, 1, 0, '2017-12-22 09:27:30', 'Y', 'images/thumbs/cbckids_thumb.jpg'),
(6, 1, 'http://kids.hasbro.com/playskoolkids/', 'Hasbro PlaySkoolKids', 'Play with Hasbro toys online with interactive and educational games.', 1164, 3, 3, 0, '2017-12-22 09:27:36', 'Y', 'images/thumbs/hasbro_thumb.jpg'),
(7, 1, 'http://www.webkinz.com/', 'Webkinz World', 'Adopt your Webkinz pet - then play, care-for and build their home in this interactive world.', 2128, 0, 0, 0, '2017-12-22 09:27:34', 'Y', 'images/thumbs/webkinz_thumb.jpg'),
(8, 1, 'http://www.buildabear.com/', 'Build-A-Bear', 'The same fun as the Build-A-Bear Workshop stores, but with online interactive games.', 990, 0, 0, 0, '2017-12-22 09:27:26', 'Y', 'images/thumbs/buildabear_thumb.jpg'),
(9, 1, 'http://www.rainbowmagiconline.com/', 'Rainbow Magic', 'Games, activities and printables with your favourite fairies from the Rainbow Magic collection.', 1960, 0, 0, 0, '2017-12-20 04:50:21', 'Y', 'images/thumbs/rainbowmagic_thumb.jpg'),
(10, 1, 'http://www.wiggletime.com/public/home.aspx/', 'Wiggle Time', 'Play games, do activities and learn online with The Wiggles!', 1840, 0, 0, 0, '2017-12-21 07:59:50', 'Y', 'images/thumbs/wiggletime_thumb.jpg'),
(11, 1, 'http://www.wordworld.com/', 'Word World', 'Interactive learning through games from Word World - where words come alive.', 965, 0, 0, 0, '2017-12-20 04:49:52', 'Y', 'images/thumbs/wordworld_thumb.jpg'),
(12, 1, 'http://www.tvokids.com/', 'TVO Kids', 'Educational games and activities with all your favourite characters from TVO Kids morning shows.', 2409, 0, 0, 0, '2017-12-22 09:27:48', 'Y', 'images/thumbs/tvokids_thumb.jpg'),
(15, 1, 'http://www.jimjam.tv', 'JIMJAM', 'Play games and do online activities with your favorite characters from JimJam TV.', 1033, 0, 0, 0, '2017-12-20 04:49:37', 'Y', 'images/thumbs/jimjam_thumb.jpg'),
(16, 2, 'http://www.barbie.com', 'Barbie', 'Play games, watch videos and more with Barbie and her friends.', 1111, 0, 0, 0, '2017-12-20 04:50:42', 'Y', 'images/thumbs/barbie_thumb.jpg'),
(17, 2, 'http://www.pollypocket.com', 'PollyPocket', 'Lots of fun things to do in PollyWorld. Lots of interactive games and activities with Polly and her friends.', 959, 0, 0, 0, '2017-12-22 14:20:40', 'Y', 'images/thumbs/pollypocket_thumb.jpg'),
(18, 2, 'http://www.facebook.com', 'Facebook', 'Connect with your friends online; chat, play games, post pictures. Tell everyone what you're up to.', 1065, 0, 0, 0, '2017-12-20 04:52:32', 'Y', 'images/thumbs/facebook_thumb.jpg'),
(19, 2, 'http://www.youtube.com', 'YouTube', 'View videos of just about anything and post some of your own if you're so inclined.', 986, 0, 0, 0, '2017-12-21 21:10:20', 'Y', 'images/thumbs/youtube_thumb.jpg'),
(20, 2, 'http://www.webkinz.com/', 'Webkinz World', 'Adopt your Webkinz pet - then play, care-for and build their home in this interactive world.', 938, 0, 0, 0, '2017-12-22 14:16:59', 'Y', 'images/thumbs/webkinz_thumb.jpg'),
(21, 2, 'http://www.rainbowmagiconline.com/', 'Rainbow Magic', 'Games, activities and printables with your favorite fairies from the Rainbow Magic collection.', 926, 0, 0, 0, '2017-12-20 04:53:37', 'Y', 'images/thumbs/rainbowmagic_thumb.jpg'),
(22, 1, 'http://www.barbie.com', 'Barbie', 'Play games, watch videos and more with Barbie and her friends.', 2288, 0, 0, 0, '2017-12-22 09:27:55', 'Y', 'images/thumbs/barbie_thumb.jpg'),
(23, 1, 'http://www.pollypocket.com', 'PollyPocket', 'Lots of fun things to do in PollyWorld. Lots of interactive games and activities with Polly and her friends.', 2105, 0, 0, 0, '2017-12-22 09:27:50', 'Y', 'images/thumbs/pollypocket_thumb.jpg'),
(24, 3, 'http://www.facebook.com', 'Facebook', 'Connect with your friends online; chat, play games, post pictures. Tell everyone what you\\'re up to.', 1018, 0, 0, 0, '2017-12-22 14:19:23', 'Y', 'images/thumbs/facebook_thumb.jpg'),
(25, 3, 'http://www.youtube.com', 'YouTube', 'View videos of just about anything and post some of your own if you're so inclined.', 997, 0, 0, 0, '2017-12-22 14:15:03', 'Y', 'images/thumbs/youtube_thumb.jpg'),
(26, 3, 'http://www.twitter.com', 'Twitter', 'Tell everyone what you\\'re up to in 140 characters or less. Follow the tweets of some famous people, see what they\\'re doing.', 1124, 0, 0, 0, '2017-12-22 14:12:32', 'Y', 'images/thumbs/twitter_thumb.jpg'),
(27, 3, 'http://listen.grooveshark.com', 'Groove Shark', 'A great site for searching, listening and downloading music.', 999, 0, 0, 0, '2017-12-22 14:09:21', 'Y', 'images/thumbs/grooveshark_thumb.jpg'),
(28, 3, 'http://www.djbooth.net', 'DJBooth', 'Listen, search and download the latest tunes.', 889, 0, 0, 0, '2017-12-20 04:53:39', 'Y', 'images/thumbs/djbooth_thumb.jpg'),
(29, 2, 'http://www.disney.com', 'Disney.com', 'See the latest everything Disney. Movie trailers, Disney channel shows, interactive games, activities and access to all other Disney sites.', 959, 0, 0, 0, '2017-12-22 19:38:54', 'Y', 'images/thumbs/disney_thumb.jpg'),
(30, 3, 'http://www.picnik.com', 'Picnik', 'Easy online photo upload, editing and library.', 1009, 0, 0, 0, '2017-12-22 05:40:25', 'Y', 'images/thumbs/picnik_thumb.jpg'),
(31, 3, 'http://www.imdb.com', 'IMDb', 'Internet Movie Database: view trailers and samples from your favorite or upcoming movies.', 475, 0, 0, 0, '2017-12-20 04:53:27', 'Y', 'images/thumbs/imdb_thumb.jpg'),
(32, 3, 'http://store.apple.com', 'Apple Store', 'Buy everything Apple online: iPod, iPhones, iPads, iTunes and more!', 1093, 0, 0, 0, '2017-12-22 14:19:44', 'Y', 'images/thumbs/applestore_thumb.jpg'),
(33, 2, 'http://www.bratz.com', 'Bratz', 'Games, music and videos with the Bratz gang.', 488, 0, 0, 0, '2017-12-20 04:52:10', 'Y', 'images/thumbs/bratz_thumb.jpg'),
(35, 1, 'http://www.thomasandfriends.com', '<NAME>', 'Join Thomas and his friends for games, activities, videos, music and more!', 1067, 0, 0, 0, '2017-12-20 04:49:32', 'Y', 'images/thumbs/thomas_thumb.jpg'),
(36, 1, 'http://www.starfall.com', 'Starfall', 'Learn to read with fun interactive games and activities.', 1083, 0, 0, 0, '2017-12-20 04:49:26', 'Y', 'images/thumbs/starfall_thumb.jpg'),
(37, 1, 'http://www.linktolearning.com/', 'LinkToLearning', 'A website full of safe and fun activities for kids to learn.', 1122, 2, 2, 0, '2017-12-21 15:06:47', 'Y', 'images/thumbs/linktolearning_thumb.jpg'),
(39, 2, 'http://kids.yahoo.com', 'Yahoo! Kids', 'A collection of games, movies, music, jokes and more!', 585, 0, 0, 0, '2017-12-20 05:32:31', 'Y', 'images/thumbs/yahookids_thumb.jpg'),
(40, 1, 'http://www.sesamestreet.org/games', 'Sesame Street Games', 'Fun and educational games from your favourite gang on Sesame Street!', 1019, 0, 0, 0, '2017-12-20 04:49:41', 'Y', 'images/thumbs/sesamestreet_thumb.jpg'),
(41, 2, 'http://play.lego.com', 'Lego Play', 'Action, puzzle, creative games and more; all with the Lego touch.', 685, 0, 0, 0, '2017-12-20 04:51:18', 'Y', 'images/thumbs/lego_thumb.jpg'),
(42, 2, 'http://www.family.ca/', 'Family Channel', 'Watch clips, play games, enter contests and more with all the characters from Family channel.', 551, 0, 0, 0, '2017-12-20 04:51:47', 'Y', 'images/thumbs/familychannel_thumb.jpg'),
(43, 3, 'http://zone.msn.com', 'MSN Games', 'Microsoft's online game zone. Play puzzle, action, arcade, card, board-style games and more!', 556, 0, 0, 0, '2017-12-20 04:53:14', 'Y', 'images/thumbs/msnzone_thumb.jpg'),
(44, 3, 'http://www.mindjolt.com', 'Mind Jolt', 'A site with a huge selection of online games: puzzle, strategy, action and more! For kids of all ages.', 488, 0, 0, 0, '2017-12-20 04:53:22', 'Y', 'images/thumbs/mindjolt_thumb.jpg'),
(45, 2, 'http://www.mindjolt.com', 'Mind Jolt', 'A site with a huge selection of online games: puzzle, strategy, action and more! For kids of all ages.', 974, 0, 0, 0, '2017-12-21 12:10:00', 'Y', 'images/thumbs/mindjolt_thumb.jpg'),
(46, 1, 'http://www.mattel.com/games', 'Mattel Games', 'Fun and educational games online for your kids. Click on the "preschool" button for younger children.', 1109, 0, 0, 0, '2017-12-21 18:57:07', 'Y', 'images/thumbs/mattel_thumb.jpg'),
(47, 2, 'http://www.mattel.com/games', 'Mattel Games', 'Fun educational games online for boys and girls in true Mattel style.', 472, 0, 0, 0, '2017-12-20 04:52:14', 'Y', 'images/thumbs/mattel_thumb.jpg'),
(48, 2, 'http://www.teletoon.com/teletoon3/teletoon.php?language=En&func=php|templates/play.php|0&xVar=0', 'Teletoon Games', 'Free online games starring all your favourite characters from Teletoon.', 553, 0, 0, 0, '2017-12-20 04:51:43', 'Y', 'images/thumbs/teletoon_thumb.jpg'),
(49, 2, 'http://www.hotwheels.com/games', 'HotWheels Games', 'HotWheels doesn't only have cool cars - it has cool online games too! Check it out!', 548, 0, 0, 0, '2017-12-22 12:19:30', 'Y', 'images/thumbs/hotwheels_thumb.jpg'),
(50, 2, 'http://games.yahoo.com', 'YAHOO Games', 'Arcarde, board, card, puzzle, word games and more. YAHOO brings them all to your PC online, even some downloadable.', 518, 0, 0, 0, '2017-12-20 04:52:07', 'Y', 'images/thumbs/yahoo_thumb.jpg'),
(51, 3, 'http://games.yahoo.com', 'YAHOO Games', 'Arcarde, board, card, puzzle, word games and more. YAHOO brings them all to your PC online, even some downloadable.', 493, 0, 0, 0, '2017-12-20 04:53:18', 'Y', 'images/thumbs/yahoo_thumb.jpg'),
(52, 2, 'http://myscene.everythinggirl.com/games/games.aspx', 'Everything Girl Games', 'A site for girl games: fashion designer, makeovers, shopping-spree and more!', 568, 0, 0, 0, '2017-12-20 04:51:38', 'Y', 'images/thumbs/everythinggirl_thumb.jpg'),
(53, 1, 'http://www.playhousedisney.ca/index_en.php', 'Playhouse Disney', 'Join all your Playhouse Disney characters you see on tv for games, activities, videos and learning.', 1146, 0, 0, 0, '2017-12-20 04:49:12', 'Y', 'images/thumbs/playhousedisney_thumb.jpg'),
(54, 2, 'http://www.hasbro.com/hasbrokids/', 'Hasbro Kids', 'Games, videos and comics from all your favourite Hasbro toys and characters!', 532, 0, 0, 0, '2017-12-20 04:51:56', 'Y', 'images/thumbs/hasbrokids_thumb.jpg'),
(55, 2, 'http://www.poptropica.com', 'PopTropica', 'A site for exploring different animated worlds with you character. You can also go on secret missions.', 573, 0, 0, 0, '2017-12-21 15:39:40', 'Y', 'images/thumbs/poptropica.png'),
(56, 2, 'http://www.bbc.co.uk/schools/typing/', 'BBC Typing', 'A typing tutorial site for all ages. Learn the proper way to type with graduated levels and lots of exercises', 523, 0, 0, 0, '2017-12-20 04:52:02', 'Y', 'images/thumbs/bbc_typing.png'),
(57, 2, 'http://www.kerpoof.com', 'Kerpoof Studio', 'Explore your creativity - make your own movies, cards, pictures and more - easy and fun! Tools available for teachers and educators.', 578, 1, 1, 0, '2017-12-20 04:51:30', 'Y', 'images/thumbs/kerpoof_thumb.jpg'),
(58, 1, 'http://www.harrypurplemonkey.com', '<NAME>', 'Come join us on our fun, educational and interactive website. ', 777, 0, 0, 0, '2017-12-20 04:50:00', 'Y', 'images/thumbs/purplemonkey_thumb.jpg'),
(59, 1, 'http://www.dressupgamesite.com', 'Dress Up Games', 'Pick from some of your favourite online characters and dress them up! Be creative and have fun!', 891, 0, 0, 0, '2017-12-22 09:27:57', 'Y', 'images/thumbs/Screen Shot 2012-02-16 at 6.11.41 AM.png'),
(60, 2, 'http://gameninja.com', 'Game Ninja', 'Free online action, adventure, puzzle, sport, strategy and more game for youths.', 594, 0, 0, 0, '2017-12-21 11:50:51', 'Y', 'images/thumbs/gameninjathumb.jpg'),
(92, 2, 'http://coolmath4kids.com', 'Cool Math For Kids', 'Fun site for kids filled with educational games.', 440, 0, 0, 0, '2017-12-20 04:52:21', 'Y', 'images/thumbs/coolmath4kids.png'),
(93, 2, 'http://sumdog.com', 'SumDog', 'Free games that make learning fun. Separate teacher and parent/kids login so kids can learn and teachers can check progress.', 393, 0, 0, 0, '2017-12-20 04:52:25', 'Y', 'images/thumbs/sumdog.png'),
(94, NULL, 'http://affordablecarinsurancehnb.org/', 'ioihqxostv', 'car insurance companies - https://affordablecarinsurancehnb.org/ \r\nauto insurance quote <a href=https://affordablecarinsurancehnb.org/>best auto insurance</a> ’', 0, 0, 0, 0, '2017-06-05 06:48:08', 'N', NULL),
(95, NULL, 'http://ruwordpress.ru/aileron/', 'Aileron — ??????? WordPress. ??????? ????????? ???', 'Aileron — ??????? WordPress. ??????? ????????? ??????? ?????? ????????? <a href=http://ruwordpress.ru/aileron/>Show more...</a>', 0, 0, 0, 0, '2017-08-27 14:09:25', 'N', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(128) NOT NULL,
`password` varchar(256) NOT NULL,
`name` varchar(256) DEFAULT NULL,
`city` varchar(128) DEFAULT NULL,
`country` varchar(128) DEFAULT NULL,
`reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isadmin` char(1) DEFAULT 'N',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `email`, `password`, `name`, `city`, `country`, `reg_date`, `isadmin`) VALUES
(1, '<EMAIL>', '<PASSWORD>', 'NULL', 'NULL', 'NULL', '2010-06-11 16:39:49', 'Y'); |
INSERT INTO all_departments (department_name)
VALUES ('Sales'),
('Opperations'),
('Finance'),
('Human Resources');
INSERT INTO all_roles (job_title, department_id, salary)
VALUES ('Lead Salesman', 1, 150000),
('Lead Opperations', 2, 120000),
('Lead Finance', 3, 170000),
('Human Resources Manager', 4, 100000),
('Salesman', 1, 75000),
('Opperations', 2, 60000),
('Accountant', 3, 85000),
('Team Trainer', 4, 50000);
INSERT INTO all_employees (employee_first, employee_last, role_id, manager_id)
VALUES
('first1', 'last1', 1, null),
('first2', 'last2', 2, null),
('first3', 'last3', 3, null),
('first4', 'last4', 4, null),
('first5', 'last5', 5, 1),
('first6', 'last6', 6, 2),
('first7', 'last7', 7, 3),
('first8', 'last8', 8, 4);
|
<reponame>cicatrizwp/codeigniter-crud<filename>db/medico.sql
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jun 11, 2019 at 08:34 PM
-- Server version: 5.7.26-0ubuntu0.18.04.1
-- PHP Version: 7.2.19-0ubuntu0.18.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `codeigniter-crud`
--
-- --------------------------------------------------------
--
-- Table structure for table `medico`
--
CREATE TABLE `medico` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`crm` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
`state` varchar(2) NOT NULL,
`city` varchar(80) NOT NULL,
`specialization` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `medico`
--
ALTER TABLE `medico`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `medico`
--
ALTER TABLE `medico`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
\c postgres
create table urls (
url_id serial not null unique,
url text,
code varchar(12) unique,
created_at timestamp default now()
);
create extension "uuid-ossp";
create table users (
user_id uuid not null default uuid_generate_v4(),
name varchar(64) not null,
email varchar(64) not null unique,
password varchar(64) not null ,
created_at timestamp not null default now(),
updated_at timestamp null,
deleted_at timestamp null,
primary key (user_id)
);
create table user_urls (
id serial not null unique,
url text,
code varchar(12) unique,
created_at timestamp not null default now(),
updated_at timestamp null,
deleted_at timestamp null,
total_click integer not null default 0,
user_id uuid,
constraint fk_owner foreign key(user_id) references users(user_id)
) |
SET DEFINE OFF;
CREATE INDEX AFW_25_VERSN_PUBLC_SUBST_FK1 ON AFW_25_VERSN_PUBLC_SUBST
(REF_VERSN_PUBLC)
LOGGING
/
|
<gh_stars>1-10
CREATE TABLE BLOGPOST(
ID INT AUTO_INCREMENT,
NAME VARCHAR(255),
SUB_DEPARTMENT VARCHAR(255),
COMMENTS VARCHAR(2000),
DESCRIPTION VARCHAR(255),
LAST_UPDATED INT
);
|
WITH conditional_data AS (
SELECT
radar_id,
date_trunc('hour', start_time) + date_part('minute', start_time)::int / 20 * interval '20 min' AS interval_start_time,
CASE
WHEN altitude >= 0.2 AND altitude < 1.6 THEN 1
WHEN altitude >= 1.6 THEN 2
END AS altitude_band,
u_speed,
CASE
WHEN radial_velocity_std >= 2 AND bird_density >= 1 THEN u_speed
ELSE null
END AS conditional_u_speed,
v_speed,
CASE
WHEN radial_velocity_std >= 2 AND bird_density >= 1 THEN v_speed
ELSE null
END AS conditional_v_speed,
CASE
WHEN bird_density IS NULL THEN NULL
WHEN radial_velocity_std >= 2 THEN bird_density
ELSE 0
END AS bird_density
FROM
lifewatch.bird_migration_altitude_profiles
WHERE
altitude >= 0.2
AND altitude <= 4.0
)
SELECT
radar_id,
interval_start_time,
altitude_band,
CASE
WHEN avg(conditional_u_speed) IS NOT NULL THEN round(avg(conditional_u_speed)::numeric,5)
WHEN avg(u_speed) IS NOT NULL THEN 0
ELSE null
END AS avg_u_speed,
CASE
WHEN avg(conditional_v_speed) IS NOT NULL THEN round(avg(conditional_v_speed)::numeric,5)
WHEN avg(v_speed) IS NOT NULL THEN 0
ELSE null
END AS avg_v_speed,
round(avg(bird_density)::numeric,5) AS avg_bird_density,
CASE
WHEN altitude_band = 1 THEN round((avg(bird_density) * 7 /5)::numeric,5)
WHEN altitude_band = 2 THEN round((avg(bird_density) * 7 /5)::numeric,5)
END AS vertical_integrated_density,
count(*) AS number_of_measurements
FROM conditional_data
GROUP BY
radar_id,
interval_start_time,
altitude_band
ORDER BY
interval_start_time,
radar_id,
altitude_band
|
ALTER TABLE EG_UOMCATEGORY RENAME COLUMN lastmodified TO lastmodifieddate;
ALTER TABLE EG_UOMCATEGORY ADD COLUMN version numeric ;
update EG_UOMCATEGORY set version=0 where version is null; |
<gh_stars>10-100
ALTER TABLE addresses ADD is_passthrough_address TINYINT(1) NOT NULL DEFAULT '0' AFTER is_separator_address;
UPDATE addresses SET is_passthrough_address=1 WHERE option_index=2;
ALTER TABLE transaction_ios ADD is_passthrough TINYINT(1) NOT NULL DEFAULT '0' AFTER is_separator;
UPDATE transaction_ios SET is_passthrough=1 WHERE option_index=2;
ALTER TABLE transaction_ios ADD is_receiver TINYINT(1) NOT NULL DEFAULT '0' AFTER is_passthrough;
|
-- 262. Trips and Users
--
-- The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users table. Status is an ENUM type of (‘completed’, ‘cancelled_by_driver’, ‘cancelled_by_client’).
--
-- +----+-----------+-----------+---------+--------------------+----------+
-- | Id | Client_Id | Driver_Id | City_Id | Status |Request_at|
-- +----+-----------+-----------+---------+--------------------+----------+
-- | 1 | 1 | 10 | 1 | completed |2013-10-01|
-- | 2 | 2 | 11 | 1 | cancelled_by_driver|2013-10-01|
-- | 3 | 3 | 12 | 6 | completed |2013-10-01|
-- | 4 | 4 | 13 | 6 | cancelled_by_client|2013-10-01|
-- | 5 | 1 | 10 | 1 | completed |2013-10-02|
-- | 6 | 2 | 11 | 6 | completed |2013-10-02|
-- | 7 | 3 | 12 | 6 | completed |2013-10-02|
-- | 8 | 2 | 12 | 12 | completed |2013-10-03|
-- | 9 | 3 | 10 | 12 | completed |2013-10-03|
-- | 10 | 4 | 13 | 12 | cancelled_by_driver|2013-10-03|
-- +----+-----------+-----------+---------+--------------------+----------+
--
-- The Users table holds all users. Each user has an unique Users_Id, and Role is an ENUM type of (‘client’, ‘driver’, ‘partner’).
--
-- +----------+--------+--------+
-- | Users_Id | Banned | Role |
-- +----------+--------+--------+
-- | 1 | No | client |
-- | 2 | Yes | client |
-- | 3 | No | client |
-- | 4 | No | client |
-- | 10 | No | driver |
-- | 11 | No | driver |
-- | 12 | No | driver |
-- | 13 | No | driver |
-- +----------+--------+--------+
--
-- Write a SQL query to find the cancellation rate of requests made by unbanned users (both client and driver must be unbanned) between Oct 1, 2013 and Oct 3, 2013. The cancellation rate is computed by dividing the number of canceled (by client or driver) requests made by unbanned users by the total number of requests made by unbanned users.
--
-- For the above tables, your SQL query should return the following rows with the cancellation rate being rounded to two decimal places.
--
-- +------------+-------------------+
-- | Day | Cancellation Rate |
-- +------------+-------------------+
-- | 2013-10-01 | 0.33 |
-- | 2013-10-02 | 0.00 |
-- | 2013-10-03 | 0.50 |
-- +------------+-------------------+
-- # Write your MySQL query statement below
SELECT Request_at as Day,
ROUND(COUNT(IF(Status != 'completed', TRUE, NULL)) / COUNT(*), 2) AS 'Cancellation Rate'
FROM Trips
WHERE (Request_at BETWEEN '2013-10-01' AND '2013-10-03')
AND Client_id NOT IN (SELECT Users_Id FROM Users WHERE Banned = 'Yes')
GROUP BY Request_at;
|
-- T-SQL scripts to get relevant information from the Extended Event session
;WITH XEData
AS
(
SELECT CAST(xest.target_data as XML) xml_data
FROM sys.dm_xe_session_targets xest
INNER JOIN sys.dm_xe_sessions xes on xes.[address] = xest.event_session_address
WHERE xes.name = 'AG_XE_DEMO'
AND xest.target_name = 'ring_buffer'
)
SELECT
dateadd(mi,datediff(mi,getutcdate(),getdate()),event_xml.value('(./@timestamp)', 'datetime')) as [Time],
event_xml.value('(./@timestamp)', 'datetime') as [UTCTime],
event_xml.value('(./data[@name="new_timeout"]/value)[1]', 'bigint') as [New_Timeout],
event_xml.value('(./data[@name="state"]/text)[1]', 'varchar(255)') as [State],
event_xml.value('(./data[@name="id_or_name"]/value)[1]', 'varchar(255)') as [AG_Name],
event_xml.value('(./data[@name="error_code"]/value)[1]', 'varchar(255)') as [ErrorCode]
FROM XEData
CROSS APPLY xml_data.nodes('//event[@name="hadr_ag_lease_renewal"]') n (event_xml)
;WITH XEData
AS
(
SELECT CAST(xest.target_data as XML) xml_data
FROM sys.dm_xe_session_targets xest
INNER JOIN sys.dm_xe_sessions xes on xes.[address] = xest.event_session_address
WHERE xes.name = 'AG_XE_DEMO'
AND xest.target_name = 'ring_buffer'
)
SELECT
dateadd(mi,datediff(mi,getutcdate(),getdate()),event_xml.value('(./@timestamp)', 'datetime')) as [Time],
event_xml.value('(./@timestamp)', 'datetime') as [UTCTime],
event_xml.value('(./data[@name="new_timeout"]/value)[1]', 'bigint') as [New_Timeout],
event_xml.value('(./data[@name="availability_group_name"]/value)[1]', 'varchar(255)') as [AGName],
event_xml.value('(./data[@name="current_time"]/value)[1]', 'bigint') as [Current_Time],
event_xml.value('(./data[@name="state"]/value)[1]', 'varchar(255)') as [State]
FROM XEData
CROSS APPLY xml_data.nodes('//event[@name="availability_group_lease_expired"]') n (event_xml)
|
-- TBE-654: - Update email column size (ORACLE)
-- Step 1: Drop views
DROP VIEW p28_cfg_doc_config_v;
DROP VIEW p28_cfg_doc_config_nt;
DROP VIEW p28_cfg_doc_email_cfg_v;
DROP VIEW p28_cfg_doc_email_cfg_nt;
-- Step 2: Alter column type
ALTER TABLE p28_cfg_doc_config MODIFY extra_to varchar2(32767 char);
ALTER TABLE p28_cfg_doc_config MODIFY extra_cc varchar2(32767 char);
ALTER TABLE p28_cfg_doc_config MODIFY extra_bcc varchar2(32767 char);
ALTER TABLE p28_his_doc_config MODIFY extra_to varchar2(32767 char);
ALTER TABLE p28_his_doc_config MODIFY extra_cc varchar2(32767 char);
ALTER TABLE p28_his_doc_config MODIFY extra_bcc varchar2(32767 char);
ALTER TABLE p28_cfg_doc_email_cfg MODIFY extra_to varchar2(32767 char);
ALTER TABLE p28_cfg_doc_email_cfg MODIFY extra_cc varchar2(32767 char);
ALTER TABLE p28_cfg_doc_email_cfg MODIFY extra_bcc varchar2(32767 char);
ALTER TABLE p28_his_doc_email_cfg MODIFY extra_to varchar2(32767 char);
ALTER TABLE p28_his_doc_email_cfg MODIFY extra_cc varchar2(32767 char);
ALTER TABLE p28_his_doc_email_cfg MODIFY extra_bcc varchar2(32767 char);
-- Step 3: Recreate views
CREATE OR REPLACE VIEW p28_cfg_doc_config_v AS SELECT
-- columns of java class TrackingBase
-- columns of java class WriteTracking
t0.c_tech_user_id AS c_tech_user_id
, t0.c_app_user_id AS c_app_user_id
, t0.c_timestamp AS c_timestamp
, t0.c_process_ref AS c_process_ref
-- columns of java class FullTracking
, t0.m_tech_user_id AS m_tech_user_id
, t0.m_app_user_id AS m_app_user_id
, t0.m_timestamp AS m_timestamp
, t0.m_process_ref AS m_process_ref
-- columns of java class FullTrackingWithVersion
, t0.version AS version
-- columns of java class InternalTenantRef42
, t0.tenant_ref AS tenant_ref
-- columns of java class AbstractRef
-- columns of java class Ref
, t0.object_ref AS object_ref
-- columns of java class DocConfigRef
-- columns of java class DocConfigDTO
, t0.document_id AS document_id
, t0.mapped_id AS mapped_id
, t0.forward_to_channel AS forward_to_channel
, t0.forward_to_address AS forward_to_address
, t0.communication_format AS communication_format
, t0.description AS description
, t0.use_cids AS use_cids
, t0.email_config_per_selector AS email_config_per_selector
, t0.email_body_template_id AS email_body_template_id
, t0.email_subject AS email_subject
, t0.default_from AS default_from
, t0.default_reply_to AS default_reply_to
, t0.extra_to AS extra_to
, t0.extra_cc AS extra_cc
, t0.extra_bcc AS extra_bcc
, TemplateType2s(t0.subject_type) AS subject_type
, t0.replace_from AS replace_from
, t0.replace_reply_to AS replace_reply_to
, t0.replace_to AS replace_to
, t0.replace_cc AS replace_cc
, t0.replace_bcc AS replace_bcc
, t0.store_email AS store_email
, t0.send_spooled AS send_spooled
, t0.alternate_template_id AS alternate_template_id
, t0.follow_mapped_id AS follow_mapped_id
, t0.time_zone AS time_zone
FROM p28_cfg_doc_config t0;
CREATE OR REPLACE VIEW p28_cfg_doc_config_nt AS SELECT
-- columns of java class InternalTenantRef42
t0.tenant_ref AS tenant_ref
-- columns of java class AbstractRef
-- columns of java class Ref
, t0.object_ref AS object_ref
-- columns of java class DocConfigRef
-- columns of java class DocConfigDTO
, t0.document_id AS document_id
, t0.mapped_id AS mapped_id
, t0.forward_to_channel AS forward_to_channel
, t0.forward_to_address AS forward_to_address
, t0.communication_format AS communication_format
, t0.description AS description
, t0.use_cids AS use_cids
, t0.email_config_per_selector AS email_config_per_selector
, t0.email_body_template_id AS email_body_template_id
, t0.email_subject AS email_subject
, t0.default_from AS default_from
, t0.default_reply_to AS default_reply_to
, t0.extra_to AS extra_to
, t0.extra_cc AS extra_cc
, t0.extra_bcc AS extra_bcc
, TemplateType2s(t0.subject_type) AS subject_type
, t0.replace_from AS replace_from
, t0.replace_reply_to AS replace_reply_to
, t0.replace_to AS replace_to
, t0.replace_cc AS replace_cc
, t0.replace_bcc AS replace_bcc
, t0.store_email AS store_email
, t0.send_spooled AS send_spooled
, t0.alternate_template_id AS alternate_template_id
, t0.follow_mapped_id AS follow_mapped_id
, t0.time_zone AS time_zone
FROM p28_cfg_doc_config t0;
CREATE OR REPLACE VIEW p28_cfg_doc_email_cfg_v AS SELECT
-- columns of java class TrackingBase
-- columns of java class WriteTracking
t0.c_tech_user_id AS c_tech_user_id
, t0.c_app_user_id AS c_app_user_id
, t0.c_timestamp AS c_timestamp
, t0.c_process_ref AS c_process_ref
-- columns of java class FullTracking
, t0.m_tech_user_id AS m_tech_user_id
, t0.m_app_user_id AS m_app_user_id
, t0.m_timestamp AS m_timestamp
, t0.m_process_ref AS m_process_ref
-- columns of java class FullTrackingWithVersion
, t0.version AS version
-- columns of java class InternalTenantRef42
, t0.tenant_ref AS tenant_ref
-- columns of java class AbstractRef
-- columns of java class Ref
, t0.object_ref AS object_ref
-- columns of java class DocEmailCfgRef
-- columns of java class DocEmailCfgDTO
, t0.document_id AS document_id
, t0.entity_id AS entity_id
, t0.language_code AS language_code
, t0.country_code AS country_code
, t0.currency_code AS currency_code
, t0.prio AS prio
, t0.email_subject AS email_subject
, t0.default_from AS default_from
, t0.default_reply_to AS default_reply_to
, t0.extra_to AS extra_to
, t0.extra_cc AS extra_cc
, t0.extra_bcc AS extra_bcc
, TemplateType2s(t0.subject_type) AS subject_type
, t0.replace_from AS replace_from
, t0.replace_reply_to AS replace_reply_to
, t0.replace_to AS replace_to
, t0.replace_cc AS replace_cc
, t0.replace_bcc AS replace_bcc
, t0.store_email AS store_email
, t0.send_spooled AS send_spooled
FROM p28_cfg_doc_email_cfg t0;
CREATE OR REPLACE VIEW p28_cfg_doc_email_cfg_nt AS SELECT
-- columns of java class InternalTenantRef42
t0.tenant_ref AS tenant_ref
-- columns of java class AbstractRef
-- columns of java class Ref
, t0.object_ref AS object_ref
-- columns of java class DocEmailCfgRef
-- columns of java class DocEmailCfgDTO
, t0.document_id AS document_id
, t0.entity_id AS entity_id
, t0.language_code AS language_code
, t0.country_code AS country_code
, t0.currency_code AS currency_code
, t0.prio AS prio
, t0.email_subject AS email_subject
, t0.default_from AS default_from
, t0.default_reply_to AS default_reply_to
, t0.extra_to AS extra_to
, t0.extra_cc AS extra_cc
, t0.extra_bcc AS extra_bcc
, TemplateType2s(t0.subject_type) AS subject_type
, t0.replace_from AS replace_from
, t0.replace_reply_to AS replace_reply_to
, t0.replace_to AS replace_to
, t0.replace_cc AS replace_cc
, t0.replace_bcc AS replace_bcc
, t0.store_email AS store_email
, t0.send_spooled AS send_spooled
FROM p28_cfg_doc_email_cfg t0;
|
<filename>@api/data/schema.sql<gh_stars>0
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.0
-- Dumped by pg_dump version 14.0
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: app_hidden; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA app_hidden;
--
-- Name: app_private; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA app_private;
--
-- Name: app_public; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA app_public;
--
-- Name: citext; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
--
-- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings';
--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
--
-- Name: role; Type: TYPE; Schema: app_private; Owner: -
--
CREATE TYPE app_private.role AS ENUM (
'user',
'moderator',
'admin'
);
--
-- Name: friend_status; Type: TYPE; Schema: app_public; Owner: -
--
CREATE TYPE app_public.friend_status AS ENUM (
'accepted',
'pending',
'blocked'
);
--
-- Name: long_text; Type: DOMAIN; Schema: app_public; Owner: -
--
CREATE DOMAIN app_public.long_text AS text
CONSTRAINT long_text_check CHECK (((length(VALUE) >= 0) AND (length(VALUE) <= 1024)));
--
-- Name: name; Type: DOMAIN; Schema: app_public; Owner: -
--
CREATE DOMAIN app_public.name AS text
CONSTRAINT name_check CHECK (((length(VALUE) >= 2) AND (length(VALUE) <= 56)));
--
-- Name: rating; Type: DOMAIN; Schema: app_public; Owner: -
--
CREATE DOMAIN app_public.rating AS integer
CONSTRAINT rating_check CHECK (((VALUE >= 0) AND (VALUE <= 10)));
--
-- Name: short_text; Type: DOMAIN; Schema: app_public; Owner: -
--
CREATE DOMAIN app_public.short_text AS text
CONSTRAINT short_text_check CHECK (((length(VALUE) >= 2) AND (length(VALUE) <= 64)));
--
-- Name: assert_valid_password(text); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.assert_valid_password(new_password text) RETURNS void
LANGUAGE plpgsql
AS $$
begin
if (select new_password ~ '\d' = false) then
raise exception 'password must contain numbers' using errcode = 'WEAKP';
end if;
if (select new_password ~ '[a-zA-Z]' = false) then
raise exception 'password must contain letters' using errcode = 'WEAKP';
end if;
if length(new_password) <= 8 then
raise exception 'password must be at least 8 characters long' using errcode = 'WEAKP';
end if;
end;
$$;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: users; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.users (
id uuid DEFAULT gen_random_uuid() NOT NULL,
username public.citext NOT NULL,
avatar_url text,
is_admin boolean DEFAULT false NOT NULL,
is_verified boolean DEFAULT false NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
first_name text,
last_name text,
location text,
country text,
CONSTRAINT users_avatar_url_check CHECK ((avatar_url ~ '^https?://[^/]+'::text)),
CONSTRAINT users_country_check CHECK (((length(country) >= 2) AND (length(country) <= 56))),
CONSTRAINT users_first_name_check CHECK (((length(first_name) >= 2) AND (length(first_name) <= 56))),
CONSTRAINT users_last_name_check CHECK (((length(last_name) >= 2) AND (length(last_name) <= 56))),
CONSTRAINT users_location_check CHECK (((length(location) >= 2) AND (length(location) <= 56))),
CONSTRAINT users_username_check CHECK (((length((username)::text) >= 2) AND (length((username)::text) <= 24) AND (username OPERATOR(public.~) '^[a-zA-Z]([_]?[a-zA-Z0-9])+$'::public.citext)))
);
--
-- Name: TABLE users; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.users IS 'A user who can log in to the application.';
--
-- Name: COLUMN users.id; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.users.id IS 'Unique identifier for the user.';
--
-- Name: COLUMN users.username; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.users.username IS 'Public-facing username (or ''handle'') of the user.';
--
-- Name: COLUMN users.avatar_url; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.users.avatar_url IS 'Optional avatar URL.';
--
-- Name: COLUMN users.is_admin; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.users.is_admin IS 'If true, the user has elevated privileges.';
--
-- Name: link_or_register_user(uuid, character varying, character varying, json, json); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.link_or_register_user(f_user_id uuid, f_service character varying, f_identifier character varying, f_profile json, f_auth_details json) RETURNS app_public.users
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_matched_user_id uuid;
v_matched_authentication_id uuid;
v_email citext;
v_first_name text;
v_last_name text;
v_avatar_url text;
v_user app_public.users;
v_user_email app_public.user_emails;
begin
-- See if a user account already matches these details
select id, user_id
into v_matched_authentication_id, v_matched_user_id
from app_public.user_authentications
where service = f_service
and identifier = f_identifier
limit 1;
if v_matched_user_id is not null and f_user_id is not null and v_matched_user_id <> f_user_id then
raise exception 'A different user already has this account linked.' using errcode = 'TAKEN';
end if;
v_email = f_profile ->> 'email';
v_first_name := f_profile ->> 'first_name';
v_last_name := f_profile ->> 'last_name';
v_avatar_url := f_profile ->> 'avatar_url';
if v_matched_authentication_id is null then
if f_user_id is not null then
-- Link new account to logged in user account
insert into app_public.user_authentications (user_id, service, identifier, details) values
(f_user_id, f_service, f_identifier, f_profile) returning id, user_id into v_matched_authentication_id, v_matched_user_id;
insert into app_private.user_authentication_secrets (user_authentication_id, details) values
(v_matched_authentication_id, f_auth_details);
perform graphile_worker.add_job(
'user__audit',
json_build_object(
'type', 'linked_account',
'user_id', f_user_id,
'extra1', f_service,
'extra2', f_identifier,
'current_user_id', app_public.current_user_id()
));
elsif v_email is not null then
-- See if the email is registered
select * into v_user_email from app_public.user_emails where email = v_email and is_verified is true;
if v_user_email is not null then
-- User exists!
insert into app_public.user_authentications (user_id, service, identifier, details) values
(v_user_email.user_id, f_service, f_identifier, f_profile) returning id, user_id into v_matched_authentication_id, v_matched_user_id;
insert into app_private.user_authentication_secrets (user_authentication_id, details) values
(v_matched_authentication_id, f_auth_details);
perform graphile_worker.add_job(
'user__audit',
json_build_object(
'type', 'linked_account',
'user_id', f_user_id,
'extra1', f_service,
'extra2', f_identifier,
'current_user_id', app_public.current_user_id()
));
end if;
end if;
end if;
if v_matched_user_id is null and f_user_id is null and v_matched_authentication_id is null then
-- Create and return a new user account
return app_private.register_user(f_service, f_identifier, f_profile, f_auth_details, true);
else
if v_matched_authentication_id is not null then
update app_public.user_authentications
set details = f_profile
where id = v_matched_authentication_id;
update app_private.user_authentication_secrets
set details = f_auth_details
where user_authentication_id = v_matched_authentication_id;
update app_public.users
set
first_name = coalesce(users.name, v_first_name),
last_name = coalesce(users.name, v_last_name),
avatar_url = coalesce(users.avatar_url, v_avatar_url)
where id = v_matched_user_id
returning * into v_user;
return v_user;
else
-- v_matched_authentication_id is null
-- -> v_matched_user_id is null (they're paired)
-- -> f_user_id is not null (because the if clause above)
-- -> v_matched_authentication_id is not null (because of the separate if block above creating a user_authentications)
-- -> contradiction.
raise exception 'This should not occur';
end if;
end if;
end;
$$;
--
-- Name: FUNCTION link_or_register_user(f_user_id uuid, f_service character varying, f_identifier character varying, f_profile json, f_auth_details json); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.link_or_register_user(f_user_id uuid, f_service character varying, f_identifier character varying, f_profile json, f_auth_details json) IS 'If you''re logged in, this will link an additional OAuth login to your account if necessary. If you''re logged out it may find if an account already exists (based on OAuth details or email address) and return that, or create a new user account if necessary.';
--
-- Name: sessions; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.sessions (
uuid uuid DEFAULT gen_random_uuid() NOT NULL,
user_id uuid NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
last_active timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: login(public.citext, text); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.login(username public.citext, password text) RETURNS app_private.sessions
LANGUAGE plpgsql STRICT
AS $$
declare
v_user app_public.users;
v_user_secret app_private.user_secrets;
v_login_attempt_window_duration interval = interval '5 minutes';
v_session app_private.sessions;
begin
if username like '%@%' then
-- It's an email
select users.* into v_user
from app_public.users
inner join app_public.user_emails
on (user_emails.user_id = users.id)
where user_emails.email = login.username
order by
user_emails.is_verified desc, -- Prefer verified email
user_emails.created_at asc -- Failing that, prefer the first registered (unverified users _should_ verify before logging in)
limit 1;
else
-- It's a username
select users.* into v_user
from app_public.users
where users.username = login.username;
end if;
if not (v_user is null) then
-- Load their secrets
select * into v_user_secret from app_private.user_secrets
where user_secrets.user_id = v_user.id;
-- Have there been too many login attempts?
if (
v_user_secret.first_failed_password_attempt is not null
and
v_user_secret.first_failed_password_attempt > NOW() - v_login_attempt_window_duration
and
v_user_secret.failed_password_attempts >= 3
) then
raise exception 'User account locked - too many login attempts. Try again after 5 minutes.' using errcode = 'LOCKD';
end if;
-- Not too many login attempts, let's check the password.
-- NOTE: `password_hash` could be null, this is fine since `NULL = NULL` is null, and null is falsy.
if v_user_secret.password_hash = crypt(password, v_user_secret.password_hash) then
-- Excellent - they're logged in! Let's reset the attempt tracking
update app_private.user_secrets
set failed_password_attempts = 0, first_failed_password_attempt = null, last_login_at = now()
where user_id = v_user.id;
-- Create a session for the user
insert into app_private.sessions (user_id) values (v_user.id) returning * into v_session;
-- And finally return the session
return v_session;
else
-- Wrong password, bump all the attempt tracking figures
update app_private.user_secrets
set
failed_password_attempts = (case when first_failed_password_attempt is null or first_failed_password_attempt < now() - v_login_attempt_window_duration then 1 else failed_password_attempts + 1 end),
first_failed_password_attempt = (case when first_failed_password_attempt is null or first_failed_password_attempt < now() - v_login_attempt_window_duration then now() else first_failed_password_attempt end)
where user_id = v_user.id;
return null; -- Must not throw otherwise transaction will be aborted and attempts won't be recorded
end if;
else
-- No user with that email/username was found
return null;
end if;
end;
$$;
--
-- Name: FUNCTION login(username public.citext, password text); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.login(username public.citext, password text) IS 'Returns a user that matches the username/password combo, or null on failure.';
--
-- Name: migrate_seed(); Type: PROCEDURE; Schema: app_private; Owner: -
--
CREATE PROCEDURE app_private.migrate_seed()
LANGUAGE sql
AS $$
INSERT INTO app_public.companies (name)
SELECT DISTINCT company AS name
FROM app_private.transferable_check_ins ON CONFLICT DO NOTHING;
INSERT INTO app_public.categories (name)
SELECT DISTINCT category AS name
FROM app_private.transferable_check_ins ON CONFLICT DO NOTHING;
WITH types AS (
SELECT DISTINCT category,
style AS name
FROM app_private.transferable_check_ins
)
INSERT INTO app_public.types (name, category)
SELECT name,
category
FROM types ON CONFLICT DO NOTHING;
WITH brands AS (
SELECT DISTINCT brand,
company
FROM app_private.transferable_check_ins
)
INSERT INTO app_public.brands (name, company_id)
SELECT b.brand as name,
c.id as company_id
FROM brands b
LEFT JOIN app_public.companies c ON b.company = c.name ON CONFLICT DO NOTHING;
WITH items AS (
SELECT b.id as brand_id,
p.flavor,
c.id AS manufacturer_id,
t.id AS type_id
FROM app_private.transferable_check_ins p
LEFT JOIN app_public.companies c ON p.company = c.name
LEFT JOIN app_public.types t ON p.style = t.name
AND p.category = t.category
LEFT JOIN app_public.brands b ON p.brand = b.name
AND b.company_id = c.id
)
INSERT INTO app_public.items (flavor, brand_id, manufacturer_id, type_id)
SELECT flavor,
brand_id,
manufacturer_id,
type_id
FROM items ON CONFLICT DO NOTHING;
WITH check_ins AS (
SELECT CASE
WHEN LENGTH(p.rating) > 0 THEN (
REPLACE(p.rating, ',', '.')::DECIMAL * 2
)::INTEGER
ELSE NULL
END AS rating,
i.id AS item_id
FROM app_private.transferable_check_ins p
LEFT JOIN app_public.companies c ON p.company = c.name
LEFT JOIN app_public.brands b ON b.company_id = c.id
AND b.name = p.brand
LEFT JOIN app_public.categories k ON k.name = p.category
LEFT JOIN app_public.types t ON t.category = k.name
AND p.style = t.name
LEFT JOIN app_public.items i ON i.manufacturer_id = c.id
AND b.id = i.brand_id
AND i.flavor = p.flavor
AND i.type_id = t.id
)
INSERT INTO app_public.check_ins (rating, item_id, author_id)
SELECT rating,
i.item_id AS item_id,
(
SELECT id
FROM app_public.users
WHERE username = 'villeheikkila'
) AS author_id
FROM check_ins i $$;
--
-- Name: really_create_user(public.citext, text, boolean, text, text, text, text); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.really_create_user(username public.citext, email text, email_is_verified boolean, first_name text, last_name text, avatar_url text, password text DEFAULT NULL::text) RETURNS app_public.users
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user app_public.users;
v_username citext = username;
begin
if password is not null then
perform app_private.assert_valid_password(password);
end if;
if email is null then
raise exception 'email is required' using errcode = 'modat';
end if;
insert into app_public.users (username, first_name, last_name, avatar_url)
values (v_username, first_name, last_name, avatar_url)
returning * into v_user;
insert into app_public.user_emails (user_id, email, is_verified, is_primary)
values (v_user.id, email, email_is_verified, email_is_verified);
insert into app_public.user_settings (id)
values (v_user.id);
if password is not null then
update app_private.user_secrets
set password_hash = crypt(password, gen_salt('bf'))
where user_id = v_user.id;
end if;
select * into v_user from app_public.users where id = v_user.id;
return v_user;
end;
$$;
--
-- Name: register_user(character varying, character varying, json, json, boolean); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.register_user(f_service character varying, f_identifier character varying, f_profile json, f_auth_details json, f_email_is_verified boolean DEFAULT false) RETURNS app_public.users
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user app_public.users;
v_email citext;
v_first_name text;
v_last_name text;
v_username citext;
v_avatar_url text;
v_user_authentication_id uuid;
begin
-- Extract data from the user’s OAuth profile data.
v_email := f_profile ->> 'email';
v_first_name := f_profile ->> 'first_name';
v_last_name := f_profile ->> 'last_name';
v_username := f_profile ->> 'username';
v_avatar_url := f_profile ->> 'avatar_url';
-- Sanitise the username, and make it unique if necessary.
if v_username is null then
v_username = coalesce(concat(v_first_name, '-', v_last_name), 'user');
end if;
v_username = regexp_replace(v_username, '^[^a-z]+', '', 'gi');
v_username = regexp_replace(v_username, '[^a-z0-9]+', '_', 'gi');
if v_username is null or length(v_username) < 3 then
v_username = 'user';
end if;
select (
case
when i = 0 then v_username
else v_username || i::text
end
) into v_username from generate_series(0, 1000) i
where not exists(
select 1
from app_public.users
where users.username = (
case
when i = 0 then v_username
else v_username || i::text
end
)
)
limit 1;
-- Create the user account
v_user = app_private.really_create_user(
username => v_username,
email => v_email,
email_is_verified => f_email_is_verified,
first_name => v_first_name,
last_name => v_last_name,
avatar_url => v_avatar_url
);
-- Insert the user’s private account data (e.g. OAuth tokens)
insert into app_public.user_authentications (user_id, service, identifier, details) values
(v_user.id, f_service, f_identifier, f_profile) returning id into v_user_authentication_id;
insert into app_private.user_authentication_secrets (user_authentication_id, details) values
(v_user_authentication_id, f_auth_details);
return v_user;
end;
$$;
--
-- Name: FUNCTION register_user(f_service character varying, f_identifier character varying, f_profile json, f_auth_details json, f_email_is_verified boolean); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.register_user(f_service character varying, f_identifier character varying, f_profile json, f_auth_details json, f_email_is_verified boolean) IS 'Used to register a user from information gleaned from OAuth. Primarily used by link_or_register_user';
--
-- Name: reset_password(uuid, text, text); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.reset_password(user_id uuid, reset_token text, new_password text) RETURNS boolean
LANGUAGE plpgsql STRICT
AS $$
declare
v_user app_public.users;
v_user_secret app_private.user_secrets;
v_token_max_duration interval = interval '3 days';
begin
select users.* into v_user
from app_public.users
where id = user_id;
if not (v_user is null) then
-- Load their secrets
select * into v_user_secret from app_private.user_secrets
where user_secrets.user_id = v_user.id;
-- Have there been too many reset attempts?
if (
v_user_secret.first_failed_reset_password_attempt is not null
and
v_user_secret.first_failed_reset_password_attempt > NOW() - v_token_max_duration
and
v_user_secret.failed_reset_password_attempts >= 20
) then
raise exception 'Password reset locked - too many reset attempts' using errcode = 'LOCKD';
end if;
-- Not too many reset attempts, let's check the token
if v_user_secret.reset_password_token = reset_token then
-- Excellent - they're legit
perform app_private.assert_valid_password(new_password);
-- Let's reset the password as requested
update app_private.user_secrets
set
password_hash = crypt(<PASSWORD>, gen_salt('bf')),
failed_password_attempts = 0,
first_failed_password_attempt = null,
reset_password_token = null,
reset_password_token_generated = null,
failed_reset_password_attempts = 0,
first_failed_reset_password_attempt = null
where user_secrets.user_id = v_user.id;
perform graphile_worker.add_job(
'user__audit',
json_build_object(
'type', 'reset_password',
'user_id', v_user.id,
'current_user_id', app_public.current_user_id()
));
return true;
else
-- Wrong token, bump all the attempt tracking figures
update app_private.user_secrets
set
failed_reset_password_attempts = (case when first_failed_reset_password_attempt is null or first_failed_reset_password_attempt < now() - v_token_max_duration then 1 else failed_reset_password_attempts + 1 end),
first_failed_reset_password_attempt = (case when first_failed_reset_password_attempt is null or first_failed_reset_password_attempt < now() - v_token_max_duration then now() else first_failed_reset_password_attempt end)
where user_secrets.user_id = v_user.id;
return null;
end if;
else
-- No user with that id was found
return null;
end if;
end;
$$;
--
-- Name: tg__add_audit_job(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg__add_audit_job() RETURNS trigger
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $_$
declare
v_user_id uuid;
v_type text = TG_ARGV[0];
v_user_id_attribute text = TG_ARGV[1];
v_extra_attribute1 text = TG_ARGV[2];
v_extra_attribute2 text = TG_ARGV[3];
v_extra_attribute3 text = TG_ARGV[4];
v_extra1 text;
v_extra2 text;
v_extra3 text;
begin
if v_user_id_attribute is null then
raise exception 'Invalid tg__add_audit_job call';
end if;
execute 'select ($1.' || quote_ident(v_user_id_attribute) || ')::uuid'
using (case when TG_OP = 'INSERT' then NEW else OLD end)
into v_user_id;
if v_extra_attribute1 is not null then
execute 'select ($1.' || quote_ident(v_extra_attribute1) || ')::text'
using (case when TG_OP = 'DELETE' then OLD else NEW end)
into v_extra1;
end if;
if v_extra_attribute2 is not null then
execute 'select ($1.' || quote_ident(v_extra_attribute2) || ')::text'
using (case when TG_OP = 'DELETE' then OLD else NEW end)
into v_extra2;
end if;
if v_extra_attribute3 is not null then
execute 'select ($1.' || quote_ident(v_extra_attribute3) || ')::text'
using (case when TG_OP = 'DELETE' then OLD else NEW end)
into v_extra3;
end if;
if v_user_id is not null then
perform graphile_worker.add_job(
'user__audit',
json_build_object(
'type', v_type,
'user_id', v_user_id,
'extra1', v_extra1,
'extra2', v_extra2,
'extra3', v_extra3,
'current_user_id', app_public.current_user_id(),
'schema', TG_TABLE_SCHEMA,
'table', TG_TABLE_NAME
));
end if;
return NEW;
end;
$_$;
--
-- Name: FUNCTION tg__add_audit_job(); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.tg__add_audit_job() IS 'For notifying a user that an auditable action has taken place. Call with audit event name, user ID attribute name, and optionally another value to be included (e.g. the PK of the table, or some other relevant information). e.g. `tg__add_audit_job(''added_email'', ''user_id'', ''email'')`';
--
-- Name: tg__add_job(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg__add_job() RETURNS trigger
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
perform graphile_worker.add_job(tg_argv[0], json_build_object('id', NEW.id));
return NEW;
end;
$$;
--
-- Name: FUNCTION tg__add_job(); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.tg__add_job() IS 'Useful shortcut to create a job on insert/update. Pass the task name as the first trigger argument, and optionally the queue name as the second argument. The record id will automatically be available on the JSON payload.';
--
-- Name: tg__created(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg__created() RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_cata'
AS $$
begin
new.created_by = app_public.current_user_id();
new.is_verified = app_public.current_user_is_privileged ();
return new;
end;
$$;
--
-- Name: tg__timestamps(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg__timestamps() RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
NEW.created_at = (case when TG_OP = 'INSERT' then NOW() else OLD.created_at end);
NEW.updated_at = (case when TG_OP = 'UPDATE' and OLD.updated_at >= NOW() then OLD.updated_at + interval '1 millisecond' else NOW() end);
return NEW;
end;
$$;
--
-- Name: FUNCTION tg__timestamps(); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.tg__timestamps() IS 'This trigger should be called on all tables with created_at, updated_at - it ensures that they cannot be manipulated and that updated_at will always be larger than the previous updated_at.';
--
-- Name: tg_user_email_secrets__insert_with_user_email(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg_user_email_secrets__insert_with_user_email() RETURNS trigger
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_verification_token text;
begin
if NEW.is_verified is false then
v_verification_token = encode(gen_random_bytes(7), 'hex');
end if;
insert into app_private.user_email_secrets(user_email_id, verification_token) values(NEW.id, v_verification_token);
return NEW;
end;
$$;
--
-- Name: FUNCTION tg_user_email_secrets__insert_with_user_email(); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.tg_user_email_secrets__insert_with_user_email() IS 'Ensures that every user_email record has an associated user_email_secret record.';
--
-- Name: tg_user_secrets__insert_with_user(); Type: FUNCTION; Schema: app_private; Owner: -
--
CREATE FUNCTION app_private.tg_user_secrets__insert_with_user() RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
insert into app_private.user_secrets(user_id) values(NEW.id);
return NEW;
end;
$$;
--
-- Name: FUNCTION tg_user_secrets__insert_with_user(); Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON FUNCTION app_private.tg_user_secrets__insert_with_user() IS 'Ensures that every user record has an associated user_secret record.';
--
-- Name: accept_friend_request(uuid); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.accept_friend_request(user_id uuid) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
update app_public.friends
set status = 'accepted'
where user_id_1 = user_id
and user_id_2 = app_public.current_user_id();
end;
$$;
--
-- Name: change_password(text, text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.change_password(old_password text, new_password text) RETURNS boolean
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user app_public.users;
v_user_secret app_private.user_secrets;
begin
select users.* into v_user
from app_public.users
where id = app_public.current_user_id();
if not (v_user is null) then
-- Load their secrets
select * into v_user_secret from app_private.user_secrets
where user_secrets.user_id = v_user.id;
if v_user_secret.password_hash = crypt(old_password, v_user_secret.password_hash) then
perform app_private.assert_valid_password(new_password);
-- Reset the password as requested
update app_private.user_secrets
set
password_hash = crypt(<PASSWORD>, gen_salt('bf'))
where user_secrets.user_id = v_user.id;
perform graphile_worker.add_job(
'user__audit',
json_build_object(
'type', 'change_password',
'user_id', v_user.id,
'current_user_id', app_public.current_user_id()
));
return true;
else
raise exception 'Incorrect password' using errcode = 'CREDS';
end if;
else
raise exception 'You must log in to change your password' using errcode = 'LOGIN';
end if;
end;
$$;
--
-- Name: FUNCTION change_password(old_password text, new_password text); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.change_password(old_password text, new_password text) IS 'Enter your old password and a new password to change your password.';
--
-- Name: companies; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.companies (
id integer NOT NULL,
name text NOT NULL,
is_verified boolean DEFAULT false NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
created_by uuid,
description app_public.long_text,
CONSTRAINT companies_name_check CHECK (((length(name) >= 2) AND (length(name) <= 56)))
);
--
-- Name: companies_average_rating(app_public.companies); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.companies_average_rating(c app_public.companies) RETURNS integer
LANGUAGE sql STABLE
AS $$
with company_items_avg_by_user as (select ci.item_id, ci.author_id, avg(ci.rating) average from app_public.check_ins ci
left join app_public.items i on ci.item_id = i.id
left join app_public.brands b on i.brand_id = b.id
left join app_public.companies co on b.company_id = co.id where co.id = c.id group by (ci.item_id, ci.author_id)) select avg(average) as average from company_items_avg_by_user;
$$;
--
-- Name: companies_check_ins_past_month(app_public.companies); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.companies_check_ins_past_month(c app_public.companies) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1) from app_public.check_ins ci
left join app_public.items i on ci.item_id = i.id
left join app_public.brands b on i.brand_id = b.id
left join app_public.companies co on b.company_id = co.id
where co.id = c.id and ci.created_at >= current_date - interval '1 month';
$$;
--
-- Name: companies_current_user_check_ins(app_public.companies); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.companies_current_user_check_ins(c app_public.companies) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1) from app_public.check_ins ci
left join app_public.items i on ci.item_id = i.id
left join app_public.brands b on i.brand_id = b.id
left join app_public.companies co on b.company_id = co.id
where co.id = c.id and author_id = app_public.current_user_id()
$$;
--
-- Name: companies_total_check_ins(app_public.companies); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.companies_total_check_ins(c app_public.companies) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1) from app_public.check_ins ci
left join app_public.items i on ci.item_id = i.id
left join app_public.brands b on i.brand_id = b.id
left join app_public.companies co on b.company_id = co.id
where co.id = c.id
$$;
--
-- Name: companies_total_items(app_public.companies); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.companies_total_items(c app_public.companies) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1) from app_public.items i
left join app_public.brands b on i.brand_id = b.id
where c.id = b.company_id;
$$;
--
-- Name: confirm_account_deletion(text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.confirm_account_deletion(token text) RETURNS boolean
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user_secret app_private.user_secrets;
v_token_max_duration interval = interval '3 days';
begin
if app_public.current_user_id() is null then
raise exception 'You must log in to delete your account' using errcode = 'LOGIN';
end if;
select * into v_user_secret
from app_private.user_secrets
where user_secrets.user_id = app_public.current_user_id();
if v_user_secret is null then
-- Success: they're already deleted
return true;
end if;
-- Check the token
if (
-- token is still valid
v_user_secret.delete_account_token_generated > now() - v_token_max_duration
and
-- token matches
v_user_secret.delete_account_token = token
) then
-- Token passes; delete their account :(
delete from app_public.users where id = app_public.current_user_id();
return true;
end if;
raise exception 'The supplied token was incorrect - perhaps you''re logged in to the wrong account, or the token has expired?' using errcode = 'DNIED';
end;
$$;
--
-- Name: FUNCTION confirm_account_deletion(token text); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.confirm_account_deletion(token text) IS 'If you''re certain you want to delete your account, use `requestAccountDeletion` to request an account deletion token, and then supply the token through this mutation to complete account deletion.';
--
-- Name: brands; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.brands (
id integer NOT NULL,
name app_public.short_text,
company_id integer,
is_verified boolean,
created_by uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: create_brand(text, integer); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_brand(name text, company_id integer) RETURNS app_public.brands
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_is_verified boolean;
v_brand app_public.brands;
v_current_user uuid;
begin
select id into v_current_user from app_public.user_settings where id = app_public.current_user_id();
if app_public.current_user_id() is null then
raise exception 'You must log in to create a company' using errcode = 'LOGIN';
end if;
select is_admin into v_is_verified from app_public.users where id = v_current_user;
insert into app_public.brands (name, company_id, is_verified, created_by) values (name, company_id, v_is_verified, v_current_user) returning * into v_brand;
return v_brand;
end;
$$;
--
-- Name: check_ins; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.check_ins (
id integer NOT NULL,
rating integer,
review text,
item_id integer NOT NULL,
author_id uuid NOT NULL,
check_in_date date,
location uuid,
is_public boolean DEFAULT true,
created_at timestamp with time zone DEFAULT now() NOT NULL,
likes integer DEFAULT 0,
CONSTRAINT check_ins_rating CHECK (((rating >= 0) AND (rating <= 10))),
CONSTRAINT check_ins_review_check CHECK (((length(review) >= 1) AND (length(review) <= 1024)))
);
--
-- Name: TABLE check_ins; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.check_ins IS 'Check-in is a review given to an item';
--
-- Name: create_check_in(integer, text, integer, date); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_check_in(item_id integer, review text DEFAULT NULL::text, rating integer DEFAULT NULL::integer, check_in_date date DEFAULT NULL::date) RETURNS app_public.check_ins
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_is_public boolean;
v_check_in app_public.check_ins;
v_current_user uuid;
begin
select id into v_current_user from app_public.user_settings where id = app_public.current_user_id();
if v_current_user is null then
raise exception 'You must log in to create a check in' using errcode = 'LOGIN';
end if;
select is_public_check_ins into v_is_public from app_public.user_settings where id = v_current_user;
insert into app_public.check_ins (item_id, rating, review, author_id, is_public) values (item_id, rating, review, v_current_user, v_is_public) returning * into v_check_in;
return v_check_in;
end;
$$;
--
-- Name: check_in_comments; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.check_in_comments (
id integer NOT NULL,
check_in_id integer NOT NULL,
created_by uuid NOT NULL,
comment app_public.long_text,
created_at timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: create_check_in_comment(integer, text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_check_in_comment(target_check_in_id integer, comment text) RETURNS app_public.check_in_comments
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_check_in_exists boolean;
v_too_often boolean;
v_are_friends boolean;
v_current_user uuid;
v_check_in_id integer;
v_comment app_public.check_in_comments;
begin
v_current_user := app_public.current_user_id();
v_check_in_id := target_check_in_id;
if v_current_user is null then
raise exception 'You must log in to add a comment' using errcode = 'LOGIN';
end if;
select exists(select 1 from app_public.check_ins where id = v_check_in_id)
into v_check_in_exists;
if v_check_in_exists is false then
raise exception 'No such check in exists' using errcode = 'INVAL';
end if;
select exists(select 1
from app_public.check_in_comments c
left join app_public.check_ins ci on ci.id = c.check_in_id
left join app_public.friends f on ci.author_id = f.user_id_2
where f.user_id_1 = v_current_user)
into v_are_friends;
if v_are_friends is false then
raise exception 'You need to be friends to comment on a check in' using errcode = 'INVAL';
end if;
select exists(select 1
from app_public.check_in_comments c
where c.check_in_id = v_check_in_id
and c.created_at > NOW() - INTERVAL '1 minutes')
into v_too_often;
if v_too_often is true then
raise exception 'You can only comment on same check in once in one minute' using errcode = 'LIMIT';
end if;
insert into app_public.check_in_comments (created_by, check_in_id, comment)
values (v_current_user, check_in_id, comment)
returning * into v_comment;
return v_comment;
end;
$$;
--
-- Name: create_company(text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_company(company_name text) RETURNS app_public.companies
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_is_verified boolean;
v_company app_public.companies;
v_current_user uuid;
begin
select id into v_current_user from app_public.user_settings where id = app_public.current_user_id();
if app_public.current_user_id() is null then
raise exception 'You must log in to create a company' using errcode = 'LOGIN';
end if;
select is_admin into v_is_verified from app_public.users where id = v_current_user;
insert into app_public.companies (name, is_verified, created_by) values (company_name, v_is_verified, v_current_user) returning * into v_company;
return v_company;
end;
$$;
--
-- Name: FUNCTION create_company(company_name text); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.create_company(company_name text) IS 'Creates a new company. All arguments are required.';
--
-- Name: create_friend_request(uuid); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_friend_request(user_id uuid) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_request_exists boolean;
v_current_user uuid;
begin
v_current_user := app_public.current_user_id();
if v_current_user is null then
raise exception 'You must log in to create a friend request' using errcode = 'LOGIN';
end if;
select exists(select 1
from app_public.friends
where (user_id_1 = v_current_user and user_id_2 = user_id)
or (user_id_1 = user_id and user_id_2 = v_current_user))
into v_request_exists;
if v_request_exists is true then
raise exception 'Friend request already exists' using errcode = 'INVAL';
end if;
insert into app_public.friends (user_id_1, user_id_2) values (v_current_user, user_id);
end;
$$;
--
-- Name: items; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.items (
id integer NOT NULL,
flavor text,
description text,
type_id integer NOT NULL,
manufacturer_id integer NOT NULL,
is_verified boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
created_by uuid,
updated_by uuid,
brand_id integer NOT NULL,
CONSTRAINT items_description_check CHECK (((length(description) >= 2) AND (length(description) <= 512))),
CONSTRAINT items_flavor_check CHECK (((length(flavor) >= 2) AND (length(flavor) <= 99)))
);
--
-- Name: TABLE items; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.items IS 'Item defines a product that can be rated';
--
-- Name: create_item(text, integer, integer, integer, text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.create_item(flavor text, type_id integer, brand_id integer, manufacturer_id integer DEFAULT NULL::integer, description text DEFAULT NULL::text) RETURNS app_public.items
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_is_verified boolean;
v_item app_public.items;
v_current_user uuid;
begin
if app_public.current_user_id() is null then
raise exception 'You must log in to create an item' using errcode = 'LOGIN';
end if;
select id into v_current_user from app_public.user_settings where id = app_public.current_user_id();
select is_admin into v_is_verified from app_public.users where id = v_current_user;
insert into app_public.items (flavor, type_id, brand_id, manufacturer_id, description, is_verified, created_by, updated_by) values (flavor, type_id, brand_id, manufacturer_id, description, v_is_verified, v_current_user, v_current_user) returning * into v_item;
return v_item;
end;
$$;
--
-- Name: current_session_id(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.current_session_id() RETURNS uuid
LANGUAGE sql STABLE
AS $$
select nullif(pg_catalog.current_setting('jwt.claims.session_id', true), '')::uuid;
$$;
--
-- Name: FUNCTION current_session_id(); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.current_session_id() IS 'Handy method to get the current session ID.';
--
-- Name: current_user(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public."current_user"() RETURNS app_public.users
LANGUAGE sql STABLE
AS $$
select users.* from app_public.users where id = app_public.current_user_id();
$$;
--
-- Name: FUNCTION "current_user"(); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public."current_user"() IS 'The currently logged in user (or null if not logged in).';
--
-- Name: current_user_friends(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.current_user_friends() RETURNS SETOF uuid
LANGUAGE sql STABLE SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
select user_id_1 as user_id from app_public.friends
where user_id_2 = app_public.current_user_id() and status = 'accepted' union select user_id_2 as user_id from app_public.friends
where user_id_1 = app_public.current_user_id() and status = 'accepted'
$$;
--
-- Name: current_user_id(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.current_user_id() RETURNS uuid
LANGUAGE sql STABLE SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
select user_id from app_private.sessions where uuid = app_public.current_session_id();
$$;
--
-- Name: FUNCTION current_user_id(); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.current_user_id() IS 'Handy method to get the current user ID for use in RLS policies, etc; in GraphQL, use `currentUser{id}` instead.';
--
-- Name: current_user_is_privileged(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.current_user_is_privileged() RETURNS boolean
LANGUAGE sql STABLE SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
with current_user_roles as (
select role
from app_private.user_secrets where user_id = (select id from app_public.current_user())
)
select case when role = 'moderator' or role = 'admin' then true else false end as is_privileged
from current_user_roles;
$$;
--
-- Name: delete_friend(uuid); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.delete_friend(friend_id uuid) RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_is_friends boolean;
v_current_user uuid;
begin
v_current_user := app_public.current_user_id();
if v_current_user is null then
raise exception 'You must log in to remove a friend request or friendship' using errcode = 'LOGIN';
end if;
select exists(select 1
from app_public.friends
where (user_id_1 = v_current_user and user_id_2 = friend_id)
or (user_id_2 = v_current_user and user_id_1 = friend_id))
into v_is_friends;
if v_is_friends is false then
raise exception 'There is no such friend relation' using errcode = 'INVAL';
end if;
delete
from app_public.friends
where (user_id_1 = v_current_user and user_id_2 = friend_id)
or (user_id_2 = v_current_user and user_id_1 = friend_id);
end;
$$;
--
-- Name: forgot_password(public.citext); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.forgot_password(email public.citext) RETURNS void
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user_email app_public.user_emails;
v_token text;
v_token_min_duration_between_emails interval = interval '3 minutes';
v_token_max_duration interval = interval '3 days';
v_now timestamptz = clock_timestamp(); -- Function can be called multiple during transaction
v_latest_attempt timestamptz;
begin
-- Find the matching user_email:
select user_emails.* into v_user_email
from app_public.user_emails
where user_emails.email = forgot_password.email
order by is_verified desc, id desc;
-- If there is no match:
if v_user_email is null then
-- This email doesn't exist in the system; trigger an email stating as much.
-- We do not allow this email to be triggered more than once every 15
-- minutes, so we need to track it:
insert into app_private.unregistered_email_password_resets (email, latest_attempt)
values (forgot_password.email, v_now)
on conflict on constraint unregistered_email_pkey
do update
set latest_attempt = v_now, attempts = unregistered_email_password_resets.attempts + 1
where unregistered_email_password_resets.latest_attempt < v_now - interval '15 minutes'
returning latest_attempt into v_latest_attempt;
if v_latest_attempt = v_now then
perform graphile_worker.add_job(
'user__forgot_password_unregistered_email',
json_build_object('email', forgot_password.email::text)
);
end if;
-- TODO: we should clear out the unregistered_email_password_resets table periodically.
return;
end if;
-- There was a match.
-- See if we've triggered a reset recently:
if exists(
select 1
from app_private.user_email_secrets
where user_email_id = v_user_email.id
and password_reset_email_sent_at is not null
and password_reset_email_sent_at > v_now - v_token_min_duration_between_emails
) then
-- If so, take no action.
return;
end if;
-- Fetch or generate reset token:
update app_private.user_secrets
set
reset_password_token = (
case
when reset_password_token is null or reset_password_token_generated < v_now - v_token_max_duration
then encode(gen_random_bytes(7), 'hex')
else reset_password_token
end
),
reset_password_token_generated = (
case
when reset_password_token is null or reset_password_token_generated < v_now - v_token_max_duration
then v_now
else reset_password_token_generated
end
)
where user_id = v_user_email.user_id
returning reset_password_token into v_token;
-- Don't allow spamming an email:
update app_private.user_email_secrets
set password_reset_email_sent_at = v_now
where user_email_id = v_user_email.id;
-- Trigger email send:
perform graphile_worker.add_job(
'user__forgot_password',
json_build_object('id', v_user_email.user_id, 'email', v_user_email.email::text, 'token', v_token)
);
end;
$$;
--
-- Name: FUNCTION forgot_password(email public.citext); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.forgot_password(email public.citext) IS 'If you''ve forgotten your password, give us one of your email addresses and we''ll send you a reset token. Note this only works if you have added an email address!';
--
-- Name: items_average_rating(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_average_rating(i app_public.items) RETURNS numeric
LANGUAGE sql STABLE
AS $$
select avg(c.rating)::numeric(10,2) from app_public.check_ins c where c.item_id = i.id;
$$;
--
-- Name: items_check_ins_past_month(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_check_ins_past_month(i app_public.items) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1)
from app_public.check_ins
where item_id = i.id and created_at >= current_date - interval '1 month';
$$;
--
-- Name: items_current_user_check_ins(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_current_user_check_ins(i app_public.items) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1)
from app_public.check_ins
where item_id = i.id and author_id = app_public.current_user_id()
$$;
--
-- Name: items_is_tasted(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_is_tasted(i app_public.items) RETURNS boolean
LANGUAGE sql STABLE
AS $$
select exists(select 1
from app_public.check_ins c
where c.author_id = app_public.current_user_id()
and c.item_id = i.id)::boolean
$$;
--
-- Name: items_total_check_ins(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_total_check_ins(i app_public.items) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1)
from app_public.check_ins
where item_id = i.id
$$;
--
-- Name: items_unique_check_ins(app_public.items); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.items_unique_check_ins(i app_public.items) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(distinct c.author_id) from app_public.check_ins c where c.item_id = i.id;
$$;
--
-- Name: like_check_in(integer); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.like_check_in(check_in_id integer) RETURNS app_public.check_ins
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_check_in app_public.check_ins;
v_current_user uuid;
v_already_liked boolean;
begin
select id into v_current_user from app_public.user_settings where id = app_public.current_user_id();
if v_current_user is null then
raise exception 'You must log in to like a check in' using errcode = 'LOGIN';
end if;
select exists(select 1 from app_public.check_in_likes where liked_by = v_current_user and id = check_in_id) into v_already_liked;
if v_already_liked is true then
update app_public.check_ins set likes = likes - 1 where id = check_in_id;
delete from app_public.check_in_likes where id = check_in_id and liked_by = v_current_user;
select * from app_public.check_ins where id = check_in_id;
else
update app_public.check_ins set likes = likes + 1 where id = check_in_id;
insert into app_public.check_in_likes (id, liked_by) values (check_in_id, v_current_user) returning * into v_check_in;
end if;
return v_check_in;
end;
$$;
--
-- Name: logout(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.logout() RETURNS void
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
-- Delete the session
delete from app_private.sessions where uuid = app_public.current_session_id();
-- Clear the identifier from the transaction
perform set_config('jwt.claims.session_id', '', true);
end;
$$;
--
-- Name: user_emails; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.user_emails (
id uuid DEFAULT gen_random_uuid() NOT NULL,
user_id uuid DEFAULT app_public.current_user_id() NOT NULL,
email public.citext NOT NULL,
is_verified boolean DEFAULT false NOT NULL,
is_primary boolean DEFAULT false NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT user_emails_email_check CHECK ((email OPERATOR(public.~) '[^@]+@[^@]+\.[^@]+'::public.citext)),
CONSTRAINT user_emails_must_be_verified_to_be_primary CHECK (((is_primary IS FALSE) OR (is_verified IS TRUE)))
);
--
-- Name: TABLE user_emails; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.user_emails IS 'Information about a user''s email address.';
--
-- Name: COLUMN user_emails.email; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.user_emails.email IS 'The users email address, in `a@b.c` format.';
--
-- Name: COLUMN user_emails.is_verified; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.user_emails.is_verified IS 'True if the user has is_verified their email address (by clicking the link in the email we sent them, or logging in with a social login provider), false otherwise.';
--
-- Name: make_email_primary(uuid); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.make_email_primary(email_id uuid) RETURNS app_public.user_emails
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user_email app_public.user_emails;
begin
select * into v_user_email from app_public.user_emails where id = email_id and user_id = app_public.current_user_id();
if v_user_email is null then
raise exception 'That''s not your email' using errcode = 'DNIED';
return null;
end if;
if v_user_email.is_verified is false then
raise exception 'You may not make an unverified email primary' using errcode = 'VRFY1';
end if;
update app_public.user_emails set is_primary = false where user_id = app_public.current_user_id() and is_primary is true and id <> email_id;
update app_public.user_emails set is_primary = true where user_id = app_public.current_user_id() and is_primary is not true and id = email_id returning * into v_user_email;
return v_user_email;
end;
$$;
--
-- Name: FUNCTION make_email_primary(email_id uuid); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.make_email_primary(email_id uuid) IS 'Your primary email is where we''ll notify of account events; other emails may be used for discovery or login. Use this when you''re changing your email address.';
--
-- Name: request_account_deletion(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.request_account_deletion() RETURNS boolean
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
declare
v_user_email app_public.user_emails;
v_token text;
v_token_max_duration interval = interval '3 days';
begin
if app_public.current_user_id() is null then
raise exception 'You must log in to delete your account' using errcode = 'LOGIN';
end if;
-- Get the email to send account deletion token to
select * into v_user_email
from app_public.user_emails
where user_id = app_public.current_user_id()
order by is_primary desc, is_verified desc, id desc
limit 1;
-- Fetch or generate token
update app_private.user_secrets
set
delete_account_token = (
case
when delete_account_token is null or delete_account_token_generated < NOW() - v_token_max_duration
then encode(gen_random_bytes(7), 'hex')
else delete_account_token
end
),
delete_account_token_generated = (
case
when delete_account_token is null or delete_account_token_generated < NOW() - v_token_max_duration
then now()
else delete_account_token_generated
end
)
where user_id = app_public.current_user_id()
returning delete_account_token into v_token;
-- Trigger email send
perform graphile_worker.add_job('user__send_delete_account_email', json_build_object('email', v_user_email.email::text, 'token', v_token));
return true;
end;
$$;
--
-- Name: FUNCTION request_account_deletion(); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.request_account_deletion() IS 'Begin the account deletion flow by requesting the confirmation email';
--
-- Name: resend_email_verification_code(uuid); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.resend_email_verification_code(email_id uuid) RETURNS boolean
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
if exists(
select 1
from app_public.user_emails
where user_emails.id = email_id
and user_id = app_public.current_user_id()
and is_verified is false
) then
perform graphile_worker.add_job('user_emails__send_verification', json_build_object('id', email_id));
return true;
end if;
return false;
end;
$$;
--
-- Name: FUNCTION resend_email_verification_code(email_id uuid); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.resend_email_verification_code(email_id uuid) IS 'If you didn''t receive the verification code for this email, we can resend it. We silently cap the rate of resends on the backend, so calls to this function may not result in another email being sent if it has been called recently.';
--
-- Name: search_items(text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.search_items(search text) RETURNS SETOF app_public.items
LANGUAGE sql STABLE
AS $$
with search_agg as (
select i.id ,
to_tsvector(i.flavor) ||
to_tsvector(b.name) ||
to_tsvector(c.name) as document
from app_public.items i
join app_public.brands b on i.brand_id = b.id
join app_public.companies c on c.id = b.company_id
) select i.* from search_agg s left join app_public.items i on i.id = s.id where document @@ plainto_tsquery(search);
$$;
--
-- Name: search_users(text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.search_users(search text) RETURNS SETOF app_public.users
LANGUAGE sql STABLE
AS $$
select *
from app_public.users
where
username ilike ('%' || search || '%') or
concat(first_name, ' ', last_name) ilike ('%' || search || '%')
$$;
--
-- Name: stamp_liked_by(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.stamp_liked_by() RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
NEW.liked_by = app_public.current_user_id();
return NEW;
end;
$$;
--
-- Name: tg__friend_status(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg__friend_status() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
if old.status = 'blocked' and
new.status = 'accepted' then
new.blocked_by = null;
elseif old.status in ('accepted', 'blocked') and
new.status = 'pending' then
raise exception 'friend status cannot be changed back to pending';
end if;
return new;
end;
$$;
--
-- Name: tg__graphql_subscription(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg__graphql_subscription() RETURNS trigger
LANGUAGE plpgsql
AS $_$
declare
v_process_new bool = (TG_OP = 'INSERT' OR TG_OP = 'UPDATE');
v_process_old bool = (TG_OP = 'UPDATE' OR TG_OP = 'DELETE');
v_event text = TG_ARGV[0];
v_topic_template text = TG_ARGV[1];
v_attribute text = TG_ARGV[2];
v_record record;
v_sub text;
v_topic text;
v_i int = 0;
v_last_topic text;
begin
for v_i in 0..1 loop
if (v_i = 0) and v_process_new is true then
v_record = new;
elsif (v_i = 1) and v_process_old is true then
v_record = old;
else
continue;
end if;
if v_attribute is not null then
execute 'select $1.' || quote_ident(v_attribute)
using v_record
into v_sub;
end if;
if v_sub is not null then
v_topic = replace(v_topic_template, '$1', v_sub);
else
v_topic = v_topic_template;
end if;
if v_topic is distinct from v_last_topic then
-- This if statement prevents us from triggering the same notification twice
v_last_topic = v_topic;
perform pg_notify(v_topic, json_build_object(
'event', v_event,
'subject', v_sub,
'id', v_record.id
)::text);
end if;
end loop;
return v_record;
end;
$_$;
--
-- Name: FUNCTION tg__graphql_subscription(); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.tg__graphql_subscription() IS 'This function enables the creation of simple focussed GraphQL subscriptions using database triggers. Read more here: https://www.graphile.org/postgraphile/subscriptions/#custom-subscriptions';
--
-- Name: tg__updated(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg__updated() RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_cata'
AS $$
begin
new.updated_by = app_public.current_user_id();
new.updated_at = now();
return new;
end;
$$;
--
-- Name: tg_user_emails__forbid_if_verified(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg_user_emails__forbid_if_verified() RETURNS trigger
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
if exists(select 1 from app_public.user_emails where email = NEW.email and is_verified is true) then
raise exception 'An account using that email address has already been created.' using errcode='EMTKN';
end if;
return NEW;
end;
$$;
--
-- Name: tg_user_emails__prevent_delete_last_email(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg_user_emails__prevent_delete_last_email() RETURNS trigger
LANGUAGE plpgsql SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
if exists (
with remaining as (
select user_emails.user_id
from app_public.user_emails
inner join deleted
on user_emails.user_id = deleted.user_id
-- Don't delete last verified email
where (user_emails.is_verified is true or not exists (
select 1
from deleted d2
where d2.user_id = user_emails.user_id
and d2.is_verified is true
))
order by user_emails.id asc
/*
* Lock this table to prevent race conditions; see:
* https://www.cybertec-postgresql.com/en/triggers-to-enforce-constraints/
*/
for update of user_emails
)
select 1
from app_public.users
where id in (
select user_id from deleted
except
select user_id from remaining
)
)
then
raise exception 'You must have at least one (verified) email address' using errcode = 'CDLEA';
end if;
return null;
end;
$$;
--
-- Name: tg_user_emails__verify_account_on_verified(); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.tg_user_emails__verify_account_on_verified() RETURNS trigger
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
update app_public.users set is_verified = true where id = new.user_id and is_verified is false;
return new;
end;
$$;
--
-- Name: users_friend_status(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_friend_status(u app_public.users) RETURNS TABLE(status app_public.friend_status, is_sender boolean)
LANGUAGE sql STABLE
AS $$
select status, case when (user_id_1 = app_public.current_user_id()) then true else false end as is_sender
from app_public.friends
where (user_id_1 = u.id and user_id_2 = app_public.current_user_id())
or (user_id_2 = u.id and user_id_1 = app_public.current_user_id())
$$;
--
-- Name: users_friends(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_friends(u app_public.users) RETURNS TABLE(id uuid, first_name text, last_name text, username text, avatar_url text, status app_public.friend_status, is_sender boolean)
LANGUAGE sql STABLE
AS $$
with user_friends as (select urs.id, urs.first_name, urs.last_name, urs.username, urs.avatar_url
from app_public.friends f
left join app_public.users urs
on (f.user_id_2 = urs.id and f.user_id_1 = u.id) or
(f.user_id_1 = urs.id and f.user_id_2 = u.id)
where f.user_id_1 = u.id
or f.user_id_2 = u.id)
select uf.*,
f.status status,
case when (user_id_1 = app_public.current_user_id()) then true else false end as is_sender
from user_friends uf
left join app_public.friends f
on (f.user_id_1 = uf.id and f.user_id_2 = app_public.current_user_id()) or
(f.user_id_2 = uf.id and f.user_id_1 = app_public.current_user_id());
$$;
--
-- Name: users_has_password(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_has_password(u app_public.users) RETURNS boolean
LANGUAGE sql STABLE SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
select (password_hash is not null) from app_private.user_secrets where user_secrets.user_id = u.id and u.id = app_public.current_user_id();
$$;
--
-- Name: users_total_check_ins(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_total_check_ins(u app_public.users) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1)
from app_public.check_ins
where author_id = u.id;
$$;
--
-- Name: users_total_friends(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_total_friends(u app_public.users) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(1)
from app_public.friends
where (user_id_1 = u.id
or user_id_2 = u.id) and status = 'accepted';
$$;
--
-- Name: users_unique_check_ins(app_public.users); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.users_unique_check_ins(u app_public.users) RETURNS integer
LANGUAGE sql STABLE
AS $$
select count(distinct item_id)
from app_public.check_ins
where author_id = u.id;
$$;
--
-- Name: verify_email(uuid, text); Type: FUNCTION; Schema: app_public; Owner: -
--
CREATE FUNCTION app_public.verify_email(user_email_id uuid, token text) RETURNS boolean
LANGUAGE plpgsql STRICT SECURITY DEFINER
SET search_path TO 'pg_catalog', 'public', 'pg_temp'
AS $$
begin
update app_public.user_emails
set
is_verified = true,
is_primary = is_primary or not exists(
select 1 from app_public.user_emails other_email where other_email.user_id = user_emails.user_id and other_email.is_primary is true
)
where id = user_email_id
and exists(
select 1 from app_private.user_email_secrets where user_email_secrets.user_email_id = user_emails.id and verification_token = token
);
return found;
end;
$$;
--
-- Name: FUNCTION verify_email(user_email_id uuid, token text); Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON FUNCTION app_public.verify_email(user_email_id uuid, token text) IS 'Once you have received a verification token for your email, you may call this mutation with that token to make your email verified.';
--
-- Name: connect_pg_simple_sessions; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.connect_pg_simple_sessions (
sid character varying NOT NULL,
sess json NOT NULL,
expire timestamp without time zone NOT NULL
);
--
-- Name: transferable_check_ins; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.transferable_check_ins (
company text,
brand text,
flavor text,
category text,
style text,
rating text
);
--
-- Name: unregistered_email_password_resets; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.unregistered_email_password_resets (
email public.citext NOT NULL,
attempts integer DEFAULT 1 NOT NULL,
latest_attempt timestamp with time zone NOT NULL
);
--
-- Name: TABLE unregistered_email_password_resets; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON TABLE app_private.unregistered_email_password_resets IS 'If someone tries to recover the password for an email that is not registered in our system, this table enables us to rate-limit outgoing emails to avoid spamming.';
--
-- Name: COLUMN unregistered_email_password_resets.attempts; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON COLUMN app_private.unregistered_email_password_resets.attempts IS 'We store the number of attempts to help us detect accounts being attacked.';
--
-- Name: COLUMN unregistered_email_password_resets.latest_attempt; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON COLUMN app_private.unregistered_email_password_resets.latest_attempt IS 'We store the time the last password reset was sent to this email to prevent the email getting flooded.';
--
-- Name: user_authentication_secrets; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.user_authentication_secrets (
user_authentication_id uuid NOT NULL,
details jsonb DEFAULT '{}'::jsonb NOT NULL
);
--
-- Name: user_email_secrets; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.user_email_secrets (
user_email_id uuid NOT NULL,
verification_token text,
verification_email_sent_at timestamp with time zone,
password_reset_email_sent_at timestamp with time zone
);
--
-- Name: TABLE user_email_secrets; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON TABLE app_private.user_email_secrets IS 'The contents of this table should never be visible to the user. Contains data mostly related to email verification and avoiding spamming users.';
--
-- Name: COLUMN user_email_secrets.password_reset_email_sent_at; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON COLUMN app_private.user_email_secrets.password_reset_email_sent_at IS 'We store the time the last password reset was sent to this email to prevent the email getting flooded.';
--
-- Name: user_secrets; Type: TABLE; Schema: app_private; Owner: -
--
CREATE TABLE app_private.user_secrets (
user_id uuid NOT NULL,
password_hash text,
last_login_at timestamp with time zone DEFAULT now() NOT NULL,
failed_password_attempts integer DEFAULT 0 NOT NULL,
first_failed_password_attempt timestamp with time zone,
reset_password_token text,
reset_password_token_generated timestamp with time zone,
failed_reset_password_attempts integer DEFAULT 0 NOT NULL,
first_failed_reset_password_attempt timestamp with time zone,
delete_account_token text,
delete_account_token_generated timestamp with time zone,
role app_private.role DEFAULT 'user'::app_private.role
);
--
-- Name: TABLE user_secrets; Type: COMMENT; Schema: app_private; Owner: -
--
COMMENT ON TABLE app_private.user_secrets IS 'The contents of this table should never be visible to the user. Contains data mostly related to authentication.';
--
-- Name: friends; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.friends (
user_id_1 uuid NOT NULL,
user_id_2 uuid NOT NULL,
status app_public.friend_status DEFAULT 'pending'::app_public.friend_status NOT NULL,
sent date DEFAULT now() NOT NULL,
accepted date,
blocked_by uuid,
id integer NOT NULL,
CONSTRAINT friends_check CHECK ((user_id_1 <> user_id_2))
);
--
-- Name: activity_feed; Type: VIEW; Schema: app_public; Owner: -
--
CREATE VIEW app_public.activity_feed AS
SELECT check_ins.id,
check_ins.rating,
check_ins.review,
check_ins.item_id,
check_ins.author_id,
check_ins.check_in_date,
check_ins.location,
check_ins.is_public,
check_ins.created_at,
check_ins.likes
FROM (app_public.check_ins
LEFT JOIN app_public.friends f ON (((check_ins.author_id = f.user_id_2) OR (check_ins.author_id = f.user_id_1))))
WHERE (f.status = 'accepted'::app_public.friend_status)
ORDER BY check_ins.created_at;
--
-- Name: VIEW activity_feed; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON VIEW app_public.activity_feed IS '@foreignKey (item_id) references app_public.items(id)
@foreignKey (author_id) references app_public.users(id)';
--
-- Name: brands_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.brands_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: brands_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.brands_id_seq OWNED BY app_public.brands.id;
--
-- Name: categories; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.categories (
name character varying(40) NOT NULL
);
--
-- Name: TABLE categories; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.categories IS 'Main categories for items';
--
-- Name: check_in_comments_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.check_in_comments_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: check_in_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.check_in_comments_id_seq OWNED BY app_public.check_in_comments.id;
--
-- Name: check_in_friends; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.check_in_friends (
check_in_id integer,
friend_id uuid
);
--
-- Name: check_in_likes; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.check_in_likes (
id integer NOT NULL,
liked_by uuid
);
--
-- Name: check_in_likes_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.check_in_likes_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: check_in_likes_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.check_in_likes_id_seq OWNED BY app_public.check_in_likes.id;
--
-- Name: check_in_tags; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.check_in_tags (
check_in_id integer NOT NULL,
tag_id integer NOT NULL
);
--
-- Name: check_ins_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.check_ins_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: check_ins_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.check_ins_id_seq OWNED BY app_public.check_ins.id;
--
-- Name: companies_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.companies_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: companies_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.companies_id_seq OWNED BY app_public.companies.id;
--
-- Name: company_likes; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.company_likes (
id integer NOT NULL,
liked_by uuid NOT NULL
);
--
-- Name: current_user_friends; Type: VIEW; Schema: app_public; Owner: -
--
CREATE VIEW app_public.current_user_friends AS
SELECT u.first_name,
u.last_name,
u.username,
u.avatar_url,
f.status,
f.id,
u.id AS user_id
FROM (app_public.friends f
LEFT JOIN app_public.users u ON ((((f.user_id_2 = u.id) OR (f.user_id_1 = u.id)) AND (u.id <> app_public.current_user_id()))))
WHERE ((f.user_id_1 = app_public.current_user_id()) OR (f.user_id_2 = app_public.current_user_id()));
--
-- Name: friends_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.friends_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.friends_id_seq OWNED BY app_public.friends.id;
--
-- Name: item_edit_suggestions; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.item_edit_suggestions (
id integer NOT NULL,
description app_public.long_text,
flavor app_public.short_text,
created_at timestamp with time zone DEFAULT now() NOT NULL,
item_id integer NOT NULL,
manufacturer_id integer,
brand_id integer NOT NULL,
author_id uuid NOT NULL,
accepted timestamp with time zone,
type_id integer NOT NULL
);
--
-- Name: item_edit_suggestions_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.item_edit_suggestions_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: item_edit_suggestions_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.item_edit_suggestions_id_seq OWNED BY app_public.item_edit_suggestions.id;
--
-- Name: items_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.items_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.items_id_seq OWNED BY app_public.items.id;
--
-- Name: public_check_ins; Type: VIEW; Schema: app_public; Owner: -
--
CREATE VIEW app_public.public_check_ins AS
SELECT check_ins.id,
check_ins.rating,
check_ins.review,
check_ins.item_id,
check_ins.author_id,
check_ins.check_in_date,
check_ins.location,
check_ins.is_public,
check_ins.created_at
FROM app_public.check_ins
WHERE (check_ins.is_public IS TRUE);
--
-- Name: user_settings; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.user_settings (
id uuid NOT NULL,
is_public_check_ins boolean DEFAULT true,
is_public boolean DEFAULT true
);
--
-- Name: public_users; Type: VIEW; Schema: app_public; Owner: -
--
CREATE VIEW app_public.public_users AS
WITH public_users AS (
SELECT u.id,
u.username,
u.avatar_url,
u.is_admin,
u.is_verified,
u.created_at,
u.updated_at,
u.first_name,
u.last_name,
u.location,
u.country
FROM (app_public.users u
LEFT JOIN app_public.user_settings s ON ((u.id = s.id)))
WHERE (s.is_public = true)
)
SELECT p.id,
p.username,
p.avatar_url,
p.is_admin,
p.is_verified,
p.created_at,
p.updated_at,
p.first_name,
p.last_name,
p.location,
p.country,
f.status
FROM (public_users p
LEFT JOIN app_public.friends f ON ((((f.user_id_1 = app_public.current_user_id()) AND (p.id = f.user_id_2)) OR ((f.user_id_1 = p.id) AND (f.user_id_1 = app_public.current_user_id())))))
WHERE (p.id <> app_public.current_user_id());
--
-- Name: tags; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.tags (
id integer NOT NULL,
name text,
created_by uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
is_verified boolean DEFAULT false NOT NULL,
CONSTRAINT tag_name_check CHECK (((length(name) >= 2) AND (length(name) <= 10)))
);
--
-- Name: TABLE tags; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.tags IS 'Tag for an item or check-in';
--
-- Name: tags_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.tags_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.tags_id_seq OWNED BY app_public.tags.id;
--
-- Name: types; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.types (
id integer NOT NULL,
name text NOT NULL,
category text NOT NULL
);
--
-- Name: TABLE types; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.types IS 'Type item that is part of a category';
--
-- Name: types_id_seq; Type: SEQUENCE; Schema: app_public; Owner: -
--
CREATE SEQUENCE app_public.types_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: types_id_seq; Type: SEQUENCE OWNED BY; Schema: app_public; Owner: -
--
ALTER SEQUENCE app_public.types_id_seq OWNED BY app_public.types.id;
--
-- Name: user_authentications; Type: TABLE; Schema: app_public; Owner: -
--
CREATE TABLE app_public.user_authentications (
id uuid DEFAULT gen_random_uuid() NOT NULL,
user_id uuid NOT NULL,
service text NOT NULL,
identifier text NOT NULL,
details jsonb DEFAULT '{}'::jsonb NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: TABLE user_authentications; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON TABLE app_public.user_authentications IS 'Contains information about the login providers this user has used, so that they may disconnect them should they wish.';
--
-- Name: COLUMN user_authentications.service; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.user_authentications.service IS 'The login service used, e.g. `twitter` or `github`.';
--
-- Name: COLUMN user_authentications.identifier; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.user_authentications.identifier IS 'A unique identifier for the user within the login service.';
--
-- Name: COLUMN user_authentications.details; Type: COMMENT; Schema: app_public; Owner: -
--
COMMENT ON COLUMN app_public.user_authentications.details IS 'Additional profile details extracted from this login method';
--
-- Name: brands id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.brands ALTER COLUMN id SET DEFAULT nextval('app_public.brands_id_seq'::regclass);
--
-- Name: check_in_comments id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_comments ALTER COLUMN id SET DEFAULT nextval('app_public.check_in_comments_id_seq'::regclass);
--
-- Name: check_in_likes id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_likes ALTER COLUMN id SET DEFAULT nextval('app_public.check_in_likes_id_seq'::regclass);
--
-- Name: check_ins id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_ins ALTER COLUMN id SET DEFAULT nextval('app_public.check_ins_id_seq'::regclass);
--
-- Name: companies id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.companies ALTER COLUMN id SET DEFAULT nextval('app_public.companies_id_seq'::regclass);
--
-- Name: friends id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.friends ALTER COLUMN id SET DEFAULT nextval('app_public.friends_id_seq'::regclass);
--
-- Name: item_edit_suggestions id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions ALTER COLUMN id SET DEFAULT nextval('app_public.item_edit_suggestions_id_seq'::regclass);
--
-- Name: items id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items ALTER COLUMN id SET DEFAULT nextval('app_public.items_id_seq'::regclass);
--
-- Name: tags id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.tags ALTER COLUMN id SET DEFAULT nextval('app_public.tags_id_seq'::regclass);
--
-- Name: types id; Type: DEFAULT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.types ALTER COLUMN id SET DEFAULT nextval('app_public.types_id_seq'::regclass);
--
-- Name: connect_pg_simple_sessions session_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.connect_pg_simple_sessions
ADD CONSTRAINT session_pkey PRIMARY KEY (sid);
--
-- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.sessions
ADD CONSTRAINT sessions_pkey PRIMARY KEY (uuid);
--
-- Name: unregistered_email_password_resets unregistered_email_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.unregistered_email_password_resets
ADD CONSTRAINT unregistered_email_pkey PRIMARY KEY (email);
--
-- Name: user_authentication_secrets user_authentication_secrets_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_authentication_secrets
ADD CONSTRAINT user_authentication_secrets_pkey PRIMARY KEY (user_authentication_id);
--
-- Name: user_email_secrets user_email_secrets_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_email_secrets
ADD CONSTRAINT user_email_secrets_pkey PRIMARY KEY (user_email_id);
--
-- Name: user_secrets user_secrets_pkey; Type: CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_secrets
ADD CONSTRAINT user_secrets_pkey PRIMARY KEY (user_id);
--
-- Name: brands brands_company_id_name_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.brands
ADD CONSTRAINT brands_company_id_name_key UNIQUE (company_id, name);
--
-- Name: brands brands_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.brands
ADD CONSTRAINT brands_pkey PRIMARY KEY (id);
--
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.categories
ADD CONSTRAINT categories_pkey PRIMARY KEY (name);
--
-- Name: check_in_comments check_in_comments_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_comments
ADD CONSTRAINT check_in_comments_pkey PRIMARY KEY (id);
--
-- Name: check_in_likes check_in_likes_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_likes
ADD CONSTRAINT check_in_likes_pkey PRIMARY KEY (id);
--
-- Name: check_in_tags check_in_tags_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_tags
ADD CONSTRAINT check_in_tags_pkey PRIMARY KEY (check_in_id, tag_id);
--
-- Name: check_ins check_ins_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_ins
ADD CONSTRAINT check_ins_pkey PRIMARY KEY (id);
--
-- Name: companies companies_name_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.companies
ADD CONSTRAINT companies_name_key UNIQUE (name);
--
-- Name: companies companies_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.companies
ADD CONSTRAINT companies_pkey PRIMARY KEY (id);
--
-- Name: company_likes company_likes_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.company_likes
ADD CONSTRAINT company_likes_pkey PRIMARY KEY (id, liked_by);
--
-- Name: friends friends_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.friends
ADD CONSTRAINT friends_pkey PRIMARY KEY (user_id_1, user_id_2);
--
-- Name: item_edit_suggestions item_edit_suggestions_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_pkey PRIMARY KEY (id);
--
-- Name: items items_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_pkey PRIMARY KEY (id);
--
-- Name: items itens_brand_id_flavor_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT itens_brand_id_flavor_key UNIQUE (brand_id, flavor);
--
-- Name: tags tags_name_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.tags
ADD CONSTRAINT tags_name_key UNIQUE (name);
--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
--
-- Name: types types_name_category_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.types
ADD CONSTRAINT types_name_category_key UNIQUE (name, category);
--
-- Name: types types_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.types
ADD CONSTRAINT types_pkey PRIMARY KEY (id);
--
-- Name: user_authentications uniq_user_authentications; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_authentications
ADD CONSTRAINT uniq_user_authentications UNIQUE (service, identifier);
--
-- Name: user_authentications user_authentications_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_authentications
ADD CONSTRAINT user_authentications_pkey PRIMARY KEY (id);
--
-- Name: user_emails user_emails_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_emails
ADD CONSTRAINT user_emails_pkey PRIMARY KEY (id);
--
-- Name: user_emails user_emails_user_id_email_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_emails
ADD CONSTRAINT user_emails_user_id_email_key UNIQUE (user_id, email);
--
-- Name: user_settings user_settings_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_settings
ADD CONSTRAINT user_settings_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: users users_username_key; Type: CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.users
ADD CONSTRAINT users_username_key UNIQUE (username);
--
-- Name: sessions_user_id_idx; Type: INDEX; Schema: app_private; Owner: -
--
CREATE INDEX sessions_user_id_idx ON app_private.sessions USING btree (user_id);
--
-- Name: brands_created_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX brands_created_by_idx ON app_public.brands USING btree (created_by);
--
-- Name: check_in_comments_check_in_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_comments_check_in_id_idx ON app_public.check_in_comments USING btree (check_in_id);
--
-- Name: check_in_comments_created_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_comments_created_by_idx ON app_public.check_in_comments USING btree (created_by);
--
-- Name: check_in_friends_check_in_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_friends_check_in_id_idx ON app_public.check_in_friends USING btree (check_in_id);
--
-- Name: check_in_friends_friend_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_friends_friend_id_idx ON app_public.check_in_friends USING btree (friend_id);
--
-- Name: check_in_likes_liked_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_likes_liked_by_idx ON app_public.check_in_likes USING btree (liked_by);
--
-- Name: check_in_tags_tag_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_in_tags_tag_id_idx ON app_public.check_in_tags USING btree (tag_id);
--
-- Name: check_ins_author_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_ins_author_idx ON app_public.check_ins USING btree (author_id);
--
-- Name: check_ins_created_at_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_ins_created_at_idx ON app_public.check_ins USING btree (created_at);
--
-- Name: check_ins_item_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_ins_item_id_idx ON app_public.check_ins USING btree (item_id);
--
-- Name: check_ins_item_id_idx1; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_ins_item_id_idx1 ON app_public.check_ins USING btree (item_id);
--
-- Name: check_ins_location_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX check_ins_location_idx ON app_public.check_ins USING btree (location);
--
-- Name: companies_created_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX companies_created_by_idx ON app_public.companies USING btree (created_by);
--
-- Name: companies_name_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX companies_name_idx ON app_public.companies USING btree (name);
--
-- Name: friends_blocked_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX friends_blocked_by_idx ON app_public.friends USING btree (blocked_by);
--
-- Name: friends_user_id_1_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX friends_user_id_1_idx ON app_public.friends USING btree (user_id_1);
--
-- Name: friends_user_id_2_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX friends_user_id_2_idx ON app_public.friends USING btree (user_id_2);
--
-- Name: idx_user_emails_primary; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX idx_user_emails_primary ON app_public.user_emails USING btree (is_primary, user_id);
--
-- Name: idx_user_emails_user; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX idx_user_emails_user ON app_public.user_emails USING btree (user_id);
--
-- Name: item_edit_suggestions_author_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_author_id_idx ON app_public.item_edit_suggestions USING btree (author_id);
--
-- Name: item_edit_suggestions_brand_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_brand_id_idx ON app_public.item_edit_suggestions USING btree (brand_id);
--
-- Name: item_edit_suggestions_item_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_item_id_idx ON app_public.item_edit_suggestions USING btree (item_id);
--
-- Name: item_edit_suggestions_manufacturer_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_manufacturer_id_idx ON app_public.item_edit_suggestions USING btree (manufacturer_id);
--
-- Name: item_edit_suggestions_type_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_type_id_idx ON app_public.item_edit_suggestions USING btree (type_id);
--
-- Name: item_edit_suggestions_type_id_idx1; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX item_edit_suggestions_type_id_idx1 ON app_public.item_edit_suggestions USING btree (type_id);
--
-- Name: items_brand_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_brand_id_idx ON app_public.items USING btree (brand_id);
--
-- Name: items_brand_id_idx1; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_brand_id_idx1 ON app_public.items USING btree (brand_id);
--
-- Name: items_created_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_created_by_idx ON app_public.items USING btree (created_by);
--
-- Name: items_flavor_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_flavor_idx ON app_public.items USING btree (flavor);
--
-- Name: items_manufacturer_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_manufacturer_idx ON app_public.items USING btree (manufacturer_id);
--
-- Name: items_type_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_type_id_idx ON app_public.items USING btree (type_id);
--
-- Name: items_type_id_idx1; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_type_id_idx1 ON app_public.items USING btree (type_id);
--
-- Name: items_updated_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX items_updated_by_idx ON app_public.items USING btree (updated_by);
--
-- Name: tags_created_by_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX tags_created_by_idx ON app_public.tags USING btree (created_by);
--
-- Name: types_category_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX types_category_idx ON app_public.types USING btree (category);
--
-- Name: uniq_user_emails_primary_email; Type: INDEX; Schema: app_public; Owner: -
--
CREATE UNIQUE INDEX uniq_user_emails_primary_email ON app_public.user_emails USING btree (user_id) WHERE (is_primary IS TRUE);
--
-- Name: uniq_user_emails_verified_email; Type: INDEX; Schema: app_public; Owner: -
--
CREATE UNIQUE INDEX uniq_user_emails_verified_email ON app_public.user_emails USING btree (email) WHERE (is_verified IS TRUE);
--
-- Name: unique_friend_relation_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE UNIQUE INDEX unique_friend_relation_idx ON app_public.friends USING btree (LEAST(user_id_1, user_id_2), GREATEST(user_id_1, user_id_2));
--
-- Name: user_authentications_user_id_idx; Type: INDEX; Schema: app_public; Owner: -
--
CREATE INDEX user_authentications_user_id_idx ON app_public.user_authentications USING btree (user_id);
--
-- Name: tags _100_timestamps; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _100_timestamps BEFORE INSERT ON app_public.tags FOR EACH ROW EXECUTE FUNCTION app_private.tg__created();
--
-- Name: user_authentications _100_timestamps; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _100_timestamps BEFORE INSERT OR UPDATE ON app_public.user_authentications FOR EACH ROW EXECUTE FUNCTION app_private.tg__timestamps();
--
-- Name: user_emails _100_timestamps; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _100_timestamps BEFORE INSERT OR UPDATE ON app_public.user_emails FOR EACH ROW EXECUTE FUNCTION app_private.tg__timestamps();
--
-- Name: users _100_timestamps; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _100_timestamps BEFORE INSERT OR UPDATE ON app_public.users FOR EACH ROW EXECUTE FUNCTION app_private.tg__timestamps();
--
-- Name: items _100_updated_by; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _100_updated_by BEFORE UPDATE ON app_public.items FOR EACH ROW EXECUTE FUNCTION app_public.tg__updated();
--
-- Name: user_emails _200_forbid_existing_email; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _200_forbid_existing_email BEFORE INSERT ON app_public.user_emails FOR EACH ROW EXECUTE FUNCTION app_public.tg_user_emails__forbid_if_verified();
--
-- Name: user_emails _500_audit_added; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_audit_added AFTER INSERT ON app_public.user_emails FOR EACH ROW EXECUTE FUNCTION app_private.tg__add_audit_job('added_email', 'user_id', 'id', 'email');
--
-- Name: user_authentications _500_audit_removed; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_audit_removed AFTER DELETE ON app_public.user_authentications FOR EACH ROW EXECUTE FUNCTION app_private.tg__add_audit_job('unlinked_account', 'user_id', 'service', 'identifier');
--
-- Name: user_emails _500_audit_removed; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_audit_removed AFTER DELETE ON app_public.user_emails FOR EACH ROW EXECUTE FUNCTION app_private.tg__add_audit_job('removed_email', 'user_id', 'id', 'email');
--
-- Name: friends _500_gql_insert; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_gql_insert AFTER INSERT ON app_public.friends FOR EACH ROW EXECUTE FUNCTION app_public.tg__graphql_subscription('friendRequestChange', 'graphql:user:$1', 'user_id_2');
--
-- Name: friends _500_gql_update; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_gql_update AFTER UPDATE ON app_public.friends FOR EACH ROW EXECUTE FUNCTION app_public.tg__graphql_subscription('friendRequestChange', 'graphql:user:$1', 'id');
--
-- Name: users _500_gql_update; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_gql_update AFTER UPDATE ON app_public.users FOR EACH ROW EXECUTE FUNCTION app_public.tg__graphql_subscription('userChanged', 'graphql:user:$1', 'id');
--
-- Name: user_emails _500_insert_secrets; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_insert_secrets AFTER INSERT ON app_public.user_emails FOR EACH ROW EXECUTE FUNCTION app_private.tg_user_email_secrets__insert_with_user_email();
--
-- Name: users _500_insert_secrets; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_insert_secrets AFTER INSERT ON app_public.users FOR EACH ROW EXECUTE FUNCTION app_private.tg_user_secrets__insert_with_user();
--
-- Name: user_emails _500_prevent_delete_last; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_prevent_delete_last AFTER DELETE ON app_public.user_emails REFERENCING OLD TABLE AS deleted FOR EACH STATEMENT EXECUTE FUNCTION app_public.tg_user_emails__prevent_delete_last_email();
--
-- Name: user_emails _500_verify_account_on_verified; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _500_verify_account_on_verified AFTER INSERT OR UPDATE OF is_verified ON app_public.user_emails FOR EACH ROW WHEN ((new.is_verified IS TRUE)) EXECUTE FUNCTION app_public.tg_user_emails__verify_account_on_verified();
--
-- Name: user_emails _900_send_verification_email; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER _900_send_verification_email AFTER INSERT ON app_public.user_emails FOR EACH ROW WHEN ((new.is_verified IS FALSE)) EXECUTE FUNCTION app_private.tg__add_job('user_emails__send_verification');
--
-- Name: friends check_friendship_status; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER check_friendship_status BEFORE UPDATE ON app_public.friends FOR EACH ROW EXECUTE FUNCTION app_public.tg__friend_status();
--
-- Name: company_likes stamp_liked_by_for_company_likes; Type: TRIGGER; Schema: app_public; Owner: -
--
CREATE TRIGGER stamp_liked_by_for_company_likes BEFORE INSERT ON app_public.company_likes FOR EACH ROW EXECUTE FUNCTION app_public.stamp_liked_by();
--
-- Name: sessions sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.sessions
ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: user_authentication_secrets user_authentication_secrets_user_authentication_id_fkey; Type: FK CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_authentication_secrets
ADD CONSTRAINT user_authentication_secrets_user_authentication_id_fkey FOREIGN KEY (user_authentication_id) REFERENCES app_public.user_authentications(id) ON DELETE CASCADE;
--
-- Name: user_email_secrets user_email_secrets_user_email_id_fkey; Type: FK CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_email_secrets
ADD CONSTRAINT user_email_secrets_user_email_id_fkey FOREIGN KEY (user_email_id) REFERENCES app_public.user_emails(id) ON DELETE CASCADE;
--
-- Name: user_secrets user_secrets_user_id_fkey; Type: FK CONSTRAINT; Schema: app_private; Owner: -
--
ALTER TABLE ONLY app_private.user_secrets
ADD CONSTRAINT user_secrets_user_id_fkey FOREIGN KEY (user_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: brands brands_company_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.brands
ADD CONSTRAINT brands_company_id_fkey FOREIGN KEY (company_id) REFERENCES app_public.companies(id) ON DELETE CASCADE;
--
-- Name: brands brands_created_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.brands
ADD CONSTRAINT brands_created_by_fkey FOREIGN KEY (created_by) REFERENCES app_public.users(id) ON DELETE SET NULL;
--
-- Name: check_in_comments check_in_comments_check_in_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_comments
ADD CONSTRAINT check_in_comments_check_in_id_fkey FOREIGN KEY (check_in_id) REFERENCES app_public.check_ins(id) ON DELETE CASCADE;
--
-- Name: check_in_comments check_in_comments_created_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_comments
ADD CONSTRAINT check_in_comments_created_by_fkey FOREIGN KEY (created_by) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: check_in_friends check_in_friends_check_in_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_friends
ADD CONSTRAINT check_in_friends_check_in_id_fkey FOREIGN KEY (check_in_id) REFERENCES app_public.check_ins(id) ON DELETE CASCADE;
--
-- Name: check_in_friends check_in_friends_friend_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_friends
ADD CONSTRAINT check_in_friends_friend_id_fkey FOREIGN KEY (friend_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: check_in_likes check_in_likes_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_likes
ADD CONSTRAINT check_in_likes_id_fkey FOREIGN KEY (id) REFERENCES app_public.check_ins(id) ON DELETE CASCADE;
--
-- Name: check_in_likes check_in_likes_liked_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_likes
ADD CONSTRAINT check_in_likes_liked_by_fkey FOREIGN KEY (liked_by) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: check_in_tags check_in_tags_check_in_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_tags
ADD CONSTRAINT check_in_tags_check_in_id_fkey FOREIGN KEY (check_in_id) REFERENCES app_public.check_ins(id) ON DELETE CASCADE;
--
-- Name: check_in_tags check_in_tags_tag_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_in_tags
ADD CONSTRAINT check_in_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES app_public.tags(id) ON DELETE CASCADE;
--
-- Name: check_ins check_ins_author_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_ins
ADD CONSTRAINT check_ins_author_fkey FOREIGN KEY (author_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: check_ins check_ins_item_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.check_ins
ADD CONSTRAINT check_ins_item_id_fkey FOREIGN KEY (item_id) REFERENCES app_public.items(id) ON DELETE CASCADE;
--
-- Name: companies companies_created_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.companies
ADD CONSTRAINT companies_created_by_fkey FOREIGN KEY (created_by) REFERENCES app_public.users(id) ON DELETE SET NULL;
--
-- Name: company_likes company_likes_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.company_likes
ADD CONSTRAINT company_likes_id_fkey FOREIGN KEY (id) REFERENCES app_public.companies(id) ON DELETE CASCADE;
--
-- Name: company_likes company_likes_liked_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.company_likes
ADD CONSTRAINT company_likes_liked_by_fkey FOREIGN KEY (liked_by) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: friends friends_blocked_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.friends
ADD CONSTRAINT friends_blocked_by_fkey FOREIGN KEY (blocked_by) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: friends friends_user_id_1_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.friends
ADD CONSTRAINT friends_user_id_1_fkey FOREIGN KEY (user_id_1) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: friends friends_user_id_2_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.friends
ADD CONSTRAINT friends_user_id_2_fkey FOREIGN KEY (user_id_2) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: item_edit_suggestions item_edit_suggestions_author_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_author_id_fkey FOREIGN KEY (author_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: item_edit_suggestions item_edit_suggestions_brand_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_brand_id_fkey FOREIGN KEY (brand_id) REFERENCES app_public.brands(id) ON DELETE CASCADE;
--
-- Name: item_edit_suggestions item_edit_suggestions_item_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_item_id_fkey FOREIGN KEY (item_id) REFERENCES app_public.items(id) ON DELETE CASCADE;
--
-- Name: item_edit_suggestions item_edit_suggestions_manufacturer_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_manufacturer_id_fkey FOREIGN KEY (manufacturer_id) REFERENCES app_public.companies(id) ON DELETE CASCADE;
--
-- Name: item_edit_suggestions item_edit_suggestions_type_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.item_edit_suggestions
ADD CONSTRAINT item_edit_suggestions_type_id_fkey FOREIGN KEY (type_id) REFERENCES app_public.types(id);
--
-- Name: items items_brand_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_brand_id_fkey FOREIGN KEY (brand_id) REFERENCES app_public.brands(id) ON DELETE CASCADE;
--
-- Name: items items_created_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_created_by_fkey FOREIGN KEY (created_by) REFERENCES app_public.users(id) ON DELETE SET NULL;
--
-- Name: items items_manufacturer_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_manufacturer_fkey FOREIGN KEY (manufacturer_id) REFERENCES app_public.companies(id) ON DELETE CASCADE;
--
-- Name: items items_type_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_type_id_fkey FOREIGN KEY (type_id) REFERENCES app_public.types(id) ON DELETE CASCADE;
--
-- Name: items items_updated_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.items
ADD CONSTRAINT items_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES app_public.users(id) ON DELETE SET NULL;
--
-- Name: tags tags_created_by_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.tags
ADD CONSTRAINT tags_created_by_fkey FOREIGN KEY (created_by) REFERENCES app_public.users(id) ON DELETE SET NULL;
--
-- Name: types types_category_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.types
ADD CONSTRAINT types_category_fkey FOREIGN KEY (category) REFERENCES app_public.categories(name) ON DELETE CASCADE;
--
-- Name: user_authentications user_authentications_user_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_authentications
ADD CONSTRAINT user_authentications_user_id_fkey FOREIGN KEY (user_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: user_emails user_emails_user_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_emails
ADD CONSTRAINT user_emails_user_id_fkey FOREIGN KEY (user_id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: user_settings user_settings_id_fkey; Type: FK CONSTRAINT; Schema: app_public; Owner: -
--
ALTER TABLE ONLY app_public.user_settings
ADD CONSTRAINT user_settings_id_fkey FOREIGN KEY (id) REFERENCES app_public.users(id) ON DELETE CASCADE;
--
-- Name: connect_pg_simple_sessions; Type: ROW SECURITY; Schema: app_private; Owner: -
--
ALTER TABLE app_private.connect_pg_simple_sessions ENABLE ROW LEVEL SECURITY;
--
-- Name: sessions; Type: ROW SECURITY; Schema: app_private; Owner: -
--
ALTER TABLE app_private.sessions ENABLE ROW LEVEL SECURITY;
--
-- Name: user_authentication_secrets; Type: ROW SECURITY; Schema: app_private; Owner: -
--
ALTER TABLE app_private.user_authentication_secrets ENABLE ROW LEVEL SECURITY;
--
-- Name: user_email_secrets; Type: ROW SECURITY; Schema: app_private; Owner: -
--
ALTER TABLE app_private.user_email_secrets ENABLE ROW LEVEL SECURITY;
--
-- Name: user_secrets; Type: ROW SECURITY; Schema: app_private; Owner: -
--
ALTER TABLE app_private.user_secrets ENABLE ROW LEVEL SECURITY;
--
-- Name: brands; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.brands ENABLE ROW LEVEL SECURITY;
--
-- Name: categories; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.categories ENABLE ROW LEVEL SECURITY;
--
-- Name: check_in_comments; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.check_in_comments ENABLE ROW LEVEL SECURITY;
--
-- Name: check_in_friends; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.check_in_friends ENABLE ROW LEVEL SECURITY;
--
-- Name: check_in_likes; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.check_in_likes ENABLE ROW LEVEL SECURITY;
--
-- Name: check_in_tags; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.check_in_tags ENABLE ROW LEVEL SECURITY;
--
-- Name: check_ins; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.check_ins ENABLE ROW LEVEL SECURITY;
--
-- Name: companies; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.companies ENABLE ROW LEVEL SECURITY;
--
-- Name: check_ins create_check_in; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY create_check_in ON app_public.check_ins FOR INSERT WITH CHECK ((app_public.current_user_id() IS NOT NULL));
--
-- Name: companies create_companies; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY create_companies ON app_public.companies FOR INSERT WITH CHECK (((created_by = app_public.current_user_id()) AND (created_by IS NOT NULL)));
--
-- Name: check_ins delete_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY delete_own ON app_public.check_ins FOR DELETE USING ((author_id = app_public.current_user_id()));
--
-- Name: company_likes delete_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY delete_own ON app_public.company_likes FOR DELETE USING ((liked_by = app_public.current_user_id()));
--
-- Name: friends delete_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY delete_own ON app_public.friends FOR DELETE USING ((EXISTS ( SELECT 1
FROM app_public.friends friends_1
WHERE ((friends_1.user_id_1 = app_public.current_user_id()) OR (friends_1.user_id_2 = app_public.current_user_id())))));
--
-- Name: user_authentications delete_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY delete_own ON app_public.user_authentications FOR DELETE USING ((user_id = app_public.current_user_id()));
--
-- Name: user_emails delete_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY delete_own ON app_public.user_emails FOR DELETE USING ((user_id = app_public.current_user_id()));
--
-- Name: friends; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.friends ENABLE ROW LEVEL SECURITY;
--
-- Name: user_emails insert_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY insert_own ON app_public.user_emails FOR INSERT WITH CHECK ((user_id = app_public.current_user_id()));
--
-- Name: item_edit_suggestions; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.item_edit_suggestions ENABLE ROW LEVEL SECURITY;
--
-- Name: items; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.items ENABLE ROW LEVEL SECURITY;
--
-- Name: company_likes like_company; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY like_company ON app_public.company_likes FOR INSERT WITH CHECK ((liked_by = app_public.current_user_id()));
--
-- Name: tags logged_in_insert; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY logged_in_insert ON app_public.tags FOR INSERT WITH CHECK ((app_public.current_user_id() IS NOT NULL));
--
-- Name: brands moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.brands FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: check_ins moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.check_ins FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: companies moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.companies FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: company_likes moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.company_likes FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: items moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.items FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: tags moderator_delete; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_delete ON app_public.tags FOR DELETE USING (app_public.current_user_is_privileged());
--
-- Name: brands moderator_update; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_update ON app_public.brands FOR UPDATE USING (app_public.current_user_is_privileged());
--
-- Name: companies moderator_update; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_update ON app_public.companies FOR UPDATE USING (app_public.current_user_is_privileged());
--
-- Name: items moderator_update; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_update ON app_public.items FOR UPDATE USING (app_public.current_user_is_privileged());
--
-- Name: tags moderator_update; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_update ON app_public.tags FOR UPDATE USING (app_public.current_user_is_privileged());
--
-- Name: types moderator_update; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY moderator_update ON app_public.types FOR INSERT WITH CHECK (app_public.current_user_is_privileged());
--
-- Name: brands select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.brands FOR SELECT USING (true);
--
-- Name: categories select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.categories FOR SELECT USING (true);
--
-- Name: companies select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.companies FOR SELECT USING (true);
--
-- Name: company_likes select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.company_likes FOR SELECT USING (true);
--
-- Name: friends select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.friends FOR SELECT USING (true);
--
-- Name: item_edit_suggestions select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.item_edit_suggestions FOR SELECT USING (app_public.current_user_is_privileged());
--
-- Name: items select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.items FOR SELECT USING (true);
--
-- Name: tags select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.tags FOR SELECT USING (true);
--
-- Name: types select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.types FOR SELECT USING (true);
--
-- Name: users select_all; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_all ON app_public.users FOR SELECT USING (true);
--
-- Name: check_ins select_friends; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_friends ON app_public.check_ins FOR SELECT USING ((author_id IN ( SELECT app_public.current_user_friends() AS current_user_friends)));
--
-- Name: user_authentications select_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_own ON app_public.user_authentications FOR SELECT USING ((user_id = app_public.current_user_id()));
--
-- Name: user_emails select_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_own ON app_public.user_emails FOR SELECT USING ((user_id = app_public.current_user_id()));
--
-- Name: check_ins select_public; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY select_public ON app_public.check_ins FOR SELECT USING ((is_public = true));
--
-- Name: tags; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.tags ENABLE ROW LEVEL SECURITY;
--
-- Name: types; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.types ENABLE ROW LEVEL SECURITY;
--
-- Name: check_ins update_own; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY update_own ON app_public.check_ins FOR UPDATE USING ((author_id = app_public.current_user_id()));
--
-- Name: users update_self; Type: POLICY; Schema: app_public; Owner: -
--
CREATE POLICY update_self ON app_public.users FOR UPDATE USING ((id = app_public.current_user_id()));
--
-- Name: user_authentications; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.user_authentications ENABLE ROW LEVEL SECURITY;
--
-- Name: user_emails; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.user_emails ENABLE ROW LEVEL SECURITY;
--
-- Name: users; Type: ROW SECURITY; Schema: app_public; Owner: -
--
ALTER TABLE app_public.users ENABLE ROW LEVEL SECURITY;
--
-- Name: SCHEMA app_hidden; Type: ACL; Schema: -; Owner: -
--
GRANT USAGE ON SCHEMA app_hidden TO tasted_visitor;
--
-- Name: SCHEMA app_public; Type: ACL; Schema: -; Owner: -
--
GRANT USAGE ON SCHEMA app_public TO tasted_visitor;
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA public FROM postgres;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO tasted;
GRANT USAGE ON SCHEMA public TO tasted_visitor;
--
-- Name: FUNCTION assert_valid_password(new_password text); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.assert_valid_password(new_password text) FROM PUBLIC;
--
-- Name: TABLE users; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.users TO tasted_visitor;
--
-- Name: COLUMN users.username; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(username) ON TABLE app_public.users TO tasted_visitor;
--
-- Name: COLUMN users.avatar_url; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(avatar_url) ON TABLE app_public.users TO tasted_visitor;
--
-- Name: COLUMN users.first_name; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(first_name) ON TABLE app_public.users TO tasted_visitor;
--
-- Name: COLUMN users.last_name; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(last_name) ON TABLE app_public.users TO tasted_visitor;
--
-- Name: FUNCTION link_or_register_user(f_user_id uuid, f_service character varying, f_identifier character varying, f_profile json, f_auth_details json); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.link_or_register_user(f_user_id uuid, f_service character varying, f_identifier character varying, f_profile json, f_auth_details json) FROM PUBLIC;
--
-- Name: FUNCTION login(username public.citext, password text); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.login(username public.citext, password text) FROM PUBLIC;
--
-- Name: PROCEDURE migrate_seed(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON PROCEDURE app_private.migrate_seed() FROM PUBLIC;
--
-- Name: FUNCTION really_create_user(username public.citext, email text, email_is_verified boolean, first_name text, last_name text, avatar_url text, password text); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.really_create_user(username public.citext, email text, email_is_verified boolean, first_name text, last_name text, avatar_url text, password text) FROM PUBLIC;
--
-- Name: FUNCTION register_user(f_service character varying, f_identifier character varying, f_profile json, f_auth_details json, f_email_is_verified boolean); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.register_user(f_service character varying, f_identifier character varying, f_profile json, f_auth_details json, f_email_is_verified boolean) FROM PUBLIC;
--
-- Name: FUNCTION reset_password(user_id uuid, reset_token text, new_password text); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.reset_password(user_id uuid, reset_token text, new_password text) FROM PUBLIC;
--
-- Name: FUNCTION tg__add_audit_job(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg__add_audit_job() FROM PUBLIC;
--
-- Name: FUNCTION tg__add_job(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg__add_job() FROM PUBLIC;
--
-- Name: FUNCTION tg__created(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg__created() FROM PUBLIC;
--
-- Name: FUNCTION tg__timestamps(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg__timestamps() FROM PUBLIC;
--
-- Name: FUNCTION tg_user_email_secrets__insert_with_user_email(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg_user_email_secrets__insert_with_user_email() FROM PUBLIC;
--
-- Name: FUNCTION tg_user_secrets__insert_with_user(); Type: ACL; Schema: app_private; Owner: -
--
REVOKE ALL ON FUNCTION app_private.tg_user_secrets__insert_with_user() FROM PUBLIC;
--
-- Name: FUNCTION accept_friend_request(user_id uuid); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.accept_friend_request(user_id uuid) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.accept_friend_request(user_id uuid) TO tasted_visitor;
--
-- Name: FUNCTION change_password(old_password text, new_password text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.change_password(old_password text, new_password text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.change_password(old_password text, new_password text) TO tasted_visitor;
--
-- Name: TABLE companies; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.companies TO tasted_visitor;
--
-- Name: COLUMN companies.name; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(name) ON TABLE app_public.companies TO tasted_visitor;
--
-- Name: COLUMN companies.is_verified; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(is_verified) ON TABLE app_public.companies TO tasted_visitor;
--
-- Name: FUNCTION companies_average_rating(c app_public.companies); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.companies_average_rating(c app_public.companies) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.companies_average_rating(c app_public.companies) TO tasted_visitor;
--
-- Name: FUNCTION companies_check_ins_past_month(c app_public.companies); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.companies_check_ins_past_month(c app_public.companies) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.companies_check_ins_past_month(c app_public.companies) TO tasted_visitor;
--
-- Name: FUNCTION companies_current_user_check_ins(c app_public.companies); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.companies_current_user_check_ins(c app_public.companies) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.companies_current_user_check_ins(c app_public.companies) TO tasted_visitor;
--
-- Name: FUNCTION companies_total_check_ins(c app_public.companies); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.companies_total_check_ins(c app_public.companies) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.companies_total_check_ins(c app_public.companies) TO tasted_visitor;
--
-- Name: FUNCTION companies_total_items(c app_public.companies); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.companies_total_items(c app_public.companies) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.companies_total_items(c app_public.companies) TO tasted_visitor;
--
-- Name: FUNCTION confirm_account_deletion(token text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.confirm_account_deletion(token text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.confirm_account_deletion(token text) TO tasted_visitor;
--
-- Name: TABLE brands; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.brands TO tasted_visitor;
--
-- Name: COLUMN brands.name; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(name) ON TABLE app_public.brands TO tasted_visitor;
--
-- Name: COLUMN brands.company_id; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(company_id) ON TABLE app_public.brands TO tasted_visitor;
--
-- Name: COLUMN brands.is_verified; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(is_verified) ON TABLE app_public.brands TO tasted_visitor;
--
-- Name: FUNCTION create_brand(name text, company_id integer); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_brand(name text, company_id integer) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_brand(name text, company_id integer) TO tasted_visitor;
--
-- Name: TABLE check_ins; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.check_ins TO tasted_visitor;
--
-- Name: FUNCTION create_check_in(item_id integer, review text, rating integer, check_in_date date); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_check_in(item_id integer, review text, rating integer, check_in_date date) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_check_in(item_id integer, review text, rating integer, check_in_date date) TO tasted_visitor;
--
-- Name: FUNCTION create_check_in_comment(target_check_in_id integer, comment text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_check_in_comment(target_check_in_id integer, comment text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_check_in_comment(target_check_in_id integer, comment text) TO tasted_visitor;
--
-- Name: FUNCTION create_company(company_name text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_company(company_name text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_company(company_name text) TO tasted_visitor;
--
-- Name: FUNCTION create_friend_request(user_id uuid); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_friend_request(user_id uuid) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_friend_request(user_id uuid) TO tasted_visitor;
--
-- Name: TABLE items; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.flavor; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(flavor) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.description; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(description) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.type_id; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(type_id) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.manufacturer_id; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(manufacturer_id) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.is_verified; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(is_verified) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: COLUMN items.brand_id; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(brand_id) ON TABLE app_public.items TO tasted_visitor;
--
-- Name: FUNCTION create_item(flavor text, type_id integer, brand_id integer, manufacturer_id integer, description text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.create_item(flavor text, type_id integer, brand_id integer, manufacturer_id integer, description text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.create_item(flavor text, type_id integer, brand_id integer, manufacturer_id integer, description text) TO tasted_visitor;
--
-- Name: FUNCTION current_session_id(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.current_session_id() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.current_session_id() TO tasted_visitor;
--
-- Name: FUNCTION "current_user"(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public."current_user"() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public."current_user"() TO tasted_visitor;
--
-- Name: FUNCTION current_user_friends(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.current_user_friends() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.current_user_friends() TO tasted_visitor;
--
-- Name: FUNCTION current_user_id(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.current_user_id() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.current_user_id() TO tasted_visitor;
--
-- Name: FUNCTION current_user_is_privileged(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.current_user_is_privileged() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.current_user_is_privileged() TO tasted_visitor;
--
-- Name: FUNCTION delete_friend(friend_id uuid); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.delete_friend(friend_id uuid) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.delete_friend(friend_id uuid) TO tasted_visitor;
--
-- Name: FUNCTION forgot_password(email public.citext); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.forgot_password(email public.citext) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.forgot_password(email public.citext) TO tasted_visitor;
--
-- Name: FUNCTION items_average_rating(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_average_rating(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_average_rating(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION items_check_ins_past_month(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_check_ins_past_month(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_check_ins_past_month(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION items_current_user_check_ins(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_current_user_check_ins(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_current_user_check_ins(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION items_is_tasted(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_is_tasted(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_is_tasted(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION items_total_check_ins(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_total_check_ins(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_total_check_ins(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION items_unique_check_ins(i app_public.items); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.items_unique_check_ins(i app_public.items) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.items_unique_check_ins(i app_public.items) TO tasted_visitor;
--
-- Name: FUNCTION like_check_in(check_in_id integer); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.like_check_in(check_in_id integer) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.like_check_in(check_in_id integer) TO tasted_visitor;
--
-- Name: FUNCTION logout(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.logout() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.logout() TO tasted_visitor;
--
-- Name: TABLE user_emails; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.user_emails TO tasted_visitor;
--
-- Name: COLUMN user_emails.email; Type: ACL; Schema: app_public; Owner: -
--
GRANT INSERT(email) ON TABLE app_public.user_emails TO tasted_visitor;
--
-- Name: FUNCTION make_email_primary(email_id uuid); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.make_email_primary(email_id uuid) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.make_email_primary(email_id uuid) TO tasted_visitor;
--
-- Name: FUNCTION request_account_deletion(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.request_account_deletion() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.request_account_deletion() TO tasted_visitor;
--
-- Name: FUNCTION resend_email_verification_code(email_id uuid); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.resend_email_verification_code(email_id uuid) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.resend_email_verification_code(email_id uuid) TO tasted_visitor;
--
-- Name: FUNCTION search_items(search text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.search_items(search text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.search_items(search text) TO tasted_visitor;
--
-- Name: FUNCTION search_users(search text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.search_users(search text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.search_users(search text) TO tasted_visitor;
--
-- Name: FUNCTION stamp_liked_by(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.stamp_liked_by() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.stamp_liked_by() TO tasted_visitor;
--
-- Name: FUNCTION tg__friend_status(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg__friend_status() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg__friend_status() TO tasted_visitor;
--
-- Name: FUNCTION tg__graphql_subscription(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg__graphql_subscription() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg__graphql_subscription() TO tasted_visitor;
--
-- Name: FUNCTION tg__updated(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg__updated() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg__updated() TO tasted_visitor;
--
-- Name: FUNCTION tg_user_emails__forbid_if_verified(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg_user_emails__forbid_if_verified() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg_user_emails__forbid_if_verified() TO tasted_visitor;
--
-- Name: FUNCTION tg_user_emails__prevent_delete_last_email(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg_user_emails__prevent_delete_last_email() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg_user_emails__prevent_delete_last_email() TO tasted_visitor;
--
-- Name: FUNCTION tg_user_emails__verify_account_on_verified(); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.tg_user_emails__verify_account_on_verified() FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.tg_user_emails__verify_account_on_verified() TO tasted_visitor;
--
-- Name: FUNCTION users_friend_status(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_friend_status(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_friend_status(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION users_friends(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_friends(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_friends(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION users_has_password(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_has_password(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_has_password(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION users_total_check_ins(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_total_check_ins(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_total_check_ins(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION users_total_friends(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_total_friends(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_total_friends(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION users_unique_check_ins(u app_public.users); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.users_unique_check_ins(u app_public.users) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.users_unique_check_ins(u app_public.users) TO tasted_visitor;
--
-- Name: FUNCTION verify_email(user_email_id uuid, token text); Type: ACL; Schema: app_public; Owner: -
--
REVOKE ALL ON FUNCTION app_public.verify_email(user_email_id uuid, token text) FROM PUBLIC;
GRANT ALL ON FUNCTION app_public.verify_email(user_email_id uuid, token text) TO tasted_visitor;
--
-- Name: TABLE friends; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.friends TO tasted_visitor;
--
-- Name: TABLE activity_feed; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.activity_feed TO tasted_visitor;
--
-- Name: SEQUENCE brands_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.brands_id_seq TO tasted_visitor;
--
-- Name: TABLE categories; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.categories TO tasted_visitor;
--
-- Name: SEQUENCE check_in_comments_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.check_in_comments_id_seq TO tasted_visitor;
--
-- Name: SEQUENCE check_in_likes_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.check_in_likes_id_seq TO tasted_visitor;
--
-- Name: SEQUENCE check_ins_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.check_ins_id_seq TO tasted_visitor;
--
-- Name: SEQUENCE companies_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.companies_id_seq TO tasted_visitor;
--
-- Name: TABLE company_likes; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.company_likes TO tasted_visitor;
--
-- Name: COLUMN company_likes.id; Type: ACL; Schema: app_public; Owner: -
--
GRANT INSERT(id) ON TABLE app_public.company_likes TO tasted_visitor;
--
-- Name: TABLE current_user_friends; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.current_user_friends TO tasted_visitor;
--
-- Name: SEQUENCE friends_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.friends_id_seq TO tasted_visitor;
--
-- Name: TABLE item_edit_suggestions; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.item_edit_suggestions TO tasted_visitor;
--
-- Name: SEQUENCE item_edit_suggestions_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.item_edit_suggestions_id_seq TO tasted_visitor;
--
-- Name: SEQUENCE items_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.items_id_seq TO tasted_visitor;
--
-- Name: TABLE public_check_ins; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.public_check_ins TO tasted_visitor;
--
-- Name: TABLE user_settings; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.user_settings TO tasted_visitor;
--
-- Name: TABLE public_users; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.public_users TO tasted_visitor;
--
-- Name: TABLE tags; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.tags TO tasted_visitor;
--
-- Name: COLUMN tags.name; Type: ACL; Schema: app_public; Owner: -
--
GRANT INSERT(name),UPDATE(name) ON TABLE app_public.tags TO tasted_visitor;
--
-- Name: COLUMN tags.is_verified; Type: ACL; Schema: app_public; Owner: -
--
GRANT UPDATE(is_verified) ON TABLE app_public.tags TO tasted_visitor;
--
-- Name: SEQUENCE tags_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.tags_id_seq TO tasted_visitor;
--
-- Name: TABLE types; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT ON TABLE app_public.types TO tasted_visitor;
--
-- Name: COLUMN types.name; Type: ACL; Schema: app_public; Owner: -
--
GRANT INSERT(name) ON TABLE app_public.types TO tasted_visitor;
--
-- Name: COLUMN types.category; Type: ACL; Schema: app_public; Owner: -
--
GRANT INSERT(category) ON TABLE app_public.types TO tasted_visitor;
--
-- Name: SEQUENCE types_id_seq; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,USAGE ON SEQUENCE app_public.types_id_seq TO tasted_visitor;
--
-- Name: TABLE user_authentications; Type: ACL; Schema: app_public; Owner: -
--
GRANT SELECT,DELETE ON TABLE app_public.user_authentications TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: app_hidden; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_hidden REVOKE ALL ON SEQUENCES FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_hidden GRANT SELECT,USAGE ON SEQUENCES TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: app_hidden; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_hidden REVOKE ALL ON FUNCTIONS FROM PUBLIC;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_hidden REVOKE ALL ON FUNCTIONS FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_hidden GRANT ALL ON FUNCTIONS TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: app_public; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_public REVOKE ALL ON SEQUENCES FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_public GRANT SELECT,USAGE ON SEQUENCES TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: app_public; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_public REVOKE ALL ON FUNCTIONS FROM PUBLIC;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_public REVOKE ALL ON FUNCTIONS FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA app_public GRANT ALL ON FUNCTIONS TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA public REVOKE ALL ON SEQUENCES FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA public GRANT SELECT,USAGE ON SEQUENCES TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM PUBLIC;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM tasted;
ALTER DEFAULT PRIVILEGES FOR ROLE tasted IN SCHEMA public GRANT ALL ON FUNCTIONS TO tasted_visitor;
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: -; Owner: -
--
ALTER DEFAULT PRIVILEGES FOR ROLE tasted REVOKE ALL ON FUNCTIONS FROM PUBLIC;
--
-- PostgreSQL database dump complete
--
|
# Time: O(n)
# Space: O(n)
SELECT query_name,
ROUND(AVG(rating * 100 / POSITION)) / 100 AS quality,
ROUND(SUM(rating < 3) * 100 / COUNT(*), 2) AS poor_query_percentage
FROM Queries
GROUP BY query_name
ORDER BY NULL;
|
DROP DATABASE IF EXISTS db;
CREATE DATABASE db ENGINE = default;
CREATE TABLE db.t(c1 int) ENGINE = Null;
SELECT COUNT(1) from system.tables where name = 't' and database = 'db';
CREATE DATABASE IF NOT EXISTS db ENGINE = default;
CREATE DATABASE db ENGINE = default; -- {ErrorCode 4001}
DROP DATABASE IF EXISTS db;
-- arg engine is just ignored: https://github.com/datafuselabs/databend/issues/2205
CREATE DATABASE db2 ENGINE = NotExists;
CREATE TABLE db2.t(c1 int) ENGINE = Null;
SELECT COUNT(1) from system.tables where name = 't' and database = 'db2';
|
<gh_stars>0
with account_history as (
select *
from {{ var('account_history') }}
),
latest_account as (
select
*,
row_number() over(partition by account_id order by last_updated_at desc) as latest_account_index
from account_history
)
select *
from latest_account
where latest_account_index = 1 |
<filename>file-util-merger/src/main/resources/schema-test.sql
DROP TABLE FILE_INFO IF EXISTS;
CREATE TABLE FILE_INFO (
file_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
file_name VARCHAR(128),
file_path VARCHAR(1024),
file_created DATE,
file_created_by VARCHAR(128),
file_last_modified DATE,
file_md5 BINARY(16)
); |
-- Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
-- Copyright [2016-2022] EMBL-European Bioinformatics Institute
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
CREATE TABLE archive_id_lookup (
archive_id VARCHAR(128) NOT NULL,
species_id INTEGER UNSIGNED NOT NULL,
db_type VARCHAR(255) NOT NULL,
object_type VARCHAR(255) NOT NULL,
UNIQUE INDEX archive_id_lookup_idx (archive_id, species_id, db_type, object_type),
KEY archive_id_db_type (archive_id, db_type, object_type),
KEY archive_id_object_type (archive_id, object_type)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
CREATE TABLE meta (
meta_id INT NOT NULL AUTO_INCREMENT,
species_id INT UNSIGNED DEFAULT NULL,
meta_key VARCHAR(40) NOT NULL,
meta_value VARCHAR(255) NOT NULL,
PRIMARY KEY (meta_id),
UNIQUE KEY species_key_value_idx (species_id, meta_key, meta_value),
KEY species_value_idx (species_id, meta_value)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
CREATE TABLE species (
species_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
taxonomy_id INTEGER UNSIGNED,
PRIMARY KEY (species_id),
UNIQUE INDEX name_idx (name)
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
CREATE TABLE stable_id_lookup (
stable_id VARCHAR(128) NOT NULL,
species_id INTEGER UNSIGNED NOT NULL,
db_type VARCHAR(255) NOT NULL,
object_type VARCHAR(255) NOT NULL
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
|
<reponame>molinsp/course-dbt-pere<gh_stars>0
with source as (
select * from {{ source('stg_greenery', 'order_items') }}
),
renamed as (
select
id,
order_id,
product_id,
quantity
from source
)
select * from renamed
|
<gh_stars>0
/****** Object: View [dbo].[V_Instrument_Name_RNA_PickList] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE view [dbo].[V_Instrument_Name_RNA_PickList] as
SELECT InstName.IN_name As Instrument,
I.Usage as [Usage],
dbo.GetInstrumentGroupDatasetTypeList(I.IN_Group) AS Allowed_Dataset_Types
FROM T_Instrument_Name InstName
INNER JOIN T_Instrument_Group I
ON InstName.IN_Group = I.IN_Group
LEFT OUTER JOIN T_DatasetTypeName DT
ON I.Default_Dataset_Type = DT.DST_Type_ID
WHERE (InstName.IN_operations_role = 'Transcriptomics') AND
(InstName.IN_status <> 'Inactive')
GO
GRANT VIEW DEFINITION ON [dbo].[V_Instrument_Name_RNA_PickList] TO [DDL_Viewer] AS [dbo]
GO
|
CREATE TABLE [dbo].[Cut] (
[IdClip] INT NULL,
[IdVideo] INT NULL,
[Start] DECIMAL (18, 3) NULL,
[Finish] DECIMAL (18, 3) NULL,
[Sequence] INT NULL,
CONSTRAINT [FK_Cuts_Clip] FOREIGN KEY ([IdClip]) REFERENCES [dbo].[Clip] ([Id]),
CONSTRAINT [FK_Cuts_Video] FOREIGN KEY ([IdVideo]) REFERENCES [dbo].[Video] ([Id])
);
|
<gh_stars>10-100
-- 701 Number of drug occurrence records, by drug_concept_id
--insert into @results_schema.heracles_results (cohort_definition_id, analysis_id, stratum_1, count_value)
select c1.cohort_definition_id,
701 as analysis_id,
de1.drug_CONCEPT_ID as stratum_1,
cast( '' as varchar(1) ) as stratum_2, cast( '' as varchar(1) ) as stratum_3, cast( '' as varchar(1) ) as stratum_4,
COUNT_BIG(distinct de1.drug_exposure_id) as count_value
into #results_701
from
@CDM_schema.drug_exposure de1
inner join #HERACLES_cohort c1
on de1.person_id = c1.subject_id
--{@drug_concept_ids != '' | @cohort_period_only == 'true'}?{
WHERE
--{@cohort_period_only == 'true'}?{
de1.drug_exposure_start_date>=c1.cohort_start_date and de1.drug_exposure_start_date<=c1.cohort_end_date
--}
--{@drug_concept_ids != '' & @cohort_period_only == 'true'}?{
AND
--}
--{@drug_concept_ids != ''}?{
de1.drug_concept_id in (@drug_concept_ids)
--}
--}
group by c1.cohort_definition_id,
de1.drug_CONCEPT_ID
; |
<gh_stars>0
-- @author prabhd
-- @created 2012-12-05 12:00:00
-- @modified 2012-12-05 12:00:00
-- @tags dml
-- @db_name dmldb
-- @description union_update_test20: UNION/INTERSECT/EXCEPT within dml_union_sub-query
\echo --start_ignore
set gp_enable_column_oriented_table=on;
\echo --end_ignore
SELECT COUNT(DISTINCT(a)) FROM dml_union_r;
UPDATE dml_union_r SET a = dml_union_s.a FROM dml_union_s WHERE dml_union_r.b in (SELECT b FROM dml_union_r UNION SELECT b FROM dml_union_s);
SELECT COUNT(DISTINCT(a)) FROM dml_union_r;
|
-- @testpoint:distinct的使用
drop view if exists acos_view;
drop table if exists acos_test_01;
create table acos_test_01(c_decimal decimal(38,4));
insert into acos_test_01(c_decimal) values(-1),(1),(-0.6542),(0.6542),(null);
select distinct acos(abs(c_decimal)) t1,acos(abs(c_decimal)) t2 from acos_test_01 where c_decimal is not null order by t1,t2;
drop table if exists acos_test_01;
drop view if exists acos_view; |
<filename>benchmark/Taxpayer/queries-vectorwise/15.sql
SELECT AVG(CAST(("Taxpayer_10"."average_Medicare_allowed_amt" - "Taxpayer_10"."average_Medicare_payment_amt") AS float8)) AS "avg:Calculation_9940518082838207:ok", "Taxpayer_10"."nppes_provider_first_name" AS "nppes_provider_first_name" FROM "Taxpayer_10" WHERE (("Taxpayer_10"."hcpcs_description" = 'Initial hospital care') AND ("Taxpayer_10"."nppes_provider_city" IN ('BELLEVUE', 'BELLVUE')) AND ("Taxpayer_10"."nppes_provider_state" = 'WA')) GROUP BY 2;
|
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1101010', '1101', 'TEUPAH SELATAN'),
('1101020', '1101', 'SIMEULUE TIMUR'),
('1101021', '1101', 'TEUPAH BARAT'),
('1101022', '1101', 'TEUPAH TENGAH'),
('1101030', '1101', 'SIMEULUE TENGAH'),
('1101031', '1101', 'TELUK DALAM'),
('1101032', '1101', 'SIMEULUE CUT'),
('1101040', '1101', 'SALANG'),
('1101050', '1101', 'SIMEULUE BARAT'),
('1101051', '1101', 'ALAFAN'),
('1102010', '1102', 'PULAU BANYAK'),
('1102011', '1102', 'PULAU BANYAK BARAT'),
('1102020', '1102', 'SINGKIL'),
('1102021', '1102', 'SINGKIL UTARA'),
('1102022', '1102', 'KUALA BARU'),
('1102030', '1102', 'SIMPANG KANAN'),
('1102031', '1102', 'GUNUNG MERIAH'),
('1102032', '1102', 'DANAU PARIS'),
('1102033', '1102', 'SURO'),
('1102042', '1102', 'SINGKOHOR'),
('1102043', '1102', 'KOTA BAHARU'),
('1103010', '1103', 'TRUMON'),
('1103011', '1103', 'TRUMON TIMUR'),
('1103012', '1103', 'TRUMON TENGAH'),
('1103020', '1103', 'BAKONGAN'),
('1103021', '1103', 'BAKONGAN TIMUR'),
('1103022', '1103', 'KOTA BAHAGIA'),
('1103030', '1103', 'KLUET SELATAN'),
('1103031', '1103', 'KLUET TIMUR'),
('1103040', '1103', 'KLUET UTARA'),
('1103041', '1103', '<NAME>'),
('1103042', '1103', 'KLUET TENGAH'),
('1103050', '1103', 'TAPAK TUAN'),
('1103060', '1103', 'SAMA DUA'),
('1103070', '1103', 'SAWANG'),
('1103080', '1103', 'MEUKEK'),
('1103090', '1103', 'LABUHAN HAJI'),
('1103091', '1103', 'LABUHAN HAJI TIMUR'),
('1103092', '1103', 'LABUHAN HAJI BARAT'),
('1104010', '1104', 'LAWE ALAS'),
('1104011', '1104', 'BABUL RAHMAH'),
('1104012', '1104', 'TANOH ALAS'),
('1104020', '1104', 'LAWE SIGALA-GALA'),
('1104021', '1104', '<NAME>'),
('1104022', '1104', 'SEMADAM'),
('1104023', '1104', 'LAUSER'),
('1104030', '1104', 'BAMBEL'),
('1104031', '1104', '<NAME>'),
('1104032', '1104', '<NAME>'),
('1104040', '1104', 'BABUSSALAM');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1104041', '1104', '<NAME>'),
('1104050', '1104', 'BADAR'),
('1104051', '1104', '<NAME>'),
('1104052', '1104', 'KETAMBE'),
('1104053', '1104', '<NAME>'),
('1105080', '1105', '<NAME>'),
('1105081', '1105', '<NAME>'),
('1105082', '1105', 'PEUNARON'),
('1105090', '1105', '<NAME>'),
('1105100', '1105', '<NAME>'),
('1105101', '1105', '<NAME>'),
('1105110', '1105', 'PEUREULAK'),
('1105111', '1105', '<NAME>'),
('1105112', '1105', 'PEUREULAK BARAT'),
('1105120', '1105', '<NAME>'),
('1105130', '1105', '<NAME>'),
('1105131', '1105', 'PEUDAWA'),
('1105132', '1105', '<NAME>'),
('1105133', '1105', '<NAME>'),
('1105134', '1105', '<NAME>'),
('1105135', '1105', '<NAME>'),
('1105140', '1105', '<NAME>'),
('1105150', '1105', 'NURUSSALAM'),
('1105151', '1105', '<NAME>'),
('1105160', '1105', 'JULOK'),
('1105161', '1105', '<NAME>'),
('1105170', '1105', '<NAME>'),
('1105180', '1105', '<NAME>'),
('1105181', '1105', 'MADAT'),
('1106010', '1106', 'LINGE'),
('1106011', '1106', '<NAME>'),
('1106012', '1106', '<NAME>'),
('1106020', '1106', 'BINTANG'),
('1106031', '1106', '<NAME>'),
('1106032', '1106', 'KEBAYAKAN'),
('1106040', '1106', 'PEGASING'),
('1106041', '1106', 'BIES'),
('1106050', '1106', 'BEBESEN'),
('1106051', '1106', '<NAME>'),
('1106060', '1106', '<NAME>'),
('1106061', '1106', 'KETOL'),
('1106062', '1106', 'CELALA'),
('1106063', '1106', '<NAME>'),
('1107050', '1107', '<NAME>'),
('1107060', '1107', 'SAMATIGA'),
('1107061', '1107', 'BUBON'),
('1107062', '1107', 'ARONGAN LAMBALEK'),
('1107070', '1107', 'WOYLA'),
('1107071', '1107', '<NAME>'),
('1107072', '1107', 'WOYLA TIMUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1107080', '1107', 'KAWAY XVI'),
('1107081', '1107', 'MEUREUBO'),
('1107082', '1107', '<NAME>'),
('1107083', '1107', '<NAME>'),
('1107090', '1107', 'SUNGAI MAS'),
('1108010', '1108', 'LHOONG'),
('1108020', '1108', 'LHOKNGA'),
('1108021', '1108', 'LEUPUNG'),
('1108030', '1108', 'INDRAPURI'),
('1108031', '1108', 'KUTA COT GLIE'),
('1108040', '1108', 'SEULIMEUM'),
('1108041', '1108', 'KOTA JANTHO'),
('1108042', '1108', 'LEMBAH SEULAWAH'),
('1108050', '1108', 'MESJID RAYA'),
('1108060', '1108', 'DARUSSALAM'),
('1108061', '1108', 'BAITUSSALAM'),
('1108070', '1108', 'KUTA BARO'),
('1108080', '1108', 'MONTASIK'),
('1108081', '1108', 'BLANG BINTANG'),
('1108090', '1108', 'INGIN JAYA'),
('1108091', '1108', 'KRUENG BARONA JAYA'),
('1108100', '1108', 'SUKA MAKMUR'),
('1108101', '1108', 'KUTA MALAKA'),
('1108102', '1108', 'SIMPANG TIGA'),
('1108110', '1108', 'DARUL IMARAH'),
('1108111', '1108', 'D<NAME>AMAL'),
('1108120', '1108', 'PEUKAN BADA'),
('1108130', '1108', 'PULO ACEH'),
('1109010', '1109', 'GEUMPANG'),
('1109011', '1109', 'MANE'),
('1109070', '1109', 'GLUMPANG TIGA'),
('1109071', '1109', 'GLUMPANG BARO'),
('1109080', '1109', 'MUTIARA'),
('1109081', '1109', 'MUTIARA TIMUR'),
('1109090', '1109', 'TIRO/TRUSEB'),
('1109100', '1109', 'TANGSE'),
('1109111', '1109', 'KEUMALA'),
('1109112', '1109', 'TITEUE'),
('1109120', '1109', 'SAKTI'),
('1109130', '1109', 'MILA'),
('1109140', '1109', 'PADANG TIJI'),
('1109150', '1109', 'DELIMA'),
('1109151', '1109', 'GRONG GRONG'),
('1109160', '1109', 'INDRAJAYA'),
('1109170', '1109', 'PEUKAN BARO'),
('1109180', '1109', 'KEMBANG TANJONG'),
('1109190', '1109', 'SIMPANG TIGA'),
('1109200', '1109', 'KOTA SIGLI'),
('1109210', '1109', 'PIDIE'),
('1109220', '1109', 'BATEE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1109230', '1109', 'MUARA TIGA'),
('1110010', '1110', 'SAMALANGA'),
('1110011', '1110', 'SIMPANG MAMPLAM'),
('1110020', '1110', 'PANDRAH'),
('1110030', '1110', 'JEUNIEB'),
('1110031', '1110', 'PEULIMBANG'),
('1110040', '1110', 'PEUDADA'),
('1110050', '1110', 'JULI'),
('1110060', '1110', 'JEUMPA'),
('1110061', '1110', 'KOTA JUANG'),
('1110062', '1110', 'KUALA'),
('1110070', '1110', 'JANGKA'),
('1110080', '1110', 'PEUSANGAN'),
('1110081', '1110', 'PEUSANGAN SELATAN'),
('1110082', '1110', 'PEUSANGAN SIBLAH KRUENG'),
('1110090', '1110', 'MAKMUR'),
('1110100', '1110', 'GANDA PURA'),
('1110101', '1110', 'KUTA BLANG'),
('1111010', '1111', 'SAWANG'),
('1111020', '1111', 'NISAM'),
('1111021', '1111', 'NISAM ANTARA'),
('1111022', '1111', 'BANDA BARO'),
('1111030', '1111', 'KUTA MAKMUR'),
('1111031', '1111', 'SIMPANG KERAMAT'),
('1111040', '1111', 'SYAMTALIRA BAYU'),
('1111041', '1111', '<NAME>'),
('1111050', '1111', 'MEUR<NAME>'),
('1111060', '1111', 'MATANGKULI'),
('1111061', '1111', '<NAME>'),
('1111062', '1111', '<NAME>'),
('1111070', '1111', 'COT GIREK'),
('1111080', '1111', 'TANAH JAMBO AYE'),
('1111081', '1111', 'LANGKAHAN'),
('1111090', '1111', 'SEUNUDDON'),
('1111100', '1111', 'BAKTIYA'),
('1111101', '1111', 'BAKTIYA BARAT'),
('1111110', '1111', 'LHOKSUKON'),
('1111120', '1111', 'TANAH LUAS'),
('1111121', '1111', 'NIBONG'),
('1111130', '1111', 'SAMUDERA'),
('1111140', '1111', '<NAME>'),
('1111150', '1111', 'T<NAME>'),
('1111151', '1111', 'LAPANG'),
('1111160', '1111', '<NAME>'),
('1111170', '1111', 'DEWANTARA'),
('1112010', '1112', 'MANGGENG'),
('1112011', '1112', 'LEMBAH SABIL'),
('1112020', '1112', 'TANGAN-TANGAN'),
('1112021', '1112', 'SETIA'),
('1112030', '1112', 'BLANG PIDIE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1112031', '1112', 'JEUMPA'),
('1112040', '1112', 'SUSOH'),
('1112050', '1112', 'KUALA BATEE'),
('1112060', '1112', 'BABAH ROT'),
('1113010', '1113', 'KUTA PANJANG'),
('1113011', '1113', 'BLANG JERANGO'),
('1113020', '1113', 'BLANGKEJEREN'),
('1113021', '1113', '<NAME>'),
('1113022', '1113', '<NAME>'),
('1113023', '1113', 'BLANG PEGAYON'),
('1113030', '1113', 'PINING'),
('1113040', '1113', 'RIKIT GAIB'),
('1113041', '1113', 'PANTAN CUACA'),
('1113050', '1113', 'TERANGUN'),
('1113051', '1113', '<NAME>'),
('1114010', '1114', 'TAMIANG HULU'),
('1114011', '1114', '<NAME>'),
('1114020', '1114', 'KEJURUAN MUDA'),
('1114021', '1114', 'TENGGULUN'),
('1114030', '1114', 'RANTAU'),
('1114040', '1114', 'KOTA KUALA SIMPANG'),
('1114050', '1114', 'SERUWAY'),
('1114060', '1114', 'BENDAHARA'),
('1114061', '1114', '<NAME>'),
('1114070', '1114', 'KARANG BARU'),
('1114071', '1114', 'SEKERAK'),
('1114080', '1114', '<NAME>'),
('1115010', '1115', '<NAME>'),
('1115011', '1115', '<NAME>'),
('1115020', '1115', 'KUALA'),
('1115021', '1115', 'K<NAME>'),
('1115022', '1115', '<NAME>'),
('1115030', '1115', 'BEUTONG'),
('1115031', '1115', 'BEUTONG ATEUH BANGGALANG'),
('1115040', '1115', 'SEUNAGAN'),
('1115041', '1115', '<NAME>'),
('1115050', '1115', '<NAME>'),
('1116010', '1116', 'TEUNOM'),
('1116011', '1116', '<NAME>'),
('1116020', '1116', 'PANGA'),
('1116030', '1116', '<NAME>'),
('1116040', '1116', '<NAME>'),
('1116050', '1116', 'SAMPOINIET'),
('1116051', '1116', '<NAME>'),
('1116060', '1116', 'JAYA'),
('1116061', '1116', 'INDRA JAYA'),
('1117010', '1117', 'TIMANG GAJAH'),
('1117011', '1117', 'GAJAH PUTIH'),
('1117020', '1117', '<NAME>'),
('1117030', '1117', 'BUKIT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1117040', '1117', 'WIH PESAM'),
('1117050', '1117', 'BANDAR'),
('1117051', '1117', 'BENER KELIPAH'),
('1117060', '1117', 'SYIAH UTAMA'),
('1117061', '1117', 'MESIDAH'),
('1117070', '1117', 'PERMATA'),
('1118010', '1118', 'MEUREUDU'),
('1118020', '1118', 'MEURAH DUA'),
('1118030', '1118', '<NAME>'),
('1118040', '1118', 'JANGKA BUYA'),
('1118050', '1118', 'ULIM'),
('1118060', '1118', 'TRIENGGADENG'),
('1118070', '1118', 'PANTERAJA'),
('1118080', '1118', 'BANDAR BARU'),
('1171010', '1171', 'MEURAXA'),
('1171011', '1171', 'JAYA BARU'),
('1171012', '1171', 'BANDA RAYA'),
('1171020', '1171', 'BAITURRAHMAN'),
('1171021', '1171', 'LUENG BATA'),
('1171030', '1171', 'KUTA ALAM'),
('1171031', '1171', 'KUTA RAJA'),
('1171040', '1171', 'SYIAH KUALA'),
('1171041', '1171', 'ULEE KARENG'),
('1172010', '1172', 'SUKAJAYA'),
('1172020', '1172', 'SUKAKARYA'),
('1173010', '1173', 'LANGSA TIMUR'),
('1173011', '1173', 'LANGSA LAMA'),
('1173020', '1173', 'LANGSA BARAT'),
('1173021', '1173', 'LANGSA BARO'),
('1173030', '1173', 'LANGSA KOTA'),
('1174010', '1174', 'BLANG MANGAT'),
('1174020', '1174', 'MUARA DUA'),
('1174021', '1174', 'MUARA SATU'),
('1174030', '1174', 'BANDA SAKTI'),
('1175010', '1175', 'SIMPANG KIRI'),
('1175020', '1175', 'PENANGGALAN'),
('1175030', '1175', 'RUNDENG'),
('1175040', '1175', 'SULTAN DAULAT'),
('1175050', '1175', 'LONGKIB'),
('1201060', '1201', '<NAME>'),
('1201061', '1201', 'BAWOLATO'),
('1201062', '1201', 'ULUGAWO'),
('1201070', '1201', 'GIDO'),
('1201071', '1201', 'SOGAEADU'),
('1201081', '1201', 'MA U'),
('1201082', '1201', 'SOMOLO - MOLO'),
('1201130', '1201', 'HILIDUHO'),
('1201131', '1201', 'HILI SERANGKAI'),
('1201132', '1201', 'BOTOMUZOI'),
('1202010', '1202', 'BATAHAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1202011', '1202', 'SINUNUKAN'),
('1202020', '1202', 'BATANG NATAL'),
('1202021', '1202', '<NAME>'),
('1202022', '1202', 'RANTO BAEK'),
('1202030', '1202', 'KOTANOPAN'),
('1202031', '1202', 'ULU PUNGKUT'),
('1202032', '1202', 'TAMBANGAN'),
('1202033', '1202', 'LEMBAH SORIK MARAPI'),
('1202034', '1202', 'PUNCAK SORIK MARAPI'),
('1202040', '1202', '<NAME>'),
('1202041', '1202', 'PAKANTAN'),
('1202050', '1202', 'PANYABUNGAN'),
('1202051', '1202', 'PANYABUNGAN SELATAN'),
('1202052', '1202', 'PANYABUNGAN BARAT'),
('1202053', '1202', 'PANYABUNGAN UTARA'),
('1202054', '1202', 'PANYABUNGAN TIMUR'),
('1202055', '1202', 'HUTA BARGOT'),
('1202060', '1202', 'NATAL'),
('1202070', '1202', 'MUARA BATANG GADIS'),
('1202080', '1202', 'SIABU'),
('1202081', '1202', 'BUKIT MALINTANG'),
('1202082', '1202', 'NAGA JUANG'),
('1203010', '1203', 'BATANG ANGKOLA'),
('1203011', '1203', 'SAYUR MATINGGI'),
('1203012', '1203', 'TANO TOMBANGAN ANGKOLA'),
('1203070', '1203', 'ANGKOLA TIMUR'),
('1203080', '1203', 'ANGKOLA SELATAN'),
('1203090', '1203', 'ANGKOLA BARAT'),
('1203091', '1203', 'ANGKOLA SANGKUNUR'),
('1203100', '1203', 'BATANG TORU'),
('1203101', '1203', 'MARANCAR'),
('1203102', '1203', '<NAME>'),
('1203110', '1203', 'SIPIROK'),
('1203120', '1203', 'ARSE'),
('1203160', '1203', '<NAME>'),
('1203161', '1203', 'AEK BILAH'),
('1204010', '1204', 'PINANG SORI'),
('1204011', '1204', 'BADIRI'),
('1204020', '1204', 'SIBABANGUN'),
('1204021', '1204', 'LUMUT'),
('1204022', '1204', 'SUKABANGUN'),
('1204030', '1204', 'PANDAN'),
('1204031', '1204', 'TUKKA'),
('1204032', '1204', 'SARUDIK'),
('1204040', '1204', 'TAPIAN NAULI'),
('1204041', '1204', 'SITAHUIS'),
('1204050', '1204', 'KOLANG'),
('1204060', '1204', 'SORKAM'),
('1204061', '1204', 'SORKAM BARAT'),
('1204062', '1204', 'PASARIBU TOBING');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1204070', '1204', 'BARUS'),
('1204071', '1204', '<NAME>'),
('1204072', '1204', '<NAME>'),
('1204073', '1204', '<NAME>'),
('1204080', '1204', 'MANDUAMAS'),
('1204081', '1204', 'SIRANDORUNG'),
('1205030', '1205', 'PARMONANGAN'),
('1205040', '1205', '<NAME>'),
('1205050', '1205', 'SIPOHOLON'),
('1205060', '1205', 'TARUTUNG'),
('1205061', '1205', '<NAME>'),
('1205070', '1205', 'PAHAE JULU'),
('1205080', '1205', 'PAHAE JAE'),
('1205081', '1205', 'PURBATUA'),
('1205082', '1205', 'SIMANGUMBAN'),
('1205090', '1205', 'PANGARIBUAN'),
('1205100', '1205', 'GAROGA'),
('1205110', '1205', 'SIPAHUTAR'),
('1205120', '1205', 'SIBORONG-BORONG'),
('1205130', '1205', 'PAGARAN'),
('1205180', '1205', 'MUARA'),
('1206030', '1206', 'BALIGE'),
('1206031', '1206', 'TAMPAHAN'),
('1206040', '1206', 'LAGUBOTI'),
('1206050', '1206', 'HABINSARAN'),
('1206051', '1206', 'BORBOR'),
('1206052', '1206', 'NASSAU'),
('1206060', '1206', 'SILAEN'),
('1206061', '1206', 'SIGUMPAR'),
('1206070', '1206', 'PORSEA'),
('1206071', '1206', '<NAME>'),
('1206072', '1206', '<NAME>'),
('1206073', '1206', 'PARMAKSIAN'),
('1206080', '1206', 'LUMBAN JULU'),
('1206081', '1206', 'ULUAN'),
('1206082', '1206', 'AJIBATA'),
('1206083', '1206', 'BONATUA LUNASI'),
('1207050', '1207', 'BILAH HULU'),
('1207070', '1207', 'PANGKATAN'),
('1207080', '1207', 'BILAH BARAT'),
('1207130', '1207', 'BILAH HILIR'),
('1207140', '1207', 'PANAI HULU'),
('1207150', '1207', 'PANAI TENGAH'),
('1207160', '1207', 'PANAI HILIR'),
('1207210', '1207', 'RANTAU SELATAN'),
('1207220', '1207', 'RANTAU UTARA'),
('1208010', '1208', 'BANDAR PASIR MANDOGE'),
('1208020', '1208', 'BANDAR PULAU'),
('1208021', '1208', 'AEK SONGSONGAN'),
('1208022', '1208', 'RAHUNING');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1208030', '1208', 'PULAU RAKYAT'),
('1208031', '1208', 'AEK KUASAN'),
('1208032', '1208', 'AEK LEDONG'),
('1208040', '1208', 'SEI KEPAYANG'),
('1208041', '1208', 'SEI KEPAYANG BARAT'),
('1208042', '1208', 'SEI KEPAYANG TIMUR'),
('1208050', '1208', 'TANJUNG BALAI'),
('1208060', '1208', 'SIMPANG EMPAT'),
('1208061', '1208', 'TELUK DALAM'),
('1208070', '1208', 'AIR BATU'),
('1208071', '1208', 'SEI DADAP'),
('1208080', '1208', 'BUNTU PANE'),
('1208081', '1208', 'TINGGI RAJA'),
('1208082', '1208', 'SETIA JANJI'),
('1208090', '1208', 'MERANTI'),
('1208091', '1208', 'PULO BANDRING'),
('1208092', '1208', 'RAWANG PANCA ARGA'),
('1208100', '1208', 'AIR JOMAN'),
('1208101', '1208', 'SILAU LAUT'),
('1208160', '1208', '<NAME>'),
('1208170', '1208', '<NAME>'),
('1209010', '1209', 'SILIMAKUTA'),
('1209011', '1209', 'PEMATANG SILIMAHUTA'),
('1209020', '1209', 'PURBA'),
('1209021', '1209', 'HARANGGAOL HORISON'),
('1209030', '1209', 'DO<NAME>'),
('1209040', '1209', 'SIDAMANIK'),
('1209041', '1209', 'PEMATANG SIDAMANIK'),
('1209050', '1209', '<NAME>'),
('1209060', '1209', 'TANAH JAWA'),
('1209061', '1209', 'HATONDUHAN'),
('1209070', '1209', 'DOLOK PANRIBUAN'),
('1209080', '1209', '<NAME>'),
('1209090', '1209', 'PANEI'),
('1209091', '1209', 'PANOMBEAN PANEI'),
('1209100', '1209', 'RAYA'),
('1209110', '1209', 'DOLOK SILAU'),
('1209120', '1209', 'SILAU KAHEAN'),
('1209130', '1209', 'RAYA KAHEAN'),
('1209140', '1209', 'TAPIAN DOLOK'),
('1209150', '1209', 'DO<NAME>ANGGAR'),
('1209160', '1209', 'SIANTAR'),
('1209161', '1209', 'GUNUNG MALELA'),
('1209162', '1209', 'GUNUNG MALIGAS'),
('1209170', '1209', 'HUTABAYU RAJA'),
('1209171', '1209', 'JAWA MARAJA BAH JAMBI'),
('1209180', '1209', 'PEMATANG BANDAR'),
('1209181', '1209', 'BANDAR HULUAN'),
('1209190', '1209', 'BANDAR'),
('1209191', '1209', 'BANDAR MASILAM');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1209200', '1209', 'BOSAR MALIGAS'),
('1209210', '1209', 'UJUNG PADANG'),
('1210030', '1210', 'SIDIKALANG'),
('1210031', '1210', 'BERAMPU'),
('1210032', '1210', 'SITINJO'),
('1210040', '1210', 'PARBULUAN'),
('1210050', '1210', 'SUMBUL'),
('1210051', '1210', 'SILAH<NAME>UNGAN'),
('1210060', '1210', 'SILIMA PUNGGA-PUNGGA'),
('1210061', '1210', '<NAME>'),
('1210070', '1210', 'SIEMPAT NEMPU'),
('1210080', '1210', 'SIEMPAT NEMPU HULU'),
('1210090', '1210', 'SIEMPAT NEMPU HILIR'),
('1210100', '1210', '<NAME>'),
('1210101', '1210', '<NAME>ITEMBER'),
('1210110', '1210', '<NAME>'),
('1210120', '1210', '<NAME>'),
('1211010', '1211', 'MARDINGDING'),
('1211020', '1211', 'LAUBALENG'),
('1211030', '1211', '<NAME>'),
('1211040', '1211', 'JUHAR'),
('1211050', '1211', 'MUNTE'),
('1211060', '1211', '<NAME>'),
('1211070', '1211', 'PAYUNG'),
('1211071', '1211', 'TIGANDERKET'),
('1211080', '1211', '<NAME>'),
('1211081', '1211', '<NAME>'),
('1211082', '1211', 'MERDEKA'),
('1211090', '1211', 'KABANJAHE'),
('1211100', '1211', 'BERASTAGI'),
('1211110', '1211', 'TIGAPANAH'),
('1211111', '1211', '<NAME>'),
('1211120', '1211', 'MEREK'),
('1211130', '1211', 'BARUSJAHE'),
('1212010', '1212', '<NAME>'),
('1212020', '1212', 'SINEMBAH TANJUNG <NAME>'),
('1212030', '1212', 'SIBOLANGIT'),
('1212040', '1212', 'KUTALIMBARU'),
('1212050', '1212', '<NAME>'),
('1212060', '1212', '<NAME>'),
('1212070', '1212', 'BIRU-BIRU'),
('1212080', '1212', 'SINEMBAH TANJUNG MUDA HILIR'),
('1212090', '1212', 'BANGUN PURBA'),
('1212190', '1212', 'GALANG'),
('1212200', '1212', 'TANJUNG MORAWA'),
('1212210', '1212', 'PATUMBAK'),
('1212220', '1212', 'DELI TUA'),
('1212230', '1212', 'SUNGGAL'),
('1212240', '1212', 'HAMPARAN PERAK'),
('1212250', '1212', 'LABUHAN DELI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1212260', '1212', 'PERCUT SEI TUAN'),
('1212270', '1212', '<NAME>'),
('1212280', '1212', 'P<NAME>'),
('1212290', '1212', 'BERINGIN'),
('1212300', '1212', '<NAME>'),
('1212310', '1212', '<NAME>'),
('1213010', '1213', 'BOHOROK'),
('1213011', '1213', 'SIRAPIT'),
('1213020', '1213', 'SALAPIAN'),
('1213021', '1213', 'KUTAMBARU'),
('1213030', '1213', 'SEI BINGAI'),
('1213040', '1213', 'KUALA'),
('1213050', '1213', 'SELESAI'),
('1213060', '1213', 'BINJAI'),
('1213070', '1213', 'STABAT'),
('1213080', '1213', 'WAMPU'),
('1213090', '1213', 'BATANG SERANGAN'),
('1213100', '1213', '<NAME>'),
('1213110', '1213', '<NAME>'),
('1213120', '1213', 'HINAI'),
('1213130', '1213', 'SECANGGANG'),
('1213140', '1213', 'TANJUNG PURA'),
('1213150', '1213', 'GEBANG'),
('1213160', '1213', 'BABALAN'),
('1213170', '1213', 'SEI LEPAN'),
('1213180', '1213', 'BRANDAN BARAT'),
('1213190', '1213', 'BESITANG'),
('1213200', '1213', 'PANGKALAN SUSU'),
('1213201', '1213', 'PEMATANG JAYA'),
('1214010', '1214', 'HIBALA'),
('1214011', '1214', 'TANAH MASA'),
('1214020', '1214', 'PULAU-PULAU BATU'),
('1214021', '1214', 'PULAU-PULAU BATU TIMUR'),
('1214022', '1214', 'SIMUK'),
('1214023', '1214', 'PULAU-PULAU BATU BARAT'),
('1214024', '1214', 'PULAU-PULAU BATU UTARA'),
('1214030', '1214', 'TELUK DALAM'),
('1214031', '1214', 'FANAYAMA'),
('1214032', '1214', 'TOMA'),
('1214033', '1214', 'MANIAMOLO'),
('1214034', '1214', 'MAZINO'),
('1214035', '1214', '<NAME>'),
('1214036', '1214', 'ONOLALU'),
('1214040', '1214', 'AMANDRAYA'),
('1214041', '1214', 'ARAMO'),
('1214042', '1214', 'ULUSUSUA'),
('1214050', '1214', 'LAHUSA'),
('1214051', '1214', 'SIDUAORI'),
('1214052', '1214', 'SOMAMBAWA'),
('1214060', '1214', 'GOMO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1214061', '1214', 'SUSUA'),
('1214062', '1214', 'MAZO'),
('1214063', '1214', 'UMBUNASI'),
('1214064', '1214', 'IDANOTAE'),
('1214065', '1214', 'ULUIDANOTAE'),
('1214066', '1214', 'BORONADU'),
('1214070', '1214', 'LOLOMATUA'),
('1214071', '1214', 'ULUNOYO'),
('1214072', '1214', 'HURUNA'),
('1214080', '1214', 'LOLOWA\'U'),
('1214081', '1214', 'HILIMEGAI'),
('1214082', '1214', 'OOU'),
('1214083', '1214', 'ONOHAZUMBA'),
('1214084', '1214', 'HILISALAWAAHE'),
('1215010', '1215', 'PAKKAT'),
('1215020', '1215', 'ONAN GANJANG'),
('1215030', '1215', 'SIJAMA POLANG'),
('1215040', '1215', 'DOLOK SANGGUL'),
('1215050', '1215', '<NAME>'),
('1215060', '1215', 'PARANGINAN'),
('1215070', '1215', '<NAME>'),
('1215080', '1215', 'POLLUNG'),
('1215090', '1215', 'PARLILITAN'),
('1215100', '1215', '<NAME>'),
('1216010', '1216', 'SALAK'),
('1216011', '1216', '<NAME> URANG JEHE'),
('1216012', '1216', 'PAGINDAR'),
('1216013', '1216', 'SITELLU TALI URANG JULU'),
('1216014', '1216', 'PERGETTENG-GETTENG SENGKUT'),
('1216020', '1216', 'KERAJAAN'),
('1216021', '1216', 'TINADA'),
('1216022', '1216', '<NAME>'),
('1217010', '1217', '<NAME>'),
('1217020', '1217', 'HARIAN'),
('1217030', '1217', 'SITIO-TIO'),
('1217040', '1217', '<NAME>'),
('1217050', '1217', 'NAINGGOLAN'),
('1217060', '1217', 'PALIPI'),
('1217070', '1217', '<NAME>'),
('1217080', '1217', 'PANGURURAN'),
('1217090', '1217', 'SIMANINDO'),
('1218010', '1218', 'KOTARIH'),
('1218011', '1218', 'SILINDA'),
('1218012', '1218', 'BINTANG BAYU'),
('1218020', '1218', '<NAME>'),
('1218021', '1218', 'SERBAJADI'),
('1218030', '1218', 'SIPISPIS'),
('1218040', '1218', '<NAME>'),
('1218050', '1218', 'TEBINGTINGGI'),
('1218051', '1218', 'TEBING SYAHBANDAR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1218060', '1218', 'BANDAR KHALIPAH'),
('1218070', '1218', 'TANJUNG BERINGIN'),
('1218080', '1218', 'SEI RAMPAH'),
('1218081', '1218', 'SEI BAMBAN'),
('1218090', '1218', 'TELUK MENGKUDU'),
('1218100', '1218', 'PERBAUNGAN'),
('1218101', '1218', 'PEGAJAHAN'),
('1218110', '1218', '<NAME>'),
('1219010', '1219', 'SEI BALAI'),
('1219020', '1219', 'TANJUNG TIRAM'),
('1219030', '1219', 'TALAWI'),
('1219040', '1219', 'LIMAPULUH'),
('1219050', '1219', 'AIR PUTIH'),
('1219060', '1219', 'SEI SUKA'),
('1219070', '1219', 'MEDANG DERAS'),
('1220010', '1220', 'BATANG ONANG'),
('1220020', '1220', 'PADANG BOLAK JULU'),
('1220030', '1220', 'PORTIBI'),
('1220040', '1220', 'PADANG BOLAK'),
('1220050', '1220', 'SIMANGAMBAT'),
('1220060', '1220', 'HALONGONAN'),
('1220070', '1220', 'DOLOK'),
('1220080', '1220', 'DOLOK SIGOMPULON'),
('1220090', '1220', 'HULU SIHAPAS'),
('1221010', '1221', 'SOSOPAN'),
('1221020', '1221', 'ULU BARUMUN'),
('1221030', '1221', 'BARUMUN'),
('1221031', '1221', 'BARUMUN SELATAN'),
('1221040', '1221', 'LUBUK BARUMUN'),
('1221050', '1221', 'SOSA'),
('1221060', '1221', 'BATANG LUBU SUTAM'),
('1221070', '1221', 'HUTA RAJA TINGGI'),
('1221080', '1221', 'HURISTAK'),
('1221090', '1221', 'BARUMUN TENGAH'),
('1221091', '1221', 'AEK NABARA BARUMUN'),
('1221092', '1221', 'SIHAPAS BARUMUN'),
('1222010', '1222', 'SUNGAI KANAN'),
('1222020', '1222', 'TORGAMBA'),
('1222030', '1222', 'KOTA PINANG'),
('1222040', '1222', 'SILANGKITANG'),
('1222050', '1222', 'KAMPUNG RAKYAT'),
('1223010', '1223', 'NA IX-X'),
('1223020', '1223', 'MARBAU'),
('1223030', '1223', 'AEK KUO'),
('1223040', '1223', 'AEK NATAS'),
('1223050', '1223', 'KUALUH SELATAN'),
('1223060', '1223', 'KUALUH HILIR'),
('1223070', '1223', 'KUALUH HULU'),
('1223080', '1223', 'KUALUH LEIDONG'),
('1224010', '1224', 'TUGALA OYO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1224020', '1224', 'ALASA'),
('1224030', '1224', 'ALASA TALU MUZOI'),
('1224040', '1224', 'NAMOHALU ESIWA'),
('1224050', '1224', 'SITOLU ORI'),
('1224060', '1224', 'TUHEMBERUA'),
('1224070', '1224', 'SAWO'),
('1224080', '1224', 'LOTU'),
('1224090', '1224', '<NAME>'),
('1224100', '1224', 'AFULU'),
('1224110', '1224', 'LAHEWA'),
('1225010', '1225', 'SIROMBU'),
('1225020', '1225', 'LAHOMI'),
('1225030', '1225', '<NAME>'),
('1225040', '1225', '<NAME>'),
('1225050', '1225', 'MANDREHE UTARA'),
('1225060', '1225', 'MANDREHE'),
('1225070', '1225', '<NAME>'),
('1225080', '1225', '<NAME>'),
('1271010', '1271', 'SIBOLGA UTARA'),
('1271020', '1271', 'SIBOLGA KOTA'),
('1271030', '1271', 'SIBOLGA SELATAN'),
('1271031', '1271', 'SIBOLGA SAMBAS'),
('1272010', '1272', 'DATUK BANDAR'),
('1272011', '1272', 'DATUK BANDAR TIMUR'),
('1272020', '1272', 'TANJUNG BALAI SELATAN'),
('1272030', '1272', 'TANJUNG BALAI UTARA'),
('1272040', '1272', 'SEI TUALANG RASO'),
('1272050', '1272', 'TE<NAME>'),
('1273010', '1273', '<NAME>'),
('1273011', '1273', '<NAME>'),
('1273020', '1273', 'SIANTAR SELATAN'),
('1273030', '1273', 'SIANTAR BARAT'),
('1273040', '1273', '<NAME>'),
('1273050', '1273', '<NAME>'),
('1273060', '1273', '<NAME>ARTOBA'),
('1273061', '1273', '<NAME>'),
('1274010', '1274', '<NAME>'),
('1274011', '1274', 'TEBING TINGGI KOTA'),
('1274020', '1274', 'RAMBUTAN'),
('1274021', '1274', 'BAJENIS'),
('1274030', '1274', '<NAME>'),
('1275010', '1275', 'MEDAN TUNTUNGAN'),
('1275020', '1275', 'MEDAN JOHOR'),
('1275030', '1275', 'MEDAN AMPLAS'),
('1275040', '1275', 'MEDAN DENAI'),
('1275050', '1275', 'MEDAN AREA'),
('1275060', '1275', 'MEDAN KOTA'),
('1275070', '1275', 'MEDAN MAIMUN'),
('1275080', '1275', 'MEDAN POLONIA'),
('1275090', '1275', 'MEDAN BARU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1275100', '1275', 'MEDAN SELAYANG'),
('1275110', '1275', 'MEDAN SUNGGAL'),
('1275120', '1275', 'MEDAN HELVETIA'),
('1275130', '1275', 'MEDAN PETISAH'),
('1275140', '1275', 'MEDAN BARAT'),
('1275150', '1275', 'MEDAN TIMUR'),
('1275160', '1275', 'MEDAN PERJUANGAN'),
('1275170', '1275', 'MEDAN TEMBUNG'),
('1275180', '1275', 'MEDAN DELI'),
('1275190', '1275', 'MEDAN LABUHAN'),
('1275200', '1275', 'MEDAN MARELAN'),
('1275210', '1275', 'MEDAN BELAWAN'),
('1276010', '1276', 'BINJAI SELATAN'),
('1276020', '1276', 'BINJAI KOTA'),
('1276030', '1276', 'BINJAI TIMUR'),
('1276040', '1276', 'BINJAI UTARA'),
('1276050', '1276', 'BINJAI BARAT'),
('1277010', '1277', 'PADANGSIDIMPUAN TENGGARA'),
('1277020', '1277', 'PADANGSIDIMPUAN SELATAN'),
('1277030', '1277', 'PADANGSIDIMPUAN BATUNADUA'),
('1277040', '1277', 'PADANGSIDIMPUAN UTARA'),
('1277050', '1277', 'PADANGSIDIMPUAN HUTAIMBARU'),
('1277051', '1277', 'PADANGSIDIMPUAN ANGKOLA JULU'),
('1278010', '1278', 'GUNUNGSITOLI IDANOI'),
('1278020', '1278', 'GUNUNGSITOLI SELATAN'),
('1278030', '1278', 'GUNUNGSITOLI BARAT'),
('1278040', '1278', 'GUNUNG SITOLI'),
('1278050', '1278', 'GUNUNGSITOLI ALO OA'),
('1278060', '1278', 'GUNUNGSITOLI UTARA'),
('1301011', '1301', 'PAGAI SELATAN'),
('1301012', '1301', 'SIKAKAP'),
('1301013', '1301', 'PAGAI UTARA'),
('1301021', '1301', 'SIPORA SELATAN'),
('1301022', '1301', 'SIPORA UTARA'),
('1301030', '1301', 'SIBERUT SELATAN'),
('1301031', '1301', 'SEBERUT BARAT DAYA'),
('1301032', '1301', 'SIBERUT TENGAH'),
('1301040', '1301', 'SIBERUT UTARA'),
('1301041', '1301', 'SIBERUT BARAT'),
('1302011', '1302', 'SILAUT'),
('1302012', '1302', 'LUNANG'),
('1302020', '1302', 'BASA AMPEK BALAI TAPAN'),
('1302021', '1302', 'RANAH AMPEK HULU TAPAN'),
('1302030', '1302', 'PANCUNG SOAL'),
('1302031', '1302', 'AIRPURA'),
('1302040', '1302', '<NAME>'),
('1302050', '1302', 'RANAH PESISIR'),
('1302060', '1302', 'LENGAYANG'),
('1302070', '1302', 'SUTERA'),
('1302080', '1302', 'BATANG KAPAS');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1302090', '1302', 'IV JURAI'),
('1302100', '1302', 'BAYANG'),
('1302101', '1302', 'IV NAGARI BAYANG UTARA'),
('1302110', '1302', 'KOTO XI TARUSAN'),
('1303040', '1303', '<NAME>'),
('1303050', '1303', 'LEMBAH GUMANTI'),
('1303051', '1303', '<NAME>'),
('1303060', '1303', 'PAYUNG SEKAKI'),
('1303061', '1303', 'TIGO LURAH'),
('1303070', '1303', 'LEMBANG JAYA'),
('1303071', '1303', 'DANAU KEMBAR'),
('1303080', '1303', 'GUNUNG TALANG'),
('1303090', '1303', 'BUKIT SUNDI'),
('1303100', '1303', 'IX KOTO SUNGAI LASI'),
('1303110', '1303', 'KUBUNG'),
('1303120', '1303', 'X KOTO DIATAS'),
('1303130', '1303', 'X KOTO SINGKARAK'),
('1303140', '1303', 'JUNJUNG SIRIH'),
('1304050', '1304', 'KAMANG BARU'),
('1304060', '1304', 'TANJUNG GADANG'),
('1304070', '1304', 'SIJUNJUNG'),
('1304071', '1304', 'LUBUK TAROK'),
('1304080', '1304', 'IV NAGARI'),
('1304090', '1304', 'KUPITAN'),
('1304100', '1304', 'KOTO TUJUH'),
('1304110', '1304', 'SUMPUR KUDUS'),
('1305010', '1305', 'SEPULUH KOTO'),
('1305020', '1305', 'BATIPUH'),
('1305021', '1305', 'BATIPUH SELATAN'),
('1305030', '1305', 'PARIANGAN'),
('1305040', '1305', 'RAMBATAN'),
('1305050', '1305', 'LIMA KAUM'),
('1305060', '1305', 'TANJUNG EMAS'),
('1305070', '1305', '<NAME>'),
('1305080', '1305', 'LINTAU BUO'),
('1305081', '1305', 'LINTAU BUO UTARA'),
('1305090', '1305', 'SUNGAYANG'),
('1305100', '1305', 'SUNGAI TARAB'),
('1305110', '1305', 'SALIMPAUNG'),
('1305111', '1305', 'TANJUNG BARU'),
('1306010', '1306', 'BATANG ANAI'),
('1306020', '1306', 'LUBUK ALUNG'),
('1306021', '1306', 'SINTUK TOBOH GADANG'),
('1306030', '1306', 'ULAKAN TAPAKIS'),
('1306040', '1306', '<NAME>'),
('1306050', '1306', '2 X 11 ENAM LINGKUNG'),
('1306051', '1306', 'ENAM LINGKUNG'),
('1306052', '1306', '2 X 11 KAYU TANAM'),
('1306060', '1306', 'VII KOTO SUNGAI SARIAK'),
('1306061', '1306', 'PATAMUAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1306062', '1306', 'PADANG SAGO'),
('1306070', '1306', 'V KOTO KP DALAM'),
('1306071', '1306', 'V KOTO TIMUR'),
('1306080', '1306', 'SUNGAI LIMAU'),
('1306081', '1306', 'BATANG GASAN'),
('1306090', '1306', 'SUNGAI GERINGGING'),
('1306100', '1306', 'IV KOTO AUR MALINTANG'),
('1307010', '1307', 'TANJUNG MUTIARA'),
('1307020', '1307', 'LUBUK BASUNG'),
('1307021', '1307', 'AMPEK NAGARI'),
('1307030', '1307', 'TANJUNG RAYA'),
('1307040', '1307', 'MATUR'),
('1307050', '1307', 'IV KOTO'),
('1307051', '1307', 'MALALAK'),
('1307061', '1307', 'BANUHAMPU'),
('1307062', '1307', 'SUNGAI PUA'),
('1307070', '1307', 'AMPEK ANGKEK'),
('1307071', '1307', 'CANDUANG'),
('1307080', '1307', 'BASO'),
('1307090', '1307', 'TILATANG KAMANG'),
('1307091', '1307', 'KAMANG MAGEK'),
('1307100', '1307', 'PALEMBAYAN'),
('1307110', '1307', 'PALUPUH'),
('1308010', '1308', 'PAYAKUMBUH'),
('1308011', '1308', 'AKABILURU'),
('1308020', '1308', 'LUAK'),
('1308021', '1308', 'LAREH SAGO HALABAN'),
('1308022', '1308', 'SITUJUAH LIMO NAGARI'),
('1308030', '1308', 'HARAU'),
('1308040', '1308', 'GUGUAK'),
('1308041', '1308', 'MUNGKA'),
('1308050', '1308', 'SULIKI'),
('1308051', '1308', 'BUKIK BARISAN'),
('1308060', '1308', 'GUNUANG OMEH'),
('1308070', '1308', 'KAPUR IX'),
('1308080', '1308', 'PANGKALAN KOTO BARU'),
('1309070', '1309', 'BONJOL'),
('1309071', '1309', 'TIGO NAGARI'),
('1309072', '1309', 'SIMPANG ALAHAN MATI'),
('1309080', '1309', 'LUBUK SIKAPING'),
('1309100', '1309', 'DUA KOTO'),
('1309110', '1309', 'PANTI'),
('1309111', '1309', 'PADANG GELUGUR'),
('1309121', '1309', 'RAO'),
('1309122', '1309', 'MAPAT TUNGGUL'),
('1309123', '1309', 'MAPAT TUNGGUL SELATAN'),
('1309124', '1309', 'RAO SELATAN'),
('1309125', '1309', 'RAO UTARA'),
('1310010', '1310', 'SANGIR'),
('1310020', '1310', 'SANGIR JUJUAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1310021', '1310', 'SANGIR BALAI JANGGO'),
('1310030', '1310', 'SANGIR BATANG HARI'),
('1310040', '1310', 'SUNGAI PAGU'),
('1310041', '1310', 'PAUAH DUO'),
('1310050', '1310', 'KOTO PARIK GADANG DIATEH'),
('1311010', '1311', 'SUNGAI RUMBAI'),
('1311011', '1311', 'KOTO BESAR'),
('1311012', '1311', 'ASAM JUJUHAN'),
('1311020', '1311', 'KOTO BARU'),
('1311021', '1311', 'KOTO SALAK'),
('1311022', '1311', 'TIUMANG'),
('1311023', '1311', 'PADANG LAWEH'),
('1311030', '1311', 'SITIUNG'),
('1311031', '1311', 'TIMPEH'),
('1311040', '1311', 'PULAU PUNJUNG'),
('1311041', '1311', 'IX KOTO'),
('1312010', '1312', 'SUNGAI BEREMAS'),
('1312020', '1312', 'RANAH BATAHAN'),
('1312030', '1312', 'KOTO BALINGKA'),
('1312040', '1312', 'SUNGAI AUR'),
('1312050', '1312', 'LEMBAH MALINTANG'),
('1312060', '1312', 'GUNUNG TULEH'),
('1312070', '1312', 'TALAMAU'),
('1312080', '1312', 'PASAMAN'),
('1312090', '1312', 'LU<NAME> DUO'),
('1312100', '1312', '<NAME>'),
('1312110', '1312', 'KINALI'),
('1371010', '1371', 'BUNGUS TELUK KABUNG'),
('1371020', '1371', 'LUBUK KILANGAN'),
('1371030', '1371', 'LUBUK BEGALUNG'),
('1371040', '1371', 'PADANG SELATAN'),
('1371050', '1371', 'PADANG TIMUR'),
('1371060', '1371', 'PADANG BARAT'),
('1371070', '1371', 'PADANG UTARA'),
('1371080', '1371', 'NANGGALO'),
('1371090', '1371', 'KURANJI'),
('1371100', '1371', 'PAUH'),
('1371110', '1371', 'KOTO TANGAH'),
('1372010', '1372', 'LUBUK SIKARAH'),
('1372020', '1372', 'TANJUNG HARAPAN'),
('1373010', '1373', 'SILUNGKANG'),
('1373020', '1373', 'LEMBAH SEGAR'),
('1373030', '1373', 'BARANGIN'),
('1373040', '1373', 'TALAWI'),
('1374010', '1374', 'PADANG PANJANG BARAT'),
('1374020', '1374', 'PADANG PANJANG TIMUR'),
('1375010', '1375', 'GUGUK PANJANG'),
('1375020', '1375', 'MANDIANGIN KOTO SELAYAN'),
('1375030', '1375', 'AUR BIRUGO TIGO BALEH'),
('1376010', '1376', 'PAYAKUMBUH BARAT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1376011', '1376', 'PAYAKUMBUH SELATAN'),
('1376020', '1376', 'PAYAKUMBUH TIMUR'),
('1376030', '1376', 'PAYAKUMBUH UTARA'),
('1376031', '1376', 'LAMPOSI TIGO NAGORI'),
('1377010', '1377', 'PARIAMAN SELATAN'),
('1377020', '1377', 'PARIAMAN TENGAH'),
('1377021', '1377', 'PARIAMAN TIMUR'),
('1377030', '1377', 'PARIAMAN UTARA'),
('1401010', '1401', '<NAME>'),
('1401011', '1401', 'H<NAME>'),
('1401012', '1401', '<NAME>'),
('1401013', '1401', '<NAME>'),
('1401020', '1401', 'SINGINGI'),
('1401021', '1401', '<NAME>'),
('1401030', '1401', '<NAME>'),
('1401031', '1401', '<NAME>'),
('1401040', '1401', 'BENAI'),
('1401050', '1401', '<NAME>'),
('1401051', '1401', 'PANGEAN'),
('1401052', '1401', 'LOGAS TANAH DARAT'),
('1401053', '1401', '<NAME>'),
('1401060', '1401', 'CERENTI'),
('1401061', '1401', 'INUMAN'),
('1402010', '1402', 'PERANAP'),
('1402011', '1402', 'BATANG PERANAP'),
('1402020', '1402', 'SEBERIDA'),
('1402021', '1402', 'BATANG CENAKU'),
('1402022', '1402', 'BATANG GANSAL'),
('1402030', '1402', 'KELAYANG'),
('1402031', '1402', '<NAME>'),
('1402040', '1402', '<NAME>'),
('1402041', '1402', 'LIRIK'),
('1402042', '1402', 'SUNGAI LALA'),
('1402043', '1402', 'LUBUK BATU JAYA'),
('1402050', '1402', 'RENGAT BARAT'),
('1402060', '1402', 'RENGAT'),
('1402061', '1402', 'KUALA CENAKU'),
('1403010', '1403', 'KERITANG'),
('1403011', '1403', 'KEMUNING'),
('1403020', '1403', 'RETEH'),
('1403021', '1403', 'SUNGAI BATANG'),
('1403030', '1403', 'ENOK'),
('1403040', '1403', 'TANAH MERAH'),
('1403050', '1403', 'KUALA INDRAGIRI'),
('1403051', '1403', 'CONCONG'),
('1403060', '1403', 'TEMBILAHAN'),
('1403061', '1403', 'TEMBILAHAN HULU'),
('1403070', '1403', 'TEMPULING'),
('1403071', '1403', 'KEMPAS'),
('1403080', '1403', 'BATANG TUAKA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1403090', '1403', 'GAUNG ANAK SERKA'),
('1403100', '1403', 'GAUNG'),
('1403110', '1403', 'MANDAH'),
('1403120', '1403', 'KATEMAN'),
('1403121', '1403', 'PELANGIRAN'),
('1403122', '1403', 'TELUK BELENGKONG'),
('1403123', '1403', 'PULAU BURUNG'),
('1404010', '1404', 'LANGGAM'),
('1404011', '1404', 'PANGKALAN KERINCI'),
('1404012', '1404', 'BANDAR SEIKIJANG'),
('1404020', '1404', 'PANGKALAN KURAS'),
('1404021', '1404', 'UKUI'),
('1404022', '1404', 'PANGKALAN LESUNG'),
('1404030', '1404', 'BUNUT'),
('1404031', '1404', 'PELALAWAN'),
('1404032', '1404', 'BANDAR PETALANGAN'),
('1404040', '1404', 'KUALA KAMPAR'),
('1404041', '1404', 'KERUMUTAN'),
('1404042', '1404', 'TELUK MERANTI'),
('1405010', '1405', 'MINAS'),
('1405011', '1405', 'SUNGAI MANDAU'),
('1405012', '1405', 'KANDIS'),
('1405020', '1405', 'SIAK'),
('1405021', '1405', 'KERINCI KANAN'),
('1405022', '1405', 'TUALANG'),
('1405023', '1405', 'DAYUN'),
('1405024', '1405', 'LUBUK DALAM'),
('1405025', '1405', 'KOTO GASIB'),
('1405026', '1405', 'MEMPURA'),
('1405030', '1405', 'SUNGAI APIT'),
('1405031', '1405', 'BUNGA RAYA'),
('1405032', '1405', 'SABAK AUH'),
('1405033', '1405', 'PUSAKO'),
('1406010', '1406', 'KAMPAR KIRI'),
('1406011', '1406', 'KAMPAR KIRI HULU'),
('1406012', '1406', 'KAMPAR KIRI HILIR'),
('1406013', '1406', 'GUNUNG SAHILAN'),
('1406014', '1406', 'KAMPAR KIRI TENGAH'),
('1406020', '1406', 'XIII KOTO KAMPAR'),
('1406021', '1406', 'KOTO KAMPAR HULU'),
('1406030', '1406', 'KUOK'),
('1406031', '1406', 'SALO'),
('1406040', '1406', 'TAPUNG'),
('1406041', '1406', 'TAPUNG HULU'),
('1406042', '1406', 'TAPUNG HILIR'),
('1406050', '1406', 'BANGKINANG KOTA'),
('1406051', '1406', 'BANGKINANG'),
('1406060', '1406', 'KAMPAR'),
('1406061', '1406', 'KAMPAR TIMUR'),
('1406062', '1406', 'RUMBIO JAYA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1406063', '1406', 'KAMPAR UTARA'),
('1406070', '1406', 'TAMBANG'),
('1406080', '1406', 'SIAK HULU'),
('1406081', '1406', 'PERHENTIAN RAJA'),
('1407010', '1407', 'ROKAN IV KOTO'),
('1407011', '1407', 'PENDALIAN IV KOTO'),
('1407020', '1407', 'TANDUN'),
('1407021', '1407', 'KABUN'),
('1407022', '1407', 'UJUNG BATU'),
('1407030', '1407', 'RAM<NAME>'),
('1407040', '1407', 'RAMBAH'),
('1407041', '1407', 'RAMBAH HILIR'),
('1407042', '1407', 'BANGUN PURBA'),
('1407050', '1407', 'TAMBUSAI'),
('1407051', '1407', 'TAMBUSAI UTARA'),
('1407060', '1407', 'KEPENUHAN'),
('1407061', '1407', 'KEPENUHAN HULU'),
('1407070', '1407', 'KUNTO DARUSSALAM'),
('1407071', '1407', 'PAGARAN TAPAH DARUSSALAM'),
('1407072', '1407', 'BONAI DARUSSALAM'),
('1408010', '1408', 'MANDAU'),
('1408011', '1408', 'PINGGIR'),
('1408020', '1408', 'BUKIT BATU'),
('1408021', '1408', 'SIAK KECIL'),
('1408030', '1408', 'RUPAT'),
('1408031', '1408', 'RUPAT UTARA'),
('1408040', '1408', 'BENGKALIS'),
('1408050', '1408', 'BANTAN'),
('1409010', '1409', 'TANAH PUTIH'),
('1409011', '1409', 'PUJUD'),
('1409012', '1409', 'TANAH PUTIH TANJUNG MELAWAN'),
('1409013', '1409', 'RANTAU KOPAR'),
('1409014', '1409', 'TANJUNG MEDAN'),
('1409020', '1409', 'BAGAN SINEMBAH'),
('1409021', '1409', 'SIMPANG KANAN'),
('1409022', '1409', 'BAGAN SINEMBAH RAYA'),
('1409023', '1409', 'BALAI JAYA'),
('1409030', '1409', 'KUBU'),
('1409031', '1409', 'PASIR LIMAU KAPAS'),
('1409032', '1409', 'KUBU BABUSSALAM'),
('1409040', '1409', 'BANGKO'),
('1409041', '1409', 'SINABOI'),
('1409042', '1409', 'BATU HAMPAR'),
('1409043', '1409', 'PEKAITAN'),
('1409050', '1409', 'RIMBA MELINTANG'),
('1409051', '1409', 'BANGKO PUSAKO'),
('1410010', '1410', 'TEBING TINGGI BARAT'),
('1410020', '1410', 'TEBING TINGGI'),
('1410021', '1410', 'TEBING TINGGI TIMUR'),
('1410030', '1410', 'RANGSANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1410031', '1410', 'RANGSANG PESISIR'),
('1410040', '1410', 'RANGSANG BARAT'),
('1410050', '1410', 'MERBAU'),
('1410051', '1410', 'PULAU MERBAU'),
('1410052', '1410', '<NAME>'),
('1471010', '1471', 'TAMPAN'),
('1471011', '1471', 'PAYUNG SEKAKI'),
('1471020', '1471', 'BUKIT RAYA'),
('1471021', '1471', 'MARPOYAN DAMAI'),
('1471022', '1471', 'TENAYAN RAYA'),
('1471030', '1471', 'LIMAPULUH'),
('1471040', '1471', 'SAIL'),
('1471050', '1471', 'PEKANBARU KOTA'),
('1471060', '1471', 'SUKAJADI'),
('1471070', '1471', 'SENAPELAN'),
('1471080', '1471', 'RUMBAI'),
('1471081', '1471', 'RUMBAI PESISIR'),
('1473010', '1473', 'BUKIT KAPUR'),
('1473011', '1473', 'MEDANG KAMPAI'),
('1473012', '1473', 'SUNGAI SEMBILAN'),
('1473020', '1473', 'DUMAI BARAT'),
('1473021', '1473', 'DUMAI SELATAN'),
('1473030', '1473', 'DUMAI TIMUR'),
('1473031', '1473', 'DUMAI KOTA'),
('1501010', '1501', 'GUNUNG RAYA'),
('1501011', '1501', 'BUKIT KERMAN'),
('1501020', '1501', 'BATANG MERANGIN'),
('1501030', '1501', 'KELILING DANAU'),
('1501040', '1501', 'DANAU KERINCI'),
('1501050', '1501', 'SITINJAU LAUT'),
('1501070', '1501', 'AIR HANGAT'),
('1501071', '1501', 'AIR HANGAT TIMUR'),
('1501072', '1501', 'DEPATI VII'),
('1501073', '1501', 'AIR HANGAT BARAT'),
('1501080', '1501', '<NAME>'),
('1501081', '1501', 'SIULAK'),
('1501082', '1501', 'SIULAK MUKAI'),
('1501090', '1501', 'KAYU ARO'),
('1501091', '1501', 'G<NAME>UJUH'),
('1501092', '1501', 'KAYU ARO BARAT'),
('1502010', '1502', 'JANGKAT'),
('1502011', '1502', 'SUNGAI TENANG'),
('1502020', '1502', 'MUARA SIAU'),
('1502021', '1502', 'LEMBAH MASURAI'),
('1502022', '1502', 'TIANG PUMPUNG'),
('1502030', '1502', 'PAMENANG'),
('1502031', '1502', 'PAMENANG BARAT'),
('1502032', '1502', 'RENAH PAMENANG'),
('1502033', '1502', 'PAMENANG SELATAN'),
('1502040', '1502', 'BANGKO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1502041', '1502', 'BANGKO BARAT'),
('1502042', '1502', 'NALO TANTAN'),
('1502043', '1502', 'BATANG MASUMAI'),
('1502050', '1502', 'SUNGAI MANAU'),
('1502051', '1502', 'RENAH PEMBARAP'),
('1502052', '1502', 'PANGKALAN JAMBU'),
('1502060', '1502', 'TABIR'),
('1502061', '1502', 'TABIR ULU'),
('1502062', '1502', 'TABIR SELATAN'),
('1502063', '1502', 'TABIR ILIR'),
('1502064', '1502', 'TABIR TIMUR'),
('1502065', '1502', 'TABIR LINTAS'),
('1502066', '1502', 'MARGO TABIR'),
('1502067', '1502', 'TABIR BARAT'),
('1503010', '1503', 'BATANG ASAI'),
('1503020', '1503', 'LIMUN'),
('1503021', '1503', '<NAME>'),
('1503030', '1503', 'PELAWAN'),
('1503031', '1503', 'SINGKUT'),
('1503040', '1503', 'SAROLANGUN'),
('1503041', '1503', 'BATHIN VIII'),
('1503050', '1503', 'PAUH'),
('1503051', '1503', 'AIR HITAM'),
('1503060', '1503', 'MANDIANGIN'),
('1504010', '1504', 'MERSAM'),
('1504011', '1504', '<NAME>'),
('1504020', '1504', 'BATIN XXIV'),
('1504030', '1504', 'MUARA TEMBESI'),
('1504040', '1504', '<NAME>ULIAN'),
('1504041', '1504', 'BAJUBANG'),
('1504042', '1504', '<NAME>'),
('1504050', '1504', 'PEMAYUNG'),
('1505010', '1505', 'MESTONG'),
('1505011', '1505', 'SUNGAI BAHAR'),
('1505012', '1505', 'BAHAR SELATAN'),
('1505013', '1505', 'BAHAR UTARA'),
('1505020', '1505', 'KUMPEH ULU'),
('1505021', '1505', 'SUNGAI GELAM'),
('1505030', '1505', 'KUMPEH'),
('1505040', '1505', '<NAME>'),
('1505041', '1505', '<NAME>'),
('1505050', '1505', 'JAMBI LUAR KOTA'),
('1505060', '1505', 'SEKERNAN'),
('1506010', '1506', 'MENDAHARA'),
('1506011', '1506', 'MENDAHARA ULU'),
('1506012', '1506', 'GERAGAI'),
('1506020', '1506', 'DENDANG'),
('1506031', '1506', 'MUARA SABAK BARAT'),
('1506032', '1506', 'MUARA SABAK TIMUR'),
('1506033', '1506', 'KUALA JAMBI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1506040', '1506', 'RANTAU RASAU'),
('1506041', '1506', 'BERBAK'),
('1506050', '1506', 'NIPAH PANJANG'),
('1506060', '1506', 'SADU'),
('1507010', '1507', 'TUNGKAL ULU'),
('1507011', '1507', 'MERLUNG'),
('1507012', '1507', 'BATANG ASAM'),
('1507013', '1507', 'TEBING TINGGI'),
('1507014', '1507', 'RENAH MENDALUH'),
('1507015', '1507', 'MUARA PAPALIK'),
('1507020', '1507', 'PENGABUAN'),
('1507021', '1507', 'SENYERANG'),
('1507030', '1507', 'TUNGKAL ILIR'),
('1507031', '1507', 'BRAM ITAM'),
('1507032', '1507', 'SEBERANG KOTA'),
('1507040', '1507', 'BETARA'),
('1507041', '1507', 'KUALA BETARA'),
('1508010', '1508', 'TEBO ILIR'),
('1508011', '1508', 'MUARA TABIR'),
('1508020', '1508', 'TEBO TENGAH'),
('1508021', '1508', 'SUMAY'),
('1508022', '1508', 'TENGAH ILIR'),
('1508030', '1508', 'RIMBO BUJANG'),
('1508031', '1508', 'RIMBO ULU'),
('1508032', '1508', 'RIMBO ILIR'),
('1508040', '1508', 'TEBO ULU'),
('1508041', '1508', 'VII KOTO'),
('1508042', '1508', '<NAME>'),
('1508043', '1508', 'VII KOTO ILIR'),
('1509010', '1509', 'PELEPAT'),
('1509011', '1509', 'PELEPAT ILIR'),
('1509021', '1509', 'BATHIN II BABEKO'),
('1509022', '1509', 'RIMBO TENGAH'),
('1509023', '1509', 'BUNGO DANI'),
('1509024', '1509', '<NAME>'),
('1509025', '1509', 'BATHIN III'),
('1509030', '1509', '<NAME>'),
('1509031', '1509', 'MUKO-MUKO BATHIN VII'),
('1509032', '1509', 'BATHIN III ULU'),
('1509040', '1509', 'TANAH SEPENGGAL'),
('1509041', '1509', 'TANAH SEPENGGAL LINTAS'),
('1509050', '1509', 'TANAH TUMBUH'),
('1509051', '1509', 'LIMBUR LUBUK MENGKUANG'),
('1509052', '1509', 'BATHIN II PELAYANG'),
('1509060', '1509', 'JUJUHAN'),
('1509061', '1509', 'JUJUHAN ILIR'),
('1571010', '1571', 'KOTA BARU'),
('1571020', '1571', 'JAMBI SELATAN'),
('1571030', '1571', 'JELUTUNG'),
('1571040', '1571', 'PASAR JAMBI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1571050', '1571', 'TELANAIPURA'),
('1571060', '1571', 'DANAU TELUK'),
('1571070', '1571', 'PELAYANGAN'),
('1571080', '1571', 'JAMBI TIMUR'),
('1572010', '1572', 'TANAH KAMPUNG'),
('1572020', '1572', 'KUMUN DEBAI'),
('1572030', '1572', 'SUNGAI PENUH'),
('1572031', '1572', 'PONDOK TINGGGI'),
('1572032', '1572', 'SUNGAI BUNGKAL'),
('1572040', '1572', 'HAMPARAN RAWANG'),
('1572050', '1572', 'PESISIR BUKIT'),
('1572051', '1572', 'KOTO BARU'),
('1601052', '1601', 'LENGKITI'),
('1601070', '1601', '<NAME>'),
('1601080', '1601', 'PENGANDONAN'),
('1601081', '1601', 'SEMIDANG AJI'),
('1601082', '1601', 'ULU OGAN'),
('1601083', '1601', 'MUARA JAYA'),
('1601090', '1601', 'PENINJAUAN'),
('1601091', '1601', 'LUBUK BATANG'),
('1601092', '1601', 'SINAR PENINJAUAN'),
('1601093', '1601', 'KEDATON PENINJAUAN RAYA'),
('1601130', '1601', 'BATU RAJA TIMUR'),
('1601131', '1601', 'LUBUK RAJA'),
('1601140', '1601', 'BATU RAJA BARAT'),
('1602010', '1602', 'LEMPUING'),
('1602011', '1602', 'LEMPUING JAYA'),
('1602020', '1602', 'MESUJI'),
('1602021', '1602', 'SUNGAI MENANG'),
('1602022', '1602', 'MESUJI MAKMUR'),
('1602023', '1602', 'MESUJI RAYA'),
('1602030', '1602', 'TULUNG SELAPAN'),
('1602031', '1602', 'CENGAL'),
('1602040', '1602', 'PEDAMARAN'),
('1602041', '1602', 'PED<NAME>UR'),
('1602050', '1602', 'TANJUNG LUBUK'),
('1602051', '1602', 'TELUK GELAM'),
('1602060', '1602', 'KOTA KAYU AGUNG'),
('1602120', '1602', 'SIRAH PULAU PADANG'),
('1602121', '1602', 'JEJAWI'),
('1602130', '1602', 'PAMPANGAN'),
('1602131', '1602', 'PANGKALAN LAPAM'),
('1602140', '1602', 'AIR SUGIHAN'),
('1603010', '1603', 'SEMENDO DARAT LAUT'),
('1603011', '1603', 'SEMENDO DARAT ULU'),
('1603012', '1603', 'SEMENDO DARAT TENGAH'),
('1603020', '1603', 'TANJUNG AGUNG'),
('1603031', '1603', 'RAMBANG'),
('1603032', '1603', 'LUBAI'),
('1603033', '1603', 'LUBAI ULU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1603040', '1603', 'LAWANG KIDUL'),
('1603050', '1603', 'MUARA ENIM'),
('1603051', '1603', 'UJAN MAS'),
('1603060', '1603', '<NAME>'),
('1603061', '1603', 'BENAKAT'),
('1603062', '1603', 'BELIMBING'),
('1603070', '1603', '<NAME>'),
('1603090', '1603', 'GELUMBANG'),
('1603091', '1603', 'LEMBAK'),
('1603092', '1603', 'SUNGAI ROTAN'),
('1603093', '1603', '<NAME>'),
('1603094', '1603', 'KELEKAR'),
('1603095', '1603', 'BELIDA DARAT'),
('1604011', '1604', 'TANJUNG SAKTI PUMI'),
('1604012', '1604', 'TANJUNG SAKTI PUMU'),
('1604040', '1604', 'KOTA AGUNG'),
('1604041', '1604', 'MUL<NAME>'),
('1604042', '1604', 'TANJUNG TEBAT'),
('1604050', '1604', 'PUL<NAME>ANG'),
('1604051', '1604', '<NAME>'),
('1604052', '1604', 'GU<NAME>'),
('1604060', '1604', 'JARAI'),
('1604061', '1604', 'PAJAR BULAN'),
('1604062', '1604', 'MUARA PAYANG'),
('1604063', '1604', 'SUKAMERINDU'),
('1604111', '1604', 'KIKIM BARAT'),
('1604112', '1604', 'KIKIM TIMUR'),
('1604113', '1604', 'KIKIM SELATAN'),
('1604114', '1604', 'KIKIM TENGAH'),
('1604120', '1604', 'LAHAT'),
('1604121', '1604', 'GU<NAME>'),
('1604122', '1604', 'PSEKSU'),
('1604131', '1604', 'MERAPI BARAT'),
('1604132', '1604', 'MERAPI TIMUR'),
('1604133', '1604', 'MERAPI SELATAN'),
('1605030', '1605', 'SUKU TENGAH LAKITAN ULU'),
('1605031', '1605', 'SELANGIT'),
('1605032', '1605', 'SUMBER HARTA'),
('1605040', '1605', 'TUGUMULYO'),
('1605041', '1605', 'PURWODADI'),
('1605050', '1605', 'MUARA BELITI'),
('1605051', '1605', 'TIANG PUMPUNG KEPUNGUT'),
('1605060', '1605', 'JAYALOKA'),
('1605061', '1605', 'SUKA KARYA'),
('1605070', '1605', 'MUARA KELINGI'),
('1605071', '1605', 'BULANG TENGAH SUKU ULU'),
('1605072', '1605', 'TUAH NEGERI'),
('1605080', '1605', 'MUARA LAKITAN'),
('1605090', '1605', 'MEGANG SAKTI'),
('1606010', '1606', 'SANGA DESA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1606020', '1606', 'BABAT TOMAN'),
('1606021', '1606', 'BATANGHARI LEKO'),
('1606022', '1606', 'PLAKAT TINGGI'),
('1606023', '1606', 'LAWANG WETAN'),
('1606030', '1606', 'SUNGAI KERUH'),
('1606040', '1606', 'SEKAYU'),
('1606041', '1606', 'LAIS'),
('1606090', '1606', 'SUNGAI LILIN'),
('1606091', '1606', 'KELUANG'),
('1606092', '1606', 'BABAT SUPAT'),
('1606100', '1606', 'BAYUNG LENCIR'),
('1606101', '1606', 'LALAN'),
('1606102', '1606', 'TUNGKAL JAYA'),
('1607010', '1607', 'RANTAU BAYUR'),
('1607020', '1607', 'BETUNG'),
('1607021', '1607', 'SUAK TAPEH'),
('1607030', '1607', 'PULAU RIMAU'),
('1607031', '1607', 'TUNGKAL ILIR'),
('1607040', '1607', 'BANYUASIN III'),
('1607041', '1607', 'SEMBAWA'),
('1607050', '1607', 'TALANG KELAPA'),
('1607051', '1607', 'TANJUNG LAGO'),
('1607060', '1607', 'BANYUASIN I'),
('1607061', '1607', 'AIR KUMBANG'),
('1607070', '1607', 'RAMBUTAN'),
('1607080', '1607', 'MUARA PADANG'),
('1607081', '1607', 'MUARA SUGIHAN'),
('1607090', '1607', 'MAKARTI JAYA'),
('1607091', '1607', 'AIR SALEH'),
('1607100', '1607', 'BANYUASIN II'),
('1607110', '1607', 'MUARA TELANG'),
('1607111', '1607', 'SUMBER MARGA TELANG'),
('1608010', '1608', 'MEKAKAU ILIR'),
('1608020', '1608', 'BANDING AGUNG'),
('1608021', '1608', 'WARKUK RANAU SELATAN'),
('1608022', '1608', 'BUAY PEMATANG RIBU RANAU TENGAH'),
('1608030', '1608', 'BUAY PEMACA'),
('1608040', '1608', 'SIMPANG'),
('1608041', '1608', 'BUANA PEMACA'),
('1608050', '1608', 'MUARADUA'),
('1608051', '1608', 'BUAY RAWAN'),
('1608060', '1608', 'BUAY SANDANG AJI'),
('1608061', '1608', 'TIGA DIHAJI'),
('1608070', '1608', 'BUAY RUNJUNG'),
('1608071', '1608', 'RUNJUNG AGUNG'),
('1608080', '1608', 'KISAM TINGGI'),
('1608090', '1608', 'MUARADUA KISAM'),
('1608091', '1608', 'KISAM ILIR'),
('1608100', '1608', 'PULAU BERINGIN'),
('1608101', '1608', 'SINDANG DANAU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1608102', '1608', 'SUNGAI ARE'),
('1609010', '1609', 'MARTAPURA'),
('1609011', '1609', 'BUNGA MAYANG'),
('1609012', '1609', 'JAYA PURA'),
('1609020', '1609', 'BUAY PEMUKA PELIUNG'),
('1609030', '1609', 'BUAY MADANG'),
('1609031', '1609', 'BUAY MADANG TIMUR'),
('1609032', '1609', 'BUAY PEMUKA BANGSA RAJA'),
('1609040', '1609', 'MADANG SUKU II'),
('1609041', '1609', 'MADANG SUKU III'),
('1609050', '1609', 'MADANG SUKU I'),
('1609051', '1609', 'BELITANG MADANG RAYA'),
('1609060', '1609', 'BELITANG'),
('1609061', '1609', 'BELITANG JAYA'),
('1609070', '1609', 'BELITANG III'),
('1609080', '1609', 'BELITANG II'),
('1609081', '1609', 'BELITANG MULYA'),
('1609090', '1609', 'SEMENDAWAI SUKU III'),
('1609091', '1609', 'SEMENDAWAI TIMUR'),
('1609100', '1609', 'CEMPAKA'),
('1609101', '1609', 'SEMENDAWAI BARAT'),
('1610010', '1610', 'MUARA KUANG'),
('1610011', '1610', '<NAME>'),
('1610012', '1610', 'LUBUK KELIAT'),
('1610020', '1610', 'TANJUNG BATU'),
('1610021', '1610', 'PAYARAMAN'),
('1610030', '1610', 'RANTAU ALAI'),
('1610031', '1610', 'KANDIS'),
('1610040', '1610', 'TANJUNG RAJA'),
('1610041', '1610', 'RANTAU PANJANG'),
('1610042', '1610', 'SUNGAI PINANG'),
('1610050', '1610', 'PEMULUTAN'),
('1610051', '1610', 'PEMULUTAN SELATAN'),
('1610052', '1610', 'PEMULUTAN BARAT'),
('1610060', '1610', 'INDRALAYA'),
('1610061', '1610', 'INDRALAYA UTARA'),
('1610062', '1610', 'INDRALAYA SELATAN'),
('1611010', '1611', 'MUARA PINANG'),
('1611020', '1611', 'LINTANG KANAN'),
('1611030', '1611', 'PENDOPO'),
('1611031', '1611', 'PENDOPO BARAT'),
('1611040', '1611', 'PASEMAH AIR KERUH'),
('1611050', '1611', 'ULU MUSI'),
('1611051', '1611', 'SIKAP DALAM'),
('1611060', '1611', 'TALANG PADANG'),
('1611070', '1611', 'TEBING TINGGI'),
('1611071', '1611', 'SALING'),
('1612010', '1612', 'TALANG UBI'),
('1612020', '1612', 'TANAH ABANG'),
('1612030', '1612', 'ABAB');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1612040', '1612', 'PENUKAL'),
('1612050', '1612', 'PENUKAL UTARA'),
('1613010', '1613', 'ULU RAWAS'),
('1613020', '1613', 'KARANG JAYA'),
('1613030', '1613', 'RAWAS ULU'),
('1613040', '1613', 'RUPIT'),
('1613050', '1613', 'KARANG DAPO'),
('1613060', '1613', 'RAWAS ILIR'),
('1613070', '1613', 'NIBUNG'),
('1671010', '1671', 'ILIR BARAT II'),
('1671011', '1671', 'GANDUS'),
('1671020', '1671', 'SEBERANG ULU I'),
('1671021', '1671', 'KERTAPATI'),
('1671030', '1671', 'SEBERANG ULU II'),
('1671031', '1671', 'PLAJU'),
('1671040', '1671', 'ILIR BARAT I'),
('1671041', '1671', 'BUKIT KECIL'),
('1671050', '1671', 'ILIR TIMUR I'),
('1671051', '1671', 'KEMUNING'),
('1671060', '1671', 'ILIR TIMUR II'),
('1671061', '1671', 'KALIDONI'),
('1671070', '1671', 'SAKO'),
('1671071', '1671', 'SEMATANG BORANG'),
('1671080', '1671', 'SUKARAMI'),
('1671081', '1671', 'ALANG ALANG LEBAR'),
('1672010', '1672', 'RAMBANG KAPAK TENGAH'),
('1672020', '1672', 'PRABUMULIH TIMUR'),
('1672021', '1672', 'PRABUMULIH SELATAN'),
('1672030', '1672', 'PRABUMULIH BARAT'),
('1672031', '1672', 'PRABUMULIH UTARA'),
('1672040', '1672', 'CAMBAI'),
('1673010', '1673', 'DEMPO SELATAN'),
('1673011', '1673', 'DEMPO TENGAH'),
('1673020', '1673', 'DEMPO UTARA'),
('1673030', '1673', 'PAGAR ALAM SELATAN'),
('1673040', '1673', 'PAGAR ALAM UTARA'),
('1674011', '1674', 'LUBUK LINGGAU BARAT I'),
('1674012', '1674', 'LUBUK LINGGAU BARAT II'),
('1674021', '1674', 'LUBUK LINGGAU SELATAN I'),
('1674022', '1674', 'LUBUK LINGGAU SELATAN II'),
('1674031', '1674', 'LUBUK LINGGAU TIMUR I'),
('1674032', '1674', 'LUBUK LINGGAU TIMUR II'),
('1674041', '1674', 'LUBUK LINGGAU UTARA I'),
('1674042', '1674', 'LUBUK LINGGAU UTARA II'),
('1701040', '1701', 'MANNA'),
('1701041', '1701', 'KOTA MANNA'),
('1701042', '1701', 'KEDURANG'),
('1701043', '1701', 'BUNGA MAS'),
('1701044', '1701', '<NAME>'),
('1701045', '1701', 'KEDURANG ILIR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1701050', '1701', 'SEGINIM'),
('1701051', '1701', 'AIR NIPIS'),
('1701060', '1701', 'PINO'),
('1701061', '1701', 'PINORAYA'),
('1701062', '1701', 'ULU MANNA'),
('1702020', '1702', 'KOTA PADANG'),
('1702021', '1702', 'SINDANG BELITI ILIR'),
('1702030', '1702', 'PADANG ULAK TANDING'),
('1702031', '1702', 'SINDANG KELINGI'),
('1702032', '1702', 'BINDU RIANG'),
('1702033', '1702', 'SINDANG BELITI ULU'),
('1702034', '1702', 'SINDANG DATARAN'),
('1702040', '1702', 'CURUP'),
('1702041', '1702', 'BERMANI ULU'),
('1702042', '1702', 'SELUPU REJANG'),
('1702043', '1702', 'CURUP SELATAN'),
('1702044', '1702', 'CURUP TENGAH'),
('1702045', '1702', 'BERMANI ULU RAYA'),
('1702046', '1702', 'CURUP UTARA'),
('1702047', '1702', 'CURUP TIMUR'),
('1703010', '1703', 'ENGGANO'),
('1703050', '1703', 'KERKAP'),
('1703051', '1703', 'AIR NAPAL'),
('1703052', '1703', 'AIR BESI'),
('1703053', '1703', 'HULU PALIK'),
('1703054', '1703', 'TANJUNG AGUNG PALIK'),
('1703060', '1703', 'ARGA MAKMUR'),
('1703061', '1703', 'ARMA JAYA'),
('1703070', '1703', 'LAIS'),
('1703071', '1703', 'BATIK NAU'),
('1703072', '1703', 'GIRI MULYA'),
('1703073', '1703', 'AIR PADANG'),
('1703080', '1703', 'PADANG JAYA'),
('1703090', '1703', 'KETAHUN'),
('1703091', '1703', 'NAPAL PUTIH'),
('1703092', '1703', 'ULOK KUPAI'),
('1703093', '1703', 'PINANG RAYA'),
('1703100', '1703', 'PUTRI HIJAU'),
('1703101', '1703', 'MARGA SAKTI SEBELAT'),
('1704010', '1704', 'NASAL'),
('1704020', '1704', 'MAJE'),
('1704030', '1704', 'KAUR SELATAN'),
('1704031', '1704', 'TETAP'),
('1704040', '1704', 'KAUR TENGAH'),
('1704041', '1704', 'LUAS'),
('1704042', '1704', 'MUARA SAHUNG'),
('1704050', '1704', 'KINAL'),
('1704051', '1704', 'SEMIDANG GUMAY'),
('1704060', '1704', 'TANJUNG KEMUNING'),
('1704061', '1704', 'KELAM TENGAH');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1704070', '1704', 'KAUR UTARA'),
('1704071', '1704', '<NAME>'),
('1704072', '1704', 'LUNGKANG KULE'),
('1704073', '1704', 'PADANG GUCI HULU'),
('1705010', '1705', 'SEMIDANG ALAS MARAS'),
('1705020', '1705', 'SEMIDANG ALAS'),
('1705030', '1705', 'TALO'),
('1705031', '1705', 'ILIR TALO'),
('1705032', '1705', 'TALO KECIL'),
('1705033', '1705', 'ULU TALO'),
('1705040', '1705', 'SELUMA'),
('1705041', '1705', 'SELUMA SELATAN'),
('1705042', '1705', 'SELUMA BARAT'),
('1705043', '1705', 'SELUMA TIMUR'),
('1705044', '1705', 'SELUMA UTARA'),
('1705050', '1705', 'SUKARAJA'),
('1705051', '1705', 'AIR PERIUKAN'),
('1705052', '1705', 'LUBUK SANDI'),
('1706010', '1706', 'IPUH'),
('1706011', '1706', 'AIR RAMI'),
('1706012', '1706', 'MALIN DEMAN'),
('1706020', '1706', 'PONDOK SUGUH'),
('1706021', '1706', 'SUNGAI RUMBAI'),
('1706022', '1706', 'TERAMANG JAYA'),
('1706030', '1706', 'TERAS TERUNJAM'),
('1706031', '1706', 'PENARIK'),
('1706032', '1706', 'SELAGAN RAYA'),
('1706040', '1706', 'KOTA MUKOMUKO'),
('1706041', '1706', 'AIR DIKIT'),
('1706042', '1706', 'XIV KOTO'),
('1706050', '1706', 'LUBUK PINANG'),
('1706051', '1706', 'AIR MANJUNTO'),
('1706052', '1706', 'V KOTO'),
('1707010', '1707', 'RIMBO PENGADANG'),
('1707011', '1707', 'TOPOS'),
('1707020', '1707', 'LEBONG SELATAN'),
('1707021', '1707', 'BINGIN KUNING'),
('1707030', '1707', 'LEBONG TENGAH'),
('1707031', '1707', 'LEBONG SAKTI'),
('1707040', '1707', 'LEBONG ATAS'),
('1707041', '1707', 'PADANG BANO'),
('1707042', '1707', 'PELABAI'),
('1707050', '1707', 'LEBONG UTARA'),
('1707051', '1707', 'AMEN'),
('1707052', '1707', 'URAM JAYA'),
('1707053', '1707', 'PINANG BELAPIS'),
('1708010', '1708', 'MUARA KEMUMU'),
('1708020', '1708', 'BERMANI ILIR'),
('1708030', '1708', 'SEBERANG MUSI'),
('1708040', '1708', 'TEBAT KARAI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1708050', '1708', 'KEPAHIANG'),
('1708060', '1708', 'KABA WETAN'),
('1708070', '1708', 'UJAN MAS'),
('1708080', '1708', 'MERIGI'),
('1709010', '1709', 'TALANG EMPAT'),
('1709020', '1709', 'KARANG TINGGI'),
('1709030', '1709', 'TABA PENANJUNG'),
('1709031', '1709', '<NAME>'),
('1709040', '1709', 'P<NAME>'),
('1709041', '1709', 'MERIGI SAKTI'),
('1709050', '1709', 'PONDOK KELAPA'),
('1709051', '1709', 'PONDOK KUBANG'),
('1709060', '1709', 'PEMATANG TIGA'),
('1709061', '1709', 'BANG HAJI'),
('1771010', '1771', 'SELEBAR'),
('1771011', '1771', 'KAMPUNG MELAYU'),
('1771020', '1771', 'GADING CEMPAKA'),
('1771021', '1771', 'RATU AGUNG'),
('1771022', '1771', 'RATU SAMBAN'),
('1771023', '1771', 'SINGARAN PATI'),
('1771030', '1771', 'TELUK SEGARA'),
('1771031', '1771', 'SUNGAI SERUT'),
('1771040', '1771', 'MUARA BANGKA HULU'),
('1801040', '1801', 'BALIK BUKIT'),
('1801041', '1801', 'SUKAU'),
('1801042', '1801', 'LUMBOK SEMINUNG'),
('1801050', '1801', 'BELALAU'),
('1801051', '1801', 'SEKINCAU'),
('1801052', '1801', 'SUOH'),
('1801053', '1801', 'BATU BRAK'),
('1801054', '1801', 'PAGAR DEWA'),
('1801055', '1801', 'BATU KETULIS'),
('1801056', '1801', 'BANDAR NEGERI SUOH'),
('1801060', '1801', 'SUMBER JAYA'),
('1801061', '1801', 'WAY TENONG'),
('1801062', '1801', 'GEDUNG SURIAN'),
('1801063', '1801', 'KEBUN TEBU'),
('1801064', '1801', 'AIR HITAM'),
('1802010', '1802', 'WONOSOBO'),
('1802011', '1802', 'SEMAKA'),
('1802012', '1802', 'BANDAR NEGERI SEMUONG'),
('1802020', '1802', 'KOTA AGUNG'),
('1802021', '1802', 'PEMATANG SAWA'),
('1802022', '1802', 'KOTA AGUNG TIMUR'),
('1802023', '1802', 'KOTA AGUNG BARAT'),
('1802030', '1802', 'PULAU PANGGUNG'),
('1802031', '1802', 'ULUBELU'),
('1802032', '1802', 'AIR NANINGAN'),
('1802040', '1802', 'TALANG PADANG'),
('1802041', '1802', 'SUMBEREJO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1802042', '1802', 'GISTING'),
('1802043', '1802', 'GUNUNG ALIP'),
('1802050', '1802', 'PUGUNG'),
('1802101', '1802', 'BULOK'),
('1802110', '1802', 'CUKUH BALAK'),
('1802111', '1802', 'KELUMBAYAN'),
('1802112', '1802', 'LIMAU'),
('1802113', '1802', 'KELUMBAYAN BARAT'),
('1803060', '1803', 'NATAR'),
('1803070', '1803', 'JATI AGUNG'),
('1803080', '1803', 'TANJUNG BINTANG'),
('1803081', '1803', 'TANJUNG SARI'),
('1803090', '1803', 'KATIBUNG'),
('1803091', '1803', 'MERBAU MATARAM'),
('1803092', '1803', 'WAY SULAN'),
('1803100', '1803', 'SIDOMULYO'),
('1803101', '1803', 'CANDIPURO'),
('1803102', '1803', 'WAY PANJI'),
('1803110', '1803', 'KALIANDA'),
('1803111', '1803', 'RAJABASA'),
('1803120', '1803', 'PALAS'),
('1803121', '1803', 'SRAGI'),
('1803130', '1803', 'PENENGAHAN'),
('1803131', '1803', 'KETAPANG'),
('1803132', '1803', 'BAKAUHENI'),
('1804010', '1804', 'METRO KIBANG'),
('1804020', '1804', 'BATANGHARI'),
('1804030', '1804', 'SEKAMPUNG'),
('1804040', '1804', 'MARGATIGA'),
('1804050', '1804', 'SEKAMPUNG UDIK'),
('1804060', '1804', 'JABUNG'),
('1804061', '1804', '<NAME>'),
('1804062', '1804', 'WAWAY KARYA'),
('1804063', '1804', 'MARGA SEKAMPUNG'),
('1804070', '1804', 'LABUHAN MARINGGAI'),
('1804071', '1804', '<NAME>'),
('1804072', '1804', '<NAME>'),
('1804073', '1804', 'MELINTING'),
('1804074', '1804', 'GUNUNG PELINDUNG'),
('1804080', '1804', 'WAY JEPARA'),
('1804081', '1804', '<NAME>'),
('1804082', '1804', 'LABUHAN RATU'),
('1804090', '1804', 'SUKADANA'),
('1804091', '1804', 'BUMI AGUNG'),
('1804092', '1804', 'BATANGHARI NUBAN'),
('1804100', '1804', 'PEKALONGAN'),
('1804110', '1804', 'RAMAN UTARA'),
('1804120', '1804', 'PURBOLINGGO'),
('1804121', '1804', 'WAY BUNGUR'),
('1805010', '1805', 'PADANG RATU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1805011', '1805', 'SELAGAI LINGGA'),
('1805012', '1805', 'PUBIAN'),
('1805013', '1805', 'ANAK TUHA'),
('1805014', '1805', 'ANAK RATU AJI'),
('1805020', '1805', 'KALIREJO'),
('1805021', '1805', 'SENDANG AGUNG'),
('1805030', '1805', 'BANGUNREJO'),
('1805040', '1805', 'GUNUNG SUGIH'),
('1805041', '1805', 'BEKRI'),
('1805042', '1805', 'BUMI RATU NUBAN'),
('1805050', '1805', 'TRIMURJO'),
('1805060', '1805', 'PUNGGUR'),
('1805061', '1805', 'KOTA GAJAH'),
('1805070', '1805', 'SEPUTIH RAMAN'),
('1805080', '1805', 'TERBANGGI BESAR'),
('1805081', '1805', 'SEPUTIH AGUNG'),
('1805082', '1805', 'WAY PENGUBUAN'),
('1805090', '1805', 'TERUSAN NUNYAI'),
('1805100', '1805', 'SEPUTIH MATARAM'),
('1805101', '1805', 'BANDAR MATARAM'),
('1805110', '1805', 'SEPUTIH BANYAK'),
('1805111', '1805', 'WAY SEPUTIH'),
('1805120', '1805', 'RUMBIA'),
('1805121', '1805', 'BUMI NABUNG'),
('1805122', '1805', 'PUTRA RUMBIA'),
('1805130', '1805', 'SEPUTIH SURABAYA'),
('1805131', '1805', 'BANDAR SURABAYA'),
('1806010', '1806', 'BUKIT KEMUNING'),
('1806011', '1806', 'ABUNG TINGGI'),
('1806020', '1806', 'TANJUNG RAJA'),
('1806030', '1806', 'ABUNG BARAT'),
('1806031', '1806', 'ABUNG TENGAH'),
('1806032', '1806', 'ABUNG KUNANG'),
('1806033', '1806', 'ABUNG PEKURUN'),
('1806040', '1806', 'KOTABUMI'),
('1806041', '1806', 'KOTABUMI UTARA'),
('1806042', '1806', 'KOTABUMI SELATAN'),
('1806050', '1806', 'ABUNG SELATAN'),
('1806051', '1806', 'ABUNG SEMULI'),
('1806052', '1806', 'BLAMBANGAN PAGAR'),
('1806060', '1806', 'ABUNG TIMUR'),
('1806061', '1806', 'ABUNG SURAKARTA'),
('1806070', '1806', 'SUNGKAI SELATAN'),
('1806071', '1806', 'MUARA SUNGKAI'),
('1806072', '1806', 'BUNGA MAYANG'),
('1806073', '1806', 'SUNGKAI BARAT'),
('1806074', '1806', 'SUNGKAI JAYA'),
('1806080', '1806', 'SUNGKAI UTARA'),
('1806081', '1806', 'HULUSUNGKAI'),
('1806082', '1806', 'SUNGKAI TENGAH');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1807010', '1807', 'BANJIT'),
('1807020', '1807', 'BARADATU'),
('1807021', '1807', 'GUNUNG LABUHAN'),
('1807030', '1807', 'KASUI'),
('1807031', '1807', 'REBANG TANGKAS'),
('1807040', '1807', 'BLAMBANGAN UMPU'),
('1807041', '1807', 'WAY TUBA'),
('1807042', '1807', 'NEGERI AGUNG'),
('1807050', '1807', 'BAHUGA'),
('1807051', '1807', 'BUAY BAHUGA'),
('1807052', '1807', 'BUMI AGUNG'),
('1807060', '1807', 'PAKUAN RATU'),
('1807061', '1807', 'NEG<NAME>'),
('1807062', '1807', 'NEGERI BESAR'),
('1808030', '1808', 'BANJAR AGUNG'),
('1808031', '1808', '<NAME>'),
('1808032', '1808', 'BAN<NAME>'),
('1808040', '1808', 'GEDUNG AJI'),
('1808041', '1808', '<NAME>'),
('1808042', '1808', '<NAME>'),
('1808050', '1808', 'MENGGALA'),
('1808051', '1808', '<NAME>'),
('1808052', '1808', '<NAME>'),
('1808053', '1808', 'GEDUNG MENENG'),
('1808054', '1808', '<NAME>'),
('1808055', '1808', '<NAME>'),
('1808056', '1808', 'GEDUNG AJI BARU'),
('1808057', '1808', '<NAME>'),
('1808058', '1808', 'MENGGALA TIMUR'),
('1809010', '1809', '<NAME>'),
('1809011', '1809', '<NAME>'),
('1809020', '1809', '<NAME>'),
('1809021', '1809', 'TELUK PANDAN'),
('1809022', '1809', 'WAY RATAI'),
('1809030', '1809', 'KEDONDONG'),
('1809031', '1809', 'WAY KHILAU'),
('1809040', '1809', 'WAY LIMA'),
('1809050', '1809', 'GEDUNG TATAAN'),
('1809060', '1809', 'NEGERI KATON'),
('1809070', '1809', 'TEGINENENG'),
('1810010', '1810', 'PARDASUKA'),
('1810020', '1810', 'AMBARAWA'),
('1810030', '1810', 'PAGELARAN'),
('1810031', '1810', 'PAGELARAN UTARA'),
('1810040', '1810', 'PRINGSEWU'),
('1810050', '1810', '<NAME>'),
('1810060', '1810', 'SUKOHARJO'),
('1810070', '1810', 'BANYUMAS'),
('1810080', '1810', '<NAME>'),
('1811010', '1811', 'WAY SERDANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1811020', '1811', 'SIMPANG PEMATANG'),
('1811030', '1811', 'PANCA JAYA'),
('1811040', '1811', 'TANJUNG RAYA'),
('1811050', '1811', 'MESUJI'),
('1811060', '1811', 'MESUJI TIMUR'),
('1811070', '1811', 'RAWAJITU UTARA'),
('1812010', '1812', 'TULANG BAWANG UDIK'),
('1812020', '1812', 'TUMI JAJAR'),
('1812030', '1812', 'TULANG BAWANG TENGAH'),
('1812040', '1812', 'PAGAR DEWA'),
('1812050', '1812', 'LAMBU KIBANG'),
('1812060', '1812', 'GUNUNG TERANG'),
('1812070', '1812', 'GUNUNG AGUNG'),
('1812080', '1812', 'WAY KENANGA'),
('1813010', '1813', 'LEMONG'),
('1813020', '1813', 'PESISIR UTARA'),
('1813030', '1813', 'PULAU PISANG'),
('1813040', '1813', 'KARYA PENGGAWA'),
('1813050', '1813', 'WAY KRUI'),
('1813060', '1813', 'PESISIR TENGAH'),
('1813070', '1813', 'KRUI SELATAN'),
('1813080', '1813', 'PESISIR SELATAN'),
('1813090', '1813', 'NGAMBUR'),
('1813100', '1813', 'BENGKUNAT'),
('1813110', '1813', 'BENGKUNAT BELIMBING'),
('1871010', '1871', 'TELUK BETUNG BARAT'),
('1871011', '1871', 'TELUKBETUNG TIMUR'),
('1871020', '1871', 'TELUK BETUNG SELATAN'),
('1871021', '1871', 'BUMI WARAS'),
('1871030', '1871', 'PANJANG'),
('1871040', '1871', 'TANJUNG KARANG TIMUR'),
('1871041', '1871', 'KEDAMAIAN'),
('1871050', '1871', 'TELUK BETUNG UTARA'),
('1871060', '1871', 'TANJUNG KARANG PUSAT'),
('1871061', '1871', 'ENGGAL'),
('1871070', '1871', 'TANJUNG KARANG BARAT'),
('1871071', '1871', 'KEMILING'),
('1871072', '1871', 'LANGKAPURA'),
('1871080', '1871', 'KEDATON'),
('1871081', '1871', 'RAJABASA'),
('1871082', '1871', 'TANJUNG SENANG'),
('1871083', '1871', 'LABUHAN RATU'),
('1871090', '1871', 'SUKARAME'),
('1871091', '1871', 'SUKABUMI'),
('1871092', '1871', 'WAY HALIM'),
('1872011', '1872', 'METRO SELATAN'),
('1872012', '1872', 'METRO BARAT'),
('1872021', '1872', 'METRO TIMUR'),
('1872022', '1872', 'METRO PUSAT'),
('1872023', '1872', 'METRO UTARA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('1901070', '1901', 'MENDO BARAT'),
('1901080', '1901', 'MERAWANG'),
('1901081', '1901', 'PUDING BESAR'),
('1901090', '1901', 'SUNGAI LIAT'),
('1901091', '1901', 'PEMALI'),
('1901092', '1901', 'BAKAM'),
('1901130', '1901', 'BELINYU'),
('1901131', '1901', 'RIAU SILIP'),
('1902010', '1902', 'MEMBALONG'),
('1902060', '1902', 'TANJUNG PANDAN'),
('1902061', '1902', 'BADAU'),
('1902062', '1902', 'SIJUK'),
('1902063', '1902', 'SELAT NASIK'),
('1903010', '1903', 'KELAPA'),
('1903020', '1903', 'TEMPILANG'),
('1903030', '1903', 'MENTOK'),
('1903040', '1903', 'SIMPANG TERITIP'),
('1903050', '1903', 'JEBUS'),
('1903051', '1903', 'PARITTIGA'),
('1904010', '1904', 'KOBA'),
('1904011', '1904', 'LUBUK BESAR'),
('1904020', '1904', 'PANGKALAN BARU'),
('1904021', '1904', 'NAMANG'),
('1904030', '1904', 'SUNGAI SELAN'),
('1904040', '1904', 'SIMPANG KATIS'),
('1905010', '1905', 'PAYUNG'),
('1905011', '1905', 'PULAU BESAR'),
('1905020', '1905', 'SIMPANG RIMBA'),
('1905030', '1905', 'TOBOALI'),
('1905031', '1905', 'TUKAK SADAI'),
('1905040', '1905', 'AIR GEGAS'),
('1905050', '1905', 'LEPAR PONGOK'),
('1905051', '1905', 'KEPULAUAN PONGOK'),
('1906010', '1906', 'DENDANG'),
('1906011', '1906', 'SIMPANG PESAK'),
('1906020', '1906', 'GANTUNG'),
('1906021', '1906', 'SIMPANG RENGGIANG'),
('1906030', '1906', 'MANGGAR'),
('1906031', '1906', 'DAMAR'),
('1906040', '1906', 'KELAPA KAMPIT'),
('1971010', '1971', 'RANGKUI'),
('1971020', '1971', 'BUKIT INTAN'),
('1971021', '1971', 'GIRIMAYA'),
('1971030', '1971', 'PANGKAL BALAM'),
('1971031', '1971', 'GABEK'),
('1971040', '1971', 'TAMAN SARI'),
('1971041', '1971', 'GERUNGGANG'),
('2101010', '2101', 'MORO'),
('2101011', '2101', 'DURAI'),
('2101020', '2101', 'KUNDUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('2101021', '2101', 'KUNDUR UTARA'),
('2101022', '2101', 'KUNDUR BARAT'),
('2101023', '2101', 'UNGAR'),
('2101024', '2101', 'BELAT'),
('2101030', '2101', 'KARIMUN'),
('2101031', '2101', 'BURU'),
('2101032', '2101', 'MERAL'),
('2101033', '2101', 'TEBING'),
('2101034', '2101', 'MERAL BARAT'),
('2102040', '2102', 'TELUK BINTAN'),
('2102050', '2102', 'BINTAN UTARA'),
('2102051', '2102', 'TELUK SEBONG'),
('2102052', '2102', 'SERI KUALA LOBAM'),
('2102060', '2102', 'BINTAN TIMUR'),
('2102061', '2102', 'GUNUNG KIJANG'),
('2102062', '2102', 'MANTANG'),
('2102063', '2102', 'B<NAME>'),
('2102064', '2102', 'TOAPAYA'),
('2102070', '2102', 'TAMBELAN'),
('2103030', '2103', 'MIDAI'),
('2103040', '2103', 'BUNGURAN BARAT'),
('2103041', '2103', 'BUNGURAN UTARA'),
('2103042', '2103', 'PULAU LAUT'),
('2103043', '2103', 'PULAU TIGA'),
('2103050', '2103', 'BUNGURAN TIMUR'),
('2103051', '2103', 'BUNGURAN TIMUR LAUT'),
('2103052', '2103', 'BUNGURAN TENGAH'),
('2103053', '2103', 'BUNGURAN SELATAN'),
('2103060', '2103', 'SERASAN'),
('2103061', '2103', 'SUBI'),
('2103062', '2103', 'SERASAN TIMUR'),
('2104010', '2104', 'SINGKEP BARAT'),
('2104020', '2104', 'SINGKEP'),
('2104021', '2104', 'SINGKEP SELATAN'),
('2104022', '2104', 'SINGKEP PESISIR'),
('2104030', '2104', 'LINGGA'),
('2104031', '2104', 'SELAYAR'),
('2104032', '2104', 'LINGGA TIMUR'),
('2104040', '2104', 'LINGGA UTARA'),
('2104050', '2104', 'SENAYANG'),
('2105010', '2105', 'JEMAJA'),
('2105020', '2105', 'JEMAJA TIMUR'),
('2105030', '2105', 'SIANTAN SELATAN'),
('2105040', '2105', 'SIANTAN'),
('2105050', '2105', 'SIANTAN TIMUR'),
('2105060', '2105', 'SIANTAN TENGAH'),
('2105070', '2105', 'PALMATAK'),
('2171010', '2171', 'BELAKANG PADANG'),
('2171020', '2171', 'BULANG'),
('2171030', '2171', 'GALANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('2171040', '2171', 'SEI BEDUK'),
('2171041', '2171', 'SAGULUNG'),
('2171050', '2171', 'NONGSA'),
('2171051', '2171', 'BATAM KOTA'),
('2171060', '2171', 'SEKUPANG'),
('2171061', '2171', 'BATU AJI'),
('2171070', '2171', 'LUBUK BAJA'),
('2171080', '2171', 'BATU AMPAR'),
('2171081', '2171', 'BENGKONG'),
('2172010', '2172', 'BUKIT BESTARI'),
('2172020', '2172', 'TANJUNGPINANG TIMUR'),
('2172030', '2172', 'TANJUNGPINANG KOTA'),
('2172040', '2172', 'TANJUNGPINANG BARAT'),
('3101010', '3101', 'KEPULAUAN SERIBU SELATAN'),
('3101020', '3101', 'KEPULAUAN SERIBU UTARA'),
('3171010', '3171', 'JAGAKARSA'),
('3171020', '3171', '<NAME>'),
('3171030', '3171', 'CILANDAK'),
('3171040', '3171', 'PESANGGRAHAN'),
('3171050', '3171', 'KEBAYORAN LAMA'),
('3171060', '3171', 'KEBAYORAN BARU'),
('3171070', '3171', 'MAMPANG PRAPATAN'),
('3171080', '3171', 'PANCORAN'),
('3171090', '3171', 'TEBET'),
('3171100', '3171', 'SETIA BUDI'),
('3172010', '3172', '<NAME>'),
('3172020', '3172', 'CIRACAS'),
('3172030', '3172', 'CIPAYUNG'),
('3172040', '3172', 'MAKASAR'),
('3172050', '3172', '<NAME>'),
('3172060', '3172', 'JATINEGARA'),
('3172070', '3172', 'D<NAME>AWIT'),
('3172080', '3172', 'CAKUNG'),
('3172090', '3172', '<NAME>'),
('3172100', '3172', 'MATRAMAN'),
('3173010', '3173', 'TANAH ABANG'),
('3173020', '3173', 'MENTENG'),
('3173030', '3173', 'SENEN'),
('3173040', '3173', '<NAME>'),
('3173050', '3173', 'CEMPAKA PUTIH'),
('3173060', '3173', 'KEMAYORAN'),
('3173070', '3173', 'SAWAH BESAR'),
('3173080', '3173', 'GAMBIR'),
('3174010', '3174', 'KEMBANGAN'),
('3174020', '3174', 'KEBON JERUK'),
('3174030', '3174', 'PALMERAH'),
('3174040', '3174', 'GROGOL PETAMBURAN'),
('3174050', '3174', 'TAMBORA'),
('3174060', '3174', 'TAMAN SARI'),
('3174070', '3174', 'CENGKARENG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3174080', '3174', 'KALI DERES'),
('3175010', '3175', 'PENJARINGAN'),
('3175020', '3175', 'PADEMANGAN'),
('3175030', '3175', 'TANJUNG PRIOK'),
('3175040', '3175', 'KOJA'),
('3175050', '3175', 'KELAPA GADING'),
('3175060', '3175', 'CILINCING'),
('3201010', '3201', 'NANGGUNG'),
('3201020', '3201', 'LEUWILIANG'),
('3201021', '3201', 'LEUWISADENG'),
('3201030', '3201', 'PAMIJAHAN'),
('3201040', '3201', 'CIBUNGBULANG'),
('3201050', '3201', 'CIAMPEA'),
('3201051', '3201', 'TENJOLAYA'),
('3201060', '3201', 'DRAMAGA'),
('3201070', '3201', 'CIOMAS'),
('3201071', '3201', 'TAMANSARI'),
('3201080', '3201', 'CIJERUK'),
('3201081', '3201', 'CIGOMBONG'),
('3201090', '3201', 'CARINGIN'),
('3201100', '3201', 'CIAWI'),
('3201110', '3201', 'CISARUA'),
('3201120', '3201', 'MEGAMENDUNG'),
('3201130', '3201', 'SUKARAJA'),
('3201140', '3201', 'B<NAME>'),
('3201150', '3201', 'SUKAMAKMUR'),
('3201160', '3201', 'CARIU'),
('3201161', '3201', 'TANJUNGSARI'),
('3201170', '3201', 'JONGGOL'),
('3201180', '3201', 'CILEUNGSI'),
('3201181', '3201', 'KELAPA NUNGGAL'),
('3201190', '3201', 'GUNUNG PUTRI'),
('3201200', '3201', 'CITEUREUP'),
('3201210', '3201', 'CIBINONG'),
('3201220', '3201', '<NAME>'),
('3201221', '3201', '<NAME>'),
('3201230', '3201', 'KEMANG'),
('3201231', '3201', '<NAME>'),
('3201240', '3201', 'PARUNG'),
('3201241', '3201', 'CISEENG'),
('3201250', '3201', 'GUNUNG SINDUR'),
('3201260', '3201', 'RUMPIN'),
('3201270', '3201', 'CIGUDEG'),
('3201271', '3201', 'SUKAJAYA'),
('3201280', '3201', 'JASINGA'),
('3201290', '3201', 'TENJO'),
('3201300', '3201', 'PARUNG PANJANG'),
('3202010', '3202', 'CIEMAS'),
('3202020', '3202', 'CIRACAP'),
('3202021', '3202', 'WALURAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3202030', '3202', 'SURADE'),
('3202031', '3202', 'CIBITUNG'),
('3202040', '3202', 'JAMPANG KULON'),
('3202041', '3202', 'CIMANGGU'),
('3202050', '3202', 'KALI BUNDER'),
('3202060', '3202', 'TEGAL BULEUD'),
('3202070', '3202', 'CIDOLOG'),
('3202080', '3202', 'SAGARANTEN'),
('3202081', '3202', 'CIDADAP'),
('3202082', '3202', 'CURUGKEMBAR'),
('3202090', '3202', 'PABUARAN'),
('3202100', '3202', 'LENGKONG'),
('3202110', '3202', 'PALABUHANRATU'),
('3202111', '3202', 'SIMPENAN'),
('3202120', '3202', 'WARUNG KIARA'),
('3202121', '3202', 'BANTARGADUNG'),
('3202130', '3202', 'JAMPANG TENGAH'),
('3202131', '3202', 'PURABAYA'),
('3202140', '3202', 'CIKEMBAR'),
('3202150', '3202', 'NYALINDUNG'),
('3202160', '3202', 'GEGER BITUNG'),
('3202170', '3202', 'SUKARAJA'),
('3202171', '3202', 'KEBONPEDES'),
('3202172', '3202', 'CIREUNGHAS'),
('3202173', '3202', 'SUKALARANG'),
('3202180', '3202', 'SUKABUMI'),
('3202190', '3202', 'KADUDAMPIT'),
('3202200', '3202', 'CISAAT'),
('3202201', '3202', 'GUNUNGGURUH'),
('3202210', '3202', 'CIBADAK'),
('3202211', '3202', 'CICANTAYAN'),
('3202212', '3202', 'CARINGIN'),
('3202220', '3202', 'NAGRAK'),
('3202221', '3202', 'CIAMBAR'),
('3202230', '3202', 'CICURUG'),
('3202240', '3202', 'CIDAHU'),
('3202250', '3202', 'PARAKAN SALAK'),
('3202260', '3202', 'PARUNG KUDA'),
('3202261', '3202', 'BOJONG GENTENG'),
('3202270', '3202', 'KALAPA NUNGGAL'),
('3202280', '3202', 'CIKIDANG'),
('3202290', '3202', 'CISOLOK'),
('3202291', '3202', 'CIKAKAK'),
('3202300', '3202', 'KABANDUNGAN'),
('3203010', '3203', 'AGRABINTA'),
('3203011', '3203', 'LELES'),
('3203020', '3203', 'SINDANGBARANG'),
('3203030', '3203', 'CIDAUN'),
('3203040', '3203', 'NARINGGUL'),
('3203050', '3203', 'CIBINONG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3203051', '3203', 'CIKADU'),
('3203060', '3203', 'TANGGEUNG'),
('3203061', '3203', 'PASIRKUDA'),
('3203070', '3203', 'KADUPANDAK'),
('3203071', '3203', 'CIJATI'),
('3203080', '3203', 'TAKOKAK'),
('3203090', '3203', 'SUKANAGARA'),
('3203100', '3203', 'PAGELARAN'),
('3203110', '3203', 'CAMPAKA'),
('3203111', '3203', 'CAMPAKA MULYA'),
('3203120', '3203', 'CIBEBER'),
('3203130', '3203', 'WARUNGKONDANG'),
('3203131', '3203', 'GEKBRONG'),
('3203140', '3203', 'CILAKU'),
('3203150', '3203', 'SUKALUYU'),
('3203160', '3203', 'BOJONGPICUNG'),
('3203161', '3203', 'HAURWANGI'),
('3203170', '3203', 'CIRANJANG'),
('3203180', '3203', 'MANDE'),
('3203190', '3203', 'KARANGTENGAH'),
('3203200', '3203', 'CIANJUR'),
('3203210', '3203', 'CUGENANG'),
('3203220', '3203', 'PACET'),
('3203221', '3203', 'CIPANAS'),
('3203230', '3203', 'SUKARESMI'),
('3203240', '3203', 'CIKALONGKULON'),
('3204010', '3204', 'CIWIDEY'),
('3204011', '3204', 'RANCABALI'),
('3204020', '3204', 'PASIRJAMBU'),
('3204030', '3204', 'CIMAUNG'),
('3204040', '3204', 'PANGALENGAN'),
('3204050', '3204', 'KERTASARI'),
('3204060', '3204', 'PACET'),
('3204070', '3204', 'IBUN'),
('3204080', '3204', 'PASEH'),
('3204090', '3204', 'CIKANCUNG'),
('3204100', '3204', 'CICALENGKA'),
('3204101', '3204', 'NAGREG'),
('3204110', '3204', 'RANCAEKEK'),
('3204120', '3204', 'MAJALAYA'),
('3204121', '3204', 'SOLOKAN JERUK'),
('3204130', '3204', 'CIPARAY'),
('3204140', '3204', 'BALEENDAH'),
('3204150', '3204', 'ARJASARI'),
('3204160', '3204', 'BANJARAN'),
('3204161', '3204', 'CANGKUANG'),
('3204170', '3204', 'PAMEUNGPEUK'),
('3204180', '3204', 'KATAPANG'),
('3204190', '3204', 'SOREANG'),
('3204191', '3204', 'KUTAWARINGIN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3204250', '3204', 'MARGAASIH'),
('3204260', '3204', 'MARGAHAYU'),
('3204270', '3204', 'DAYEUHKOLOT'),
('3204280', '3204', 'BOJONGSOANG'),
('3204290', '3204', 'CILEUNYI'),
('3204300', '3204', 'CILENGKRANG'),
('3204310', '3204', 'CIMENYAN'),
('3205010', '3205', 'CISEWU'),
('3205011', '3205', 'CARINGIN'),
('3205020', '3205', 'TALEGONG'),
('3205030', '3205', 'BUNGBULANG'),
('3205031', '3205', 'MEKARMUKTI'),
('3205040', '3205', 'PAMULIHAN'),
('3205050', '3205', 'PAKENJENG'),
('3205060', '3205', 'CIKELET'),
('3205070', '3205', 'PAMEUNGPEUK'),
('3205080', '3205', 'CIBALONG'),
('3205090', '3205', 'CISOMPET'),
('3205100', '3205', 'PEUNDEUY'),
('3205110', '3205', 'SINGAJAYA'),
('3205111', '3205', 'CIHURIP'),
('3205120', '3205', 'CIKAJANG'),
('3205130', '3205', 'BANJARWANGI'),
('3205140', '3205', 'CILAWU'),
('3205150', '3205', 'BAYONGBONG'),
('3205151', '3205', 'CIGEDUG'),
('3205160', '3205', 'CISURUPAN'),
('3205161', '3205', 'SUKARESMI'),
('3205170', '3205', 'SAMARANG'),
('3205171', '3205', 'PASIRWANGI'),
('3205181', '3205', 'TAROGONG KIDUL'),
('3205182', '3205', 'TAROGONG KALER'),
('3205190', '3205', 'GARUT KOTA'),
('3205200', '3205', 'KARANGPAWITAN'),
('3205210', '3205', 'WANARAJA'),
('3205211', '3205', 'SUCINARAJA'),
('3205212', '3205', 'PANGATIKAN'),
('3205220', '3205', 'SUKAWENING'),
('3205221', '3205', 'KARANGTENGAH'),
('3205230', '3205', 'BANYURESMI'),
('3205240', '3205', 'LELES'),
('3205250', '3205', 'LEUWIGOONG'),
('3205260', '3205', 'CIBATU'),
('3205261', '3205', 'KERSAMANAH'),
('3205270', '3205', 'CIBIUK'),
('3205280', '3205', 'KADUNGORA'),
('3205290', '3205', 'BLUBUR LIMBANGAN'),
('3205300', '3205', 'SELAAWI'),
('3205310', '3205', 'MALANGBONG'),
('3206010', '3206', 'CIPATUJAH');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3206020', '3206', 'KARANGNUNGGAL'),
('3206030', '3206', 'CIKALONG'),
('3206040', '3206', 'PANCATENGAH'),
('3206050', '3206', 'CIKATOMAS'),
('3206060', '3206', 'CIBALONG'),
('3206061', '3206', 'PARUNGPONTENG'),
('3206070', '3206', 'BANTARKALONG'),
('3206071', '3206', 'BOJONGASIH'),
('3206072', '3206', 'CULAMEGA'),
('3206080', '3206', 'BOJONGGAMBIR'),
('3206090', '3206', 'SODONGHILIR'),
('3206100', '3206', 'TARAJU'),
('3206110', '3206', 'SALAWU'),
('3206111', '3206', 'PUSPAHIANG'),
('3206120', '3206', 'TANJUNGJAYA'),
('3206130', '3206', 'SUKARAJA'),
('3206140', '3206', 'SALOPA'),
('3206141', '3206', 'JATIWARAS'),
('3206150', '3206', 'CINEAM'),
('3206151', '3206', 'KARANGJAYA'),
('3206160', '3206', 'MANONJAYA'),
('3206161', '3206', 'GUNUNGTANJUNG'),
('3206190', '3206', 'SINGAPARNA'),
('3206191', '3206', 'SUKARAME'),
('3206192', '3206', 'MANGUNREJA'),
('3206200', '3206', 'CIGALONTANG'),
('3206210', '3206', 'LEUWISARI'),
('3206211', '3206', 'SARIWANGI'),
('3206212', '3206', 'PADAKEMBANG'),
('3206221', '3206', 'SUKARATU'),
('3206230', '3206', 'CISAYONG'),
('3206231', '3206', 'SUKAHENING'),
('3206240', '3206', 'RAJAPOLAH'),
('3206250', '3206', 'JAMANIS'),
('3206260', '3206', 'CIAWI'),
('3206261', '3206', 'KADIPATEN'),
('3206270', '3206', 'PAGERAGEUNG'),
('3206271', '3206', 'SUKARESIK'),
('3207100', '3207', 'BANJARSARI'),
('3207110', '3207', 'LAKBOK'),
('3207111', '3207', 'PURWADADI'),
('3207120', '3207', 'PAMARICAN'),
('3207130', '3207', 'CIDOLOG'),
('3207140', '3207', 'CIMARAGAS'),
('3207150', '3207', 'CIJEUNGJING'),
('3207160', '3207', 'CISAGA'),
('3207170', '3207', 'TAMBAKSARI'),
('3207180', '3207', 'RANCAH'),
('3207190', '3207', 'RAJADESA'),
('3207200', '3207', 'SUKADANA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3207210', '3207', 'CIAMIS'),
('3207211', '3207', 'BAREGBEG'),
('3207220', '3207', 'CIKONENG'),
('3207221', '3207', 'SINDANGKASIH'),
('3207230', '3207', 'CIHAURBEUTI'),
('3207240', '3207', 'SADANANYA'),
('3207250', '3207', 'CIPAKU'),
('3207260', '3207', 'JATINAGARA'),
('3207270', '3207', 'PANAWANGAN'),
('3207280', '3207', 'KAWALI'),
('3207281', '3207', 'LUMBUNG'),
('3207290', '3207', 'PANJALU'),
('3207291', '3207', 'SUKAMANTRI'),
('3207300', '3207', 'PANUMBANGAN'),
('3208010', '3208', 'DARMA'),
('3208020', '3208', 'KADUGEDE'),
('3208021', '3208', 'NUSAHERANG'),
('3208030', '3208', 'CINIRU'),
('3208031', '3208', 'HANTARA'),
('3208040', '3208', 'SELAJAMBE'),
('3208050', '3208', 'SUBANG'),
('3208051', '3208', 'CILEBAK'),
('3208060', '3208', 'CIWARU'),
('3208061', '3208', 'KARANGKANCANA'),
('3208070', '3208', 'CIBINGBIN'),
('3208071', '3208', 'CIBEUREUM'),
('3208080', '3208', 'LURAGUNG'),
('3208081', '3208', 'CIMAHI'),
('3208090', '3208', 'CIDAHU'),
('3208091', '3208', 'KALIMANGGIS'),
('3208100', '3208', 'CIAWIGEBANG'),
('3208101', '3208', 'CIPICUNG'),
('3208110', '3208', 'LEBAKWANGI'),
('3208111', '3208', 'MALEBER'),
('3208120', '3208', 'GARAWANGI'),
('3208121', '3208', 'SINDANGAGUNG'),
('3208130', '3208', 'KUNINGAN'),
('3208140', '3208', 'CIGUGUR'),
('3208150', '3208', 'KRAMATMULYA'),
('3208160', '3208', 'JALAKSANA'),
('3208161', '3208', 'JAPARA'),
('3208170', '3208', 'CILIMUS'),
('3208171', '3208', 'CIGANDAMEKAR'),
('3208180', '3208', 'MANDIRANCAN'),
('3208181', '3208', 'PANCALANG'),
('3208190', '3208', 'PASAWAHAN'),
('3209010', '3209', 'WALED'),
('3209011', '3209', 'PASALEMAN'),
('3209020', '3209', 'CILEDUG'),
('3209021', '3209', 'PABUARAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3209030', '3209', 'LOSARI'),
('3209031', '3209', 'PABEDILAN'),
('3209040', '3209', 'BABAKAN'),
('3209041', '3209', 'GEBANG'),
('3209050', '3209', 'KARANGSEMBUNG'),
('3209051', '3209', 'KARANGWARENG'),
('3209060', '3209', 'LEMAHABANG'),
('3209061', '3209', 'SUSUKANLEBAK'),
('3209070', '3209', 'SEDONG'),
('3209080', '3209', 'ASTANAJAPURA'),
('3209081', '3209', 'PANGENAN'),
('3209090', '3209', 'MUNDU'),
('3209100', '3209', 'BEBER'),
('3209101', '3209', 'GREGED'),
('3209111', '3209', 'TALUN'),
('3209120', '3209', 'SUMBER'),
('3209121', '3209', 'DUKUPUNTANG'),
('3209130', '3209', 'PALIMANAN'),
('3209140', '3209', 'PLUMBON'),
('3209141', '3209', 'DEPOK'),
('3209150', '3209', 'WERU'),
('3209151', '3209', 'PLERED'),
('3209161', '3209', 'TENGAH TANI'),
('3209162', '3209', 'KEDAWUNG'),
('3209171', '3209', 'GUNUNGJATI'),
('3209180', '3209', 'KAPETAKAN'),
('3209181', '3209', 'SURANENGGALA'),
('3209190', '3209', 'KLANGENAN'),
('3209191', '3209', 'JAMBLANG'),
('3209200', '3209', 'ARJAWINANGUN'),
('3209201', '3209', 'PANGURAGAN'),
('3209210', '3209', 'CIWARINGIN'),
('3209211', '3209', 'GEMPOL'),
('3209220', '3209', 'SUSUKAN'),
('3209230', '3209', 'GEGESIK'),
('3209231', '3209', 'KALIWEDI'),
('3210010', '3210', 'LEMAHSUGIH'),
('3210020', '3210', 'BANTARUJEG'),
('3210021', '3210', 'MALAUSMA'),
('3210030', '3210', 'CIKIJING'),
('3210031', '3210', 'CINGAMBUL'),
('3210040', '3210', 'TALAGA'),
('3210041', '3210', 'BANJARAN'),
('3210050', '3210', 'ARGAPURA'),
('3210060', '3210', 'MAJA'),
('3210070', '3210', 'MAJALENGKA'),
('3210080', '3210', 'CIGASONG'),
('3210090', '3210', 'SUKAHAJI'),
('3210091', '3210', 'SINDANG'),
('3210100', '3210', 'RAJAGALUH');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3210110', '3210', 'SINDANGWANGI'),
('3210120', '3210', 'LEUWIMUNDING'),
('3210130', '3210', 'PALASAH'),
('3210140', '3210', 'JATIWANGI'),
('3210150', '3210', 'DAWUAN'),
('3210151', '3210', 'KASOKANDEL'),
('3210160', '3210', 'PANYINGKIRAN'),
('3210170', '3210', 'KADIPATEN'),
('3210180', '3210', 'KERTAJATI'),
('3210190', '3210', 'JATITUJUH'),
('3210200', '3210', 'LIGUNG'),
('3210210', '3210', 'SUMBERJAYA'),
('3211010', '3211', 'JATINANGOR'),
('3211020', '3211', 'CIMANGGUNG'),
('3211030', '3211', 'TANJUNGSARI'),
('3211031', '3211', 'SUKASARI'),
('3211032', '3211', 'PAMULIHAN'),
('3211040', '3211', 'RANCAKALONG'),
('3211050', '3211', 'SUMEDANG SELATAN'),
('3211060', '3211', 'SUMEDANG UTARA'),
('3211061', '3211', 'GANEAS'),
('3211070', '3211', 'SITURAJA'),
('3211071', '3211', 'CISITU'),
('3211080', '3211', 'DARMARAJA'),
('3211090', '3211', 'CIBUGEL'),
('3211100', '3211', 'WADO'),
('3211101', '3211', 'JATINUNGGAL'),
('3211111', '3211', 'JATIGEDE'),
('3211120', '3211', 'TOMO'),
('3211130', '3211', 'UJUNG JAYA'),
('3211140', '3211', 'CONGGEANG'),
('3211150', '3211', 'PASEH'),
('3211160', '3211', 'CIMALAKA'),
('3211161', '3211', 'CISARUA'),
('3211170', '3211', 'TANJUNGKERTA'),
('3211171', '3211', 'TANJUNGMEDAR'),
('3211180', '3211', 'BUAHDUA'),
('3211181', '3211', 'SURIAN'),
('3212010', '3212', 'HAURGEULIS'),
('3212011', '3212', 'GANTAR'),
('3212020', '3212', 'KROYA'),
('3212030', '3212', 'GABUSWETAN'),
('3212040', '3212', 'CIKEDUNG'),
('3212041', '3212', 'TERISI'),
('3212050', '3212', 'LELEA'),
('3212060', '3212', 'BANGODUA'),
('3212061', '3212', 'TUKDANA'),
('3212070', '3212', 'WIDASARI'),
('3212080', '3212', 'KERTASEMAYA'),
('3212081', '3212', 'SUKAGUMIWANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3212090', '3212', 'KRANGKENG'),
('3212100', '3212', 'KARANGAMPEL'),
('3212101', '3212', 'KEDOKAN BUNDER'),
('3212110', '3212', 'JUNTINYUAT'),
('3212120', '3212', 'SLIYEG'),
('3212130', '3212', 'JATIBARANG'),
('3212140', '3212', 'BALONGAN'),
('3212150', '3212', 'INDRAMAYU'),
('3212160', '3212', 'SINDANG'),
('3212161', '3212', 'CANTIGI'),
('3212162', '3212', 'PASEKAN'),
('3212170', '3212', 'LOHBENER'),
('3212171', '3212', 'ARAHAN'),
('3212180', '3212', 'LOSARANG'),
('3212190', '3212', 'KANDANGHAUR'),
('3212200', '3212', 'BONGAS'),
('3212210', '3212', 'ANJATAN'),
('3212220', '3212', 'SUKRA'),
('3212221', '3212', 'PATROL'),
('3213010', '3213', 'SAGALAHERANG'),
('3213011', '3213', 'SERANGPANJANG'),
('3213020', '3213', 'JALANCAGAK'),
('3213021', '3213', 'CIATER'),
('3213030', '3213', 'CISALAK'),
('3213031', '3213', 'KASOMALANG'),
('3213040', '3213', 'TANJUNGSIANG'),
('3213050', '3213', 'CIJAMBE'),
('3213060', '3213', 'CIBOGO'),
('3213070', '3213', 'SUBANG'),
('3213080', '3213', 'KALIJATI'),
('3213081', '3213', 'DAWUAN'),
('3213090', '3213', 'CIPEUNDEUY'),
('3213100', '3213', 'PABUARAN'),
('3213110', '3213', 'PATOKBEUSI'),
('3213120', '3213', 'PURWADADI'),
('3213130', '3213', 'CIKAUM'),
('3213140', '3213', 'PAGADEN'),
('3213141', '3213', 'PAGADEN BARAT'),
('3213150', '3213', 'CIPUNAGARA'),
('3213160', '3213', 'COMPRENG'),
('3213170', '3213', 'BINONG'),
('3213171', '3213', 'TAMBAKDAHAN'),
('3213180', '3213', 'CIASEM'),
('3213190', '3213', 'PAMANUKAN'),
('3213191', '3213', 'SUKASARI'),
('3213200', '3213', 'PUSAKANAGARA'),
('3213201', '3213', 'PUSAKAJAYA'),
('3213210', '3213', 'LEGONKULON'),
('3213220', '3213', 'BLANAKAN'),
('3214010', '3214', 'JATILUHUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3214011', '3214', 'SUKASARI'),
('3214020', '3214', 'MANIIS'),
('3214030', '3214', 'TEGAL WARU'),
('3214040', '3214', 'PLERED'),
('3214050', '3214', 'SUKATANI'),
('3214060', '3214', 'DARANGDAN'),
('3214070', '3214', 'BOJONG'),
('3214080', '3214', 'WANAYASA'),
('3214081', '3214', 'KIARAPEDES'),
('3214090', '3214', 'PASAWAHAN'),
('3214091', '3214', 'PONDOK SALAM'),
('3214100', '3214', 'PURWAKARTA'),
('3214101', '3214', 'BABAKANCIKAO'),
('3214110', '3214', 'CAMPAKA'),
('3214111', '3214', 'CIBATU'),
('3214112', '3214', 'BUNGURSARI'),
('3215010', '3215', 'PANGKALAN'),
('3215011', '3215', 'TEGALWARU'),
('3215020', '3215', 'CIAMPEL'),
('3215031', '3215', 'TELUKJAMBE TIMUR'),
('3215032', '3215', 'TELUKJAMBE BARAT'),
('3215040', '3215', 'KLARI'),
('3215050', '3215', 'CIKAMPEK'),
('3215051', '3215', 'PURWASARI'),
('3215060', '3215', 'TIRTAMULYA'),
('3215070', '3215', 'JATISARI'),
('3215071', '3215', 'BANYUSARI'),
('3215072', '3215', 'KOTABARU'),
('3215081', '3215', 'CILAMAYA WETAN'),
('3215082', '3215', 'CILAMAYA KULON'),
('3215090', '3215', 'LEMAHABANG'),
('3215100', '3215', 'TALAGASARI'),
('3215111', '3215', 'MAJALAYA'),
('3215112', '3215', 'KARAWANG TIMUR'),
('3215113', '3215', 'KARAWANG BARAT'),
('3215120', '3215', 'RAWAMERTA'),
('3215130', '3215', 'TEMPURAN'),
('3215140', '3215', 'KUTAWALUYA'),
('3215150', '3215', 'RENGASDENGKLOK'),
('3215151', '3215', 'JAYAKERTA'),
('3215160', '3215', 'PEDES'),
('3215161', '3215', 'CILEBAR'),
('3215170', '3215', 'CIBUAYA'),
('3215180', '3215', 'TIRTAJAYA'),
('3215190', '3215', 'BATUJAYA'),
('3215200', '3215', 'PAKISJAYA'),
('3216010', '3216', 'SETU'),
('3216021', '3216', 'SERANG BARU'),
('3216022', '3216', 'CIKARANG PUSAT'),
('3216023', '3216', 'CIKARANG SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3216030', '3216', 'CIBARUSAH'),
('3216031', '3216', 'BOJONGMANGU'),
('3216041', '3216', 'CIKARANG TIMUR'),
('3216050', '3216', 'KEDUNGWARINGIN'),
('3216061', '3216', 'CIKARANG UTARA'),
('3216062', '3216', 'KARANGBAHAGIA'),
('3216070', '3216', 'CIBITUNG'),
('3216071', '3216', 'CIKARANG BARAT'),
('3216081', '3216', 'TAMBUN SELATAN'),
('3216082', '3216', 'TAMBUN UTARA'),
('3216090', '3216', 'BABELAN'),
('3216100', '3216', 'TARUMAJAYA'),
('3216110', '3216', 'TAMBELANG'),
('3216111', '3216', 'SUKAWANGI'),
('3216120', '3216', 'SUKATANI'),
('3216121', '3216', 'SUKAKARYA'),
('3216130', '3216', 'PEBAYURAN'),
('3216140', '3216', 'CABANGBUNGIN'),
('3216150', '3216', 'MU<NAME>'),
('3217010', '3217', 'RONGGA'),
('3217020', '3217', 'GUNUNGHALU'),
('3217030', '3217', 'SINDANGKERTA'),
('3217040', '3217', 'CILILIN'),
('3217050', '3217', 'CIHAMPELAS'),
('3217060', '3217', 'CIPONGKOR'),
('3217070', '3217', 'BATUJAJAR'),
('3217071', '3217', 'SAGULING'),
('3217080', '3217', 'CIPATAT'),
('3217090', '3217', 'PADALARANG'),
('3217100', '3217', 'NGAMPRAH'),
('3217110', '3217', 'PARONGPONG'),
('3217120', '3217', 'LEMBANG'),
('3217130', '3217', 'CISARUA'),
('3217140', '3217', 'CIKALONG WETAN'),
('3217150', '3217', 'CIPEUNDEUY'),
('3218010', '3218', 'CIMERAK'),
('3218020', '3218', 'CIJULANG'),
('3218030', '3218', 'CIGUGUR'),
('3218040', '3218', 'LANGKAPLANCAR'),
('3218050', '3218', 'PARIGI'),
('3218060', '3218', 'SIDAMULIH'),
('3218070', '3218', 'PANGANDARAN'),
('3218080', '3218', 'KALIPUCANG'),
('3218090', '3218', 'PADAHERANG'),
('3218100', '3218', 'MANGUNJAYA'),
('3271010', '3271', 'BOGOR SELATAN'),
('3271020', '3271', 'BOGOR TIMUR'),
('3271030', '3271', 'BOGOR UTARA'),
('3271040', '3271', 'BOGOR TENGAH'),
('3271050', '3271', 'BOGOR BARAT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3271060', '3271', 'TANAH SEREAL'),
('3272010', '3272', 'BAROS'),
('3272011', '3272', 'LEMBURSITU'),
('3272012', '3272', 'CIBEUREUM'),
('3272020', '3272', 'CITAMIANG'),
('3272030', '3272', 'WARUDOYONG'),
('3272040', '3272', 'GUNUNG PUYUH'),
('3272050', '3272', 'CIKOLE'),
('3273010', '3273', 'BANDUNG KULON'),
('3273020', '3273', 'BABAKAN CIPARAY'),
('3273030', '3273', 'BOJONGLOA KALER'),
('3273040', '3273', 'BOJONGLOA KIDUL'),
('3273050', '3273', 'ASTANAANYAR'),
('3273060', '3273', 'REGOL'),
('3273070', '3273', 'LENGKONG'),
('3273080', '3273', 'BANDUNG KIDUL'),
('3273090', '3273', 'BUAHBATU'),
('3273100', '3273', 'RANCASARI'),
('3273101', '3273', 'GEDEBAGE'),
('3273110', '3273', 'CIBIRU'),
('3273111', '3273', 'PANYILEUKAN'),
('3273120', '3273', 'UJUNG BERUNG'),
('3273121', '3273', 'CINAMBO'),
('3273130', '3273', 'ARCAMANIK'),
('3273141', '3273', 'ANTAPANI'),
('3273142', '3273', 'MANDALAJATI'),
('3273150', '3273', 'KIARACONDONG'),
('3273160', '3273', 'BATUNUNGGAL'),
('3273170', '3273', 'SUMUR BANDUNG'),
('3273180', '3273', 'ANDIR'),
('3273190', '3273', 'CICENDO'),
('3273200', '3273', 'BANDUNG WETAN'),
('3273210', '3273', 'CIBEUNYING KIDUL'),
('3273220', '3273', 'CIBEUNYING KALER'),
('3273230', '3273', 'COBLONG'),
('3273240', '3273', 'SUKAJADI'),
('3273250', '3273', 'SUKASARI'),
('3273260', '3273', 'CIDADAP'),
('3274010', '3274', 'HARJAMUKTI'),
('3274020', '3274', 'LEMAHWUNGKUK'),
('3274030', '3274', 'PEKALIPAN'),
('3274040', '3274', 'KESAMBI'),
('3274050', '3274', 'KEJAKSAN'),
('3275010', '3275', 'PONDOKGEDE'),
('3275011', '3275', 'JATISAMPURNA'),
('3275012', '3275', 'PONDOKMELATI'),
('3275020', '3275', 'JATIASIH'),
('3275030', '3275', 'BANTARGEBANG'),
('3275031', '3275', 'MUSTIKAJAYA'),
('3275040', '3275', 'BEKASI TIMUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3275041', '3275', 'RAWALUMBU'),
('3275050', '3275', 'BEKASI SELATAN'),
('3275060', '3275', 'BEKASI BARAT'),
('3275061', '3275', 'MEDAN SATRIA'),
('3275070', '3275', 'BEKASI UTARA'),
('3276010', '3276', 'SAWANGAN'),
('3276011', '3276', 'BOJONGSARI'),
('3276020', '3276', 'PANCORAN MAS'),
('3276021', '3276', 'CIPAYUNG'),
('3276030', '3276', 'SUKMA JAYA'),
('3276031', '3276', 'CILODONG'),
('3276040', '3276', 'CIMANGGIS'),
('3276041', '3276', 'TAPOS'),
('3276050', '3276', 'BEJI'),
('3276060', '3276', 'LIMO'),
('3276061', '3276', 'CINERE'),
('3277010', '3277', 'CIMAHI SELATAN'),
('3277020', '3277', 'CIMAHI TENGAH'),
('3277030', '3277', 'CIMAHI UTARA'),
('3278010', '3278', 'KAWALU'),
('3278020', '3278', 'TAMANSARI'),
('3278030', '3278', 'CIBEUREUM'),
('3278031', '3278', 'PURBARATU'),
('3278040', '3278', 'TAWANG'),
('3278050', '3278', 'CIHIDEUNG'),
('3278060', '3278', 'MANGKUBUMI'),
('3278070', '3278', 'INDIHIANG'),
('3278071', '3278', 'BUNGURSARI'),
('3278080', '3278', 'CIPEDES'),
('3279010', '3279', 'BANJAR'),
('3279020', '3279', 'PURWAHARJA'),
('3279030', '3279', 'PATARUMAN'),
('3279040', '3279', 'LANGENSARI'),
('3301010', '3301', 'DAYEUHLUHUR'),
('3301020', '3301', 'WANAREJA'),
('3301030', '3301', 'MAJENANG'),
('3301040', '3301', 'CIMANGGU'),
('3301050', '3301', 'KARANGPUCUNG'),
('3301060', '3301', 'CIPARI'),
('3301070', '3301', 'SIDAREJA'),
('3301080', '3301', 'KEDUNGREJA'),
('3301090', '3301', 'PATIMUAN'),
('3301100', '3301', 'GANDRUNGMANGU'),
('3301110', '3301', 'BANTARSARI'),
('3301120', '3301', 'KAWUNGANTEN'),
('3301121', '3301', 'KAMPUNG LAUT'),
('3301130', '3301', 'JERUKLEGI'),
('3301140', '3301', 'KESUGIHAN'),
('3301150', '3301', 'ADIPALA'),
('3301160', '3301', 'MAOS');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3301170', '3301', 'SAMPANG'),
('3301180', '3301', 'KROYA'),
('3301190', '3301', 'BINANGUN'),
('3301200', '3301', 'NUSAWUNGU'),
('3301710', '3301', 'CILACAP SELATAN'),
('3301720', '3301', 'CILACAP TENGAH'),
('3301730', '3301', 'CILACAP UTARA'),
('3302010', '3302', 'LUMBIR'),
('3302020', '3302', 'WANGON'),
('3302030', '3302', 'JATILAWANG'),
('3302040', '3302', 'RAWALO'),
('3302050', '3302', 'KEBASEN'),
('3302060', '3302', 'KEMRANJEN'),
('3302070', '3302', 'SUMPIUH'),
('3302080', '3302', 'TAMBAK'),
('3302090', '3302', 'SOMAGEDE'),
('3302100', '3302', 'KALIBAGOR'),
('3302110', '3302', 'BANYUMAS'),
('3302120', '3302', 'PATIKRAJA'),
('3302130', '3302', 'PURWOJATI'),
('3302140', '3302', 'AJIBARANG'),
('3302150', '3302', 'GUMELAR'),
('3302160', '3302', 'PEKUNCEN'),
('3302170', '3302', 'CILONGOK'),
('3302180', '3302', 'KARANGLEWAS'),
('3302190', '3302', 'KEDUNG BANTENG'),
('3302200', '3302', 'BATURRADEN'),
('3302210', '3302', 'SUMBANG'),
('3302220', '3302', 'KEMBARAN'),
('3302230', '3302', 'SOKARAJA'),
('3302710', '3302', 'PURWOKERTO SELATAN'),
('3302720', '3302', 'PURWOKERTO BARAT'),
('3302730', '3302', 'PURWOKERTO TIMUR'),
('3302740', '3302', 'PURWOKERTO UTARA'),
('3303010', '3303', 'KEMANGKON'),
('3303020', '3303', 'BUKATEJA'),
('3303030', '3303', 'KEJOBONG'),
('3303040', '3303', 'PENGADEGAN'),
('3303050', '3303', 'KALIGONDANG'),
('3303060', '3303', 'PURBALINGGA'),
('3303070', '3303', 'KALIMANAH'),
('3303080', '3303', 'PADAMARA'),
('3303090', '3303', 'KUTASARI'),
('3303100', '3303', 'BOJONGSARI'),
('3303110', '3303', 'MREBET'),
('3303120', '3303', 'BOBOTSARI'),
('3303130', '3303', 'KARANGREJA'),
('3303131', '3303', 'KARANGJAMBU'),
('3303140', '3303', 'KARANGANYAR'),
('3303141', '3303', 'KERTANEGARA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3303150', '3303', 'KARANGMONCOL'),
('3303160', '3303', 'REMBANG'),
('3304010', '3304', 'SUSUKAN'),
('3304020', '3304', 'PURWAREJA KLAMPOK'),
('3304030', '3304', 'MANDIRAJA'),
('3304040', '3304', 'PURWANEGARA'),
('3304050', '3304', 'BAWANG'),
('3304060', '3304', 'BANJARNEGARA'),
('3304061', '3304', 'PAGEDONGAN'),
('3304070', '3304', 'SIGALUH'),
('3304080', '3304', 'MADUKARA'),
('3304090', '3304', 'BANJARMANGU'),
('3304100', '3304', 'WANADADI'),
('3304110', '3304', 'RAKIT'),
('3304120', '3304', 'PUNGGELAN'),
('3304130', '3304', 'KARANGKOBAR'),
('3304140', '3304', 'PAGENTAN'),
('3304150', '3304', 'PEJAWARAN'),
('3304160', '3304', 'BATUR'),
('3304170', '3304', 'WANAYASA'),
('3304180', '3304', 'KALIBENING'),
('3304181', '3304', 'PANDANARUM'),
('3305010', '3305', 'AYAH'),
('3305020', '3305', 'BUAYAN'),
('3305030', '3305', 'PURING'),
('3305040', '3305', 'PETANAHAN'),
('3305050', '3305', 'KLIRONG'),
('3305060', '3305', 'BULUSPESANTREN'),
('3305070', '3305', 'AMBAL'),
('3305080', '3305', 'MIRIT'),
('3305081', '3305', 'BONOROWO'),
('3305090', '3305', 'PREMBUN'),
('3305091', '3305', 'PADURESO'),
('3305100', '3305', 'KUTOWINANGUN'),
('3305110', '3305', 'ALIAN'),
('3305111', '3305', 'PONCOWARNO'),
('3305120', '3305', 'KEBUMEN'),
('3305130', '3305', 'PEJAGOAN'),
('3305140', '3305', 'SRUWENG'),
('3305150', '3305', 'ADIMULYO'),
('3305160', '3305', 'KUWARASAN'),
('3305170', '3305', 'ROWOKELE'),
('3305180', '3305', 'SEMPOR'),
('3305190', '3305', 'GOMBONG'),
('3305200', '3305', 'KARANGANYAR'),
('3305210', '3305', 'KARANGGAYAM'),
('3305220', '3305', 'SADANG'),
('3305221', '3305', 'KARANGSAMBUNG'),
('3306010', '3306', 'GRABAG'),
('3306020', '3306', 'NGOMBOL');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3306030', '3306', 'PURWODADI'),
('3306040', '3306', 'BAGELEN'),
('3306050', '3306', 'KALIGESING'),
('3306060', '3306', 'PURWOREJO'),
('3306070', '3306', 'BANYU URIP'),
('3306080', '3306', 'BAYAN'),
('3306090', '3306', 'KUTOARJO'),
('3306100', '3306', 'BUTUH'),
('3306110', '3306', 'PITURUH'),
('3306120', '3306', 'KEMIRI'),
('3306130', '3306', 'BRUNO'),
('3306140', '3306', 'GEBANG'),
('3306150', '3306', 'LOANO'),
('3306160', '3306', 'BENER'),
('3307010', '3307', 'WADASLINTANG'),
('3307020', '3307', 'KEPIL'),
('3307030', '3307', 'SAPURAN'),
('3307031', '3307', 'KALIBAWANG'),
('3307040', '3307', 'KALIWIRO'),
('3307050', '3307', 'LEKSONO'),
('3307051', '3307', 'SUKOHARJO'),
('3307060', '3307', 'SELOMERTO'),
('3307070', '3307', 'KALIKAJAR'),
('3307080', '3307', 'KERTEK'),
('3307090', '3307', 'WONOSOBO'),
('3307100', '3307', 'WATUMALANG'),
('3307110', '3307', 'MOJOTENGAH'),
('3307120', '3307', 'GARUNG'),
('3307130', '3307', 'KEJAJAR'),
('3308010', '3308', 'SALAMAN'),
('3308020', '3308', 'BOROBUDUR'),
('3308030', '3308', 'NGLUWAR'),
('3308040', '3308', 'SALAM'),
('3308050', '3308', 'SRUMBUNG'),
('3308060', '3308', 'DUKUN'),
('3308070', '3308', 'MUNTILAN'),
('3308080', '3308', 'MUNGKID'),
('3308090', '3308', 'SAWANGAN'),
('3308100', '3308', 'CANDIMULYO'),
('3308110', '3308', 'MERTOYUDAN'),
('3308120', '3308', 'TEMPURAN'),
('3308130', '3308', 'KAJORAN'),
('3308140', '3308', 'KALIANGKRIK'),
('3308150', '3308', 'BANDONGAN'),
('3308160', '3308', 'WINDUSARI'),
('3308170', '3308', 'SECANG'),
('3308180', '3308', 'TEGALREJO'),
('3308190', '3308', 'PAKIS'),
('3308200', '3308', 'GRABAG'),
('3308210', '3308', 'NGABLAK');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3309010', '3309', 'SELO'),
('3309020', '3309', 'AMPEL'),
('3309030', '3309', 'CEPOGO'),
('3309040', '3309', 'MUSUK'),
('3309050', '3309', 'BOYOLALI'),
('3309060', '3309', 'MOJOSONGO'),
('3309070', '3309', 'TERAS'),
('3309080', '3309', 'SAWIT'),
('3309090', '3309', 'BANYUDONO'),
('3309100', '3309', 'SAMBI'),
('3309110', '3309', 'NGEMPLAK'),
('3309120', '3309', 'NOGOSARI'),
('3309130', '3309', 'SIMO'),
('3309140', '3309', 'KARANGGEDE'),
('3309150', '3309', 'KLEGO'),
('3309160', '3309', 'ANDONG'),
('3309170', '3309', 'KEMUSU'),
('3309180', '3309', 'WONOSEGORO'),
('3309190', '3309', 'JUWANGI'),
('3310010', '3310', 'PRAMBANAN'),
('3310020', '3310', 'GANTIWARNO'),
('3310030', '3310', 'WEDI'),
('3310040', '3310', 'BAYAT'),
('3310050', '3310', 'CAWAS'),
('3310060', '3310', 'TRUCUK'),
('3310070', '3310', 'KALIKOTES'),
('3310080', '3310', 'KEBONARUM'),
('3310090', '3310', 'JOGONALAN'),
('3310100', '3310', 'MANISRENGGO'),
('3310110', '3310', 'KARANGNONGKO'),
('3310120', '3310', 'NGAWEN'),
('3310130', '3310', 'CEPER'),
('3310140', '3310', 'PEDAN'),
('3310150', '3310', 'KARANGDOWO'),
('3310160', '3310', 'JUWIRING'),
('3310170', '3310', 'WONOSARI'),
('3310180', '3310', 'DELANGGU'),
('3310190', '3310', 'POLANHARJO'),
('3310200', '3310', 'KARANGANOM'),
('3310210', '3310', 'TULUNG'),
('3310220', '3310', 'JATINOM'),
('3310230', '3310', 'KEMALANG'),
('3310710', '3310', 'KLATEN SELATAN'),
('3310720', '3310', 'KLATEN TENGAH'),
('3310730', '3310', 'KLATEN UTARA'),
('3311010', '3311', 'WERU'),
('3311020', '3311', 'BULU'),
('3311030', '3311', 'TAWANGSARI'),
('3311040', '3311', 'SUKOHARJO'),
('3311050', '3311', 'NGUTER');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3311060', '3311', 'BENDOSARI'),
('3311070', '3311', 'POLOKARTO'),
('3311080', '3311', 'MOJOLABAN'),
('3311090', '3311', 'GROGOL'),
('3311100', '3311', 'BAKI'),
('3311110', '3311', 'GATAK'),
('3311120', '3311', 'KARTASURA'),
('3312010', '3312', 'PRACIMANTORO'),
('3312020', '3312', 'PARANGGUPITO'),
('3312030', '3312', 'GIRITONTRO'),
('3312040', '3312', 'GIRIWOYO'),
('3312050', '3312', 'BATUWARNO'),
('3312060', '3312', 'KARANGTENGAH'),
('3312070', '3312', 'TIRTOMOYO'),
('3312080', '3312', 'NGUNTORONADI'),
('3312090', '3312', 'BATURETNO'),
('3312100', '3312', 'EROMOKO'),
('3312110', '3312', 'WURYANTORO'),
('3312120', '3312', 'MANYARAN'),
('3312130', '3312', 'SELOGIRI'),
('3312140', '3312', 'WONOGIRI'),
('3312150', '3312', 'NGADIROJO'),
('3312160', '3312', 'SIDOHARJO'),
('3312170', '3312', 'JATIROTO'),
('3312180', '3312', 'KISMANTORO'),
('3312190', '3312', 'PURWANTORO'),
('3312200', '3312', 'BULUKERTO'),
('3312201', '3312', 'PUHPELEM'),
('3312210', '3312', 'SLOGOHIMO'),
('3312220', '3312', 'JATISRONO'),
('3312230', '3312', 'JATIPURNO'),
('3312240', '3312', 'GIRIMARTO'),
('3313010', '3313', 'JATIPURO'),
('3313020', '3313', 'JATIYOSO'),
('3313030', '3313', 'JUMAPOLO'),
('3313040', '3313', 'JUMANTONO'),
('3313050', '3313', 'MATESIH'),
('3313060', '3313', 'TAWANGMANGU'),
('3313070', '3313', 'NGARGOYOSO'),
('3313080', '3313', 'KARANGPANDAN'),
('3313090', '3313', 'KARANGANYAR'),
('3313100', '3313', 'TASIKMADU'),
('3313110', '3313', 'JATEN'),
('3313120', '3313', 'COLOMADU'),
('3313130', '3313', 'GONDANGREJO'),
('3313140', '3313', 'KEBAKKRAMAT'),
('3313150', '3313', 'MOJOGEDANG'),
('3313160', '3313', 'KERJO'),
('3313170', '3313', 'JENAWI'),
('3314010', '3314', 'KALIJAMBE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3314020', '3314', 'PLUPUH'),
('3314030', '3314', 'MASARAN'),
('3314040', '3314', 'KEDAWUNG'),
('3314050', '3314', 'SAMBIREJO'),
('3314060', '3314', 'GONDANG'),
('3314070', '3314', '<NAME>'),
('3314080', '3314', 'NGRAMPAL'),
('3314090', '3314', 'KARANGMALANG'),
('3314100', '3314', 'SRAGEN'),
('3314110', '3314', 'SIDOHARJO'),
('3314120', '3314', 'TANON'),
('3314130', '3314', 'GEMOLONG'),
('3314140', '3314', 'MIRI'),
('3314150', '3314', 'SUMBERLAWANG'),
('3314160', '3314', 'MONDOKAN'),
('3314170', '3314', 'SUKODONO'),
('3314180', '3314', 'GESI'),
('3314190', '3314', 'TANGEN'),
('3314200', '3314', 'JENAR'),
('3315010', '3315', 'KEDUNGJATI'),
('3315020', '3315', 'KARANGRAYUNG'),
('3315030', '3315', 'PENAWANGAN'),
('3315040', '3315', 'TOROH'),
('3315050', '3315', 'GEYER'),
('3315060', '3315', 'PULOKULON'),
('3315070', '3315', 'KRADENAN'),
('3315080', '3315', 'GABUS'),
('3315090', '3315', 'NGARINGAN'),
('3315100', '3315', 'WIROSARI'),
('3315110', '3315', 'TAWANGHARJO'),
('3315120', '3315', 'GROBOGAN'),
('3315130', '3315', 'PURWODADI'),
('3315140', '3315', 'BRATI'),
('3315150', '3315', 'KLAMBU'),
('3315160', '3315', 'GODONG'),
('3315170', '3315', 'GUBUG'),
('3315180', '3315', 'TEGOWANU'),
('3315190', '3315', 'TANGGUNGHARJO'),
('3316010', '3316', 'JATI'),
('3316020', '3316', 'RANDUBLATUNG'),
('3316030', '3316', 'KRADENAN'),
('3316040', '3316', 'KEDUNGTUBAN'),
('3316050', '3316', 'CEPU'),
('3316060', '3316', 'SAMBONG'),
('3316070', '3316', 'JIKEN'),
('3316080', '3316', 'BOGOREJO'),
('3316090', '3316', 'JEPON'),
('3316100', '3316', 'KOTA BLORA'),
('3316110', '3316', 'BANJAREJO'),
('3316120', '3316', 'TUNJUNGAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3316130', '3316', 'JAPAH'),
('3316140', '3316', 'NGAWEN'),
('3316150', '3316', 'KUNDURAN'),
('3316160', '3316', 'TODANAN'),
('3317010', '3317', 'SUMBER'),
('3317020', '3317', 'BULU'),
('3317030', '3317', 'GUNEM'),
('3317040', '3317', 'SALE'),
('3317050', '3317', 'SARANG'),
('3317060', '3317', 'SEDAN'),
('3317070', '3317', 'PAMOTAN'),
('3317080', '3317', 'SULANG'),
('3317090', '3317', 'KALIORI'),
('3317100', '3317', 'REMBANG'),
('3317110', '3317', 'PANCUR'),
('3317120', '3317', 'KRAGAN'),
('3317130', '3317', 'SLUKE'),
('3317140', '3317', 'LASEM'),
('3318010', '3318', 'SUKOLILO'),
('3318020', '3318', 'KAYEN'),
('3318030', '3318', 'TAMBAKROMO'),
('3318040', '3318', 'WINONG'),
('3318050', '3318', 'PUCAKWANGI'),
('3318060', '3318', 'JAKEN'),
('3318070', '3318', 'BATANGAN'),
('3318080', '3318', 'JUWANA'),
('3318090', '3318', 'JAKENAN'),
('3318100', '3318', 'PATI'),
('3318110', '3318', 'GABUS'),
('3318120', '3318', 'MARGOREJO'),
('3318130', '3318', 'GEMBONG'),
('3318140', '3318', 'TLOGOWUNGU'),
('3318150', '3318', 'WEDARIJAKSA'),
('3318160', '3318', 'TRANGKIL'),
('3318170', '3318', 'MARGOYOSO'),
('3318180', '3318', 'GUNUNG WUNGKAL'),
('3318190', '3318', 'CLUWAK'),
('3318200', '3318', 'TAYU'),
('3318210', '3318', 'DUKUHSETI'),
('3319010', '3319', 'KALIWUNGU'),
('3319020', '3319', 'KOTA KUDUS'),
('3319030', '3319', 'JATI'),
('3319040', '3319', 'UNDAAN'),
('3319050', '3319', 'MEJOBO'),
('3319060', '3319', 'JEKULO'),
('3319070', '3319', 'BAE'),
('3319080', '3319', 'GEBOG'),
('3319090', '3319', 'DAWE'),
('3320010', '3320', 'KEDUNG'),
('3320020', '3320', 'PECANGAAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3320021', '3320', 'KALINYAMATAN'),
('3320030', '3320', 'WELAHAN'),
('3320040', '3320', 'MAYONG'),
('3320050', '3320', 'NALUMSARI'),
('3320060', '3320', 'BATEALIT'),
('3320070', '3320', 'TAHUNAN'),
('3320080', '3320', 'JEPARA'),
('3320090', '3320', 'MLONGGO'),
('3320091', '3320', 'PAKIS AJI'),
('3320100', '3320', 'BANGSRI'),
('3320101', '3320', 'KEMBANG'),
('3320110', '3320', 'KELING'),
('3320111', '3320', 'DONOROJO'),
('3320120', '3320', 'KARIMUNJAWA'),
('3321010', '3321', 'MRANGGEN'),
('3321020', '3321', 'KARANGAWEN'),
('3321030', '3321', 'GUNTUR'),
('3321040', '3321', 'SAYUNG'),
('3321050', '3321', 'KARANG TENGAH'),
('3321060', '3321', 'BONANG'),
('3321070', '3321', 'DEMAK'),
('3321080', '3321', 'WONOSALAM'),
('3321090', '3321', 'DEMPET'),
('3321091', '3321', 'KEBONAGUNG'),
('3321100', '3321', 'GAJAH'),
('3321110', '3321', 'KARANGANYAR'),
('3321120', '3321', 'MIJEN'),
('3321130', '3321', 'WEDUNG'),
('3322010', '3322', 'GETASAN'),
('3322020', '3322', 'TENGARAN'),
('3322030', '3322', 'SUSUKAN'),
('3322031', '3322', 'KALIWUNGU'),
('3322040', '3322', 'SURUH'),
('3322050', '3322', 'PABELAN'),
('3322060', '3322', 'TUNTANG'),
('3322070', '3322', 'BANYUBIRU'),
('3322080', '3322', 'JAMBU'),
('3322090', '3322', 'SUMOWONO'),
('3322100', '3322', 'AMBARAWA'),
('3322101', '3322', 'BANDUNGAN'),
('3322110', '3322', 'BAWEN'),
('3322120', '3322', 'BRINGIN'),
('3322121', '3322', 'BANCAK'),
('3322130', '3322', 'PRINGAPUS'),
('3322140', '3322', 'BERGAS'),
('3322151', '3322', 'UNGARAN BARAT'),
('3322152', '3322', 'UNGARAN TIMUR'),
('3323010', '3323', 'PARAKAN'),
('3323011', '3323', 'KLEDUNG'),
('3323012', '3323', 'BANSARI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3323020', '3323', 'BULU'),
('3323030', '3323', 'TEMANGGUNG'),
('3323031', '3323', 'TLOGOMULYO'),
('3323040', '3323', 'TEMBARAK'),
('3323041', '3323', 'SELOPAMPANG'),
('3323050', '3323', 'KRANGGAN'),
('3323060', '3323', 'PRINGSURAT'),
('3323070', '3323', 'KALORAN'),
('3323080', '3323', 'KANDANGAN'),
('3323090', '3323', 'KEDU'),
('3323100', '3323', 'NGADIREJO'),
('3323110', '3323', 'JUMO'),
('3323111', '3323', 'GEMAWANG'),
('3323120', '3323', 'CANDIROTO'),
('3323121', '3323', 'BEJEN'),
('3323130', '3323', 'TRETEP'),
('3323131', '3323', 'WONOBOYO'),
('3324010', '3324', 'PLANTUNGAN'),
('3324020', '3324', 'SUKOREJO'),
('3324030', '3324', 'PAGERRUYUNG'),
('3324040', '3324', 'PATEAN'),
('3324050', '3324', 'SINGOROJO'),
('3324060', '3324', 'LIMBANGAN'),
('3324070', '3324', 'BOJA'),
('3324080', '3324', 'KALIWUNGU'),
('3324081', '3324', 'KALIWUNGU SELATAN'),
('3324090', '3324', 'BRANGSONG'),
('3324100', '3324', 'PEGANDON'),
('3324101', '3324', 'NGAMPEL'),
('3324110', '3324', 'GEMUH'),
('3324111', '3324', 'RINGINARUM'),
('3324120', '3324', 'WELERI'),
('3324130', '3324', 'ROWOSARI'),
('3324140', '3324', 'KANGKUNG'),
('3324150', '3324', 'CEPIRING'),
('3324160', '3324', 'PATEBON'),
('3324170', '3324', 'KOTA KENDAL'),
('3325010', '3325', 'WONOTUNGGAL'),
('3325020', '3325', 'BANDAR'),
('3325030', '3325', 'BLADO'),
('3325040', '3325', 'REBAN'),
('3325050', '3325', 'BAWANG'),
('3325060', '3325', 'TERSONO'),
('3325070', '3325', 'GRINGSING'),
('3325080', '3325', 'LIMPUNG'),
('3325081', '3325', 'BANYUPUTIH'),
('3325090', '3325', 'SUBAH'),
('3325091', '3325', 'PECALUNGAN'),
('3325100', '3325', 'TULIS'),
('3325101', '3325', 'KANDEMAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3325110', '3325', 'BATANG'),
('3325120', '3325', 'WARUNG ASEM'),
('3326010', '3326', 'KANDANGSERANG'),
('3326020', '3326', 'PANINGGARAN'),
('3326030', '3326', 'LEBAKBARANG'),
('3326040', '3326', 'PETUNGKRIONO'),
('3326050', '3326', 'TALUN'),
('3326060', '3326', 'DORO'),
('3326070', '3326', 'KARANGANYAR'),
('3326080', '3326', 'KAJEN'),
('3326090', '3326', 'KESESI'),
('3326100', '3326', 'SRAGI'),
('3326101', '3326', 'SIWALAN'),
('3326110', '3326', 'BOJONG'),
('3326120', '3326', 'WONOPRINGGO'),
('3326130', '3326', 'KEDUNGWUNI'),
('3326131', '3326', 'KARANGDADAP'),
('3326140', '3326', 'BUARAN'),
('3326150', '3326', 'TIRTO'),
('3326160', '3326', 'WIRADESA'),
('3326161', '3326', 'WONOKERTO'),
('3327010', '3327', 'MOGA'),
('3327011', '3327', 'WARUNGPRING'),
('3327020', '3327', 'PULOSARI'),
('3327030', '3327', 'BELIK'),
('3327040', '3327', 'WATUKUMPUL'),
('3327050', '3327', 'BODEH'),
('3327060', '3327', 'BANTARBOLANG'),
('3327070', '3327', 'RANDUDONGKAL'),
('3327080', '3327', 'PEMALANG'),
('3327090', '3327', 'TAMAN'),
('3327100', '3327', 'PETARUKAN'),
('3327110', '3327', 'AMPELGADING'),
('3327120', '3327', 'COMAL'),
('3327130', '3327', 'ULUJAMI'),
('3328010', '3328', 'MARGASARI'),
('3328020', '3328', 'BUMIJAWA'),
('3328030', '3328', 'BOJONG'),
('3328040', '3328', 'BALAPULANG'),
('3328050', '3328', 'PAGERBARANG'),
('3328060', '3328', 'LEBAKSIU'),
('3328070', '3328', 'JATINEGARA'),
('3328080', '3328', 'KEDUNG BANTENG'),
('3328090', '3328', 'PANGKAH'),
('3328100', '3328', 'SLAWI'),
('3328110', '3328', 'DUKUHWARU'),
('3328120', '3328', 'ADIWERNA'),
('3328130', '3328', 'DUKUHTURI'),
('3328140', '3328', 'TALANG'),
('3328150', '3328', 'TARUB');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3328160', '3328', 'KRAMAT'),
('3328170', '3328', 'SURADADI'),
('3328180', '3328', 'WARUREJA'),
('3329010', '3329', 'SALEM'),
('3329020', '3329', 'BANTARKAWUNG'),
('3329030', '3329', 'BUMIAYU'),
('3329040', '3329', 'PAGUYANGAN'),
('3329050', '3329', 'SIRAMPOG'),
('3329060', '3329', 'TONJONG'),
('3329070', '3329', 'LARANGAN'),
('3329080', '3329', 'KETANGGUNGAN'),
('3329090', '3329', 'BANJARHARJO'),
('3329100', '3329', 'LOSARI'),
('3329110', '3329', 'TANJUNG'),
('3329120', '3329', 'KERSANA'),
('3329130', '3329', 'BULAKAMBA'),
('3329140', '3329', 'WANASARI'),
('3329150', '3329', 'SONGGOM'),
('3329160', '3329', 'JATIBARANG'),
('3329170', '3329', 'BREBES'),
('3371010', '3371', 'MAGELANG SELATAN'),
('3371011', '3371', 'MAGELANG TENGAH'),
('3371020', '3371', 'MAGELANG UTARA'),
('3372010', '3372', 'LAWEYAN'),
('3372020', '3372', 'SERENGAN'),
('3372030', '3372', 'PASAR KLIWON'),
('3372040', '3372', 'JEBRES'),
('3372050', '3372', 'BANJARSARI'),
('3373010', '3373', 'ARGOMULYO'),
('3373020', '3373', 'TINGKIR'),
('3373030', '3373', 'SIDOMUKTI'),
('3373040', '3373', 'SIDOREJO'),
('3374010', '3374', 'MIJEN'),
('3374020', '3374', 'GUNUNG PATI'),
('3374030', '3374', 'BANYUMANIK'),
('3374040', '3374', 'GAJAH MUNGKUR'),
('3374050', '3374', 'SEMARANG SELATAN'),
('3374060', '3374', 'CANDISARI'),
('3374070', '3374', 'TEMBALANG'),
('3374080', '3374', 'PEDURUNGAN'),
('3374090', '3374', 'GENUK'),
('3374100', '3374', 'GAYAMSARI'),
('3374110', '3374', 'SEMARANG TIMUR'),
('3374120', '3374', 'SEMARANG UTARA'),
('3374130', '3374', 'SEMARANG TENGAH'),
('3374140', '3374', 'SEMARANG BARAT'),
('3374150', '3374', 'TUGU'),
('3374160', '3374', 'NGALIYAN'),
('3375010', '3375', 'PEKALONGAN BARAT'),
('3375020', '3375', 'PEKALONGAN TIMUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3375030', '3375', 'PEKALONGAN SELATAN'),
('3375040', '3375', 'PEKALONGAN UTARA'),
('3376010', '3376', 'TEGAL SELATAN'),
('3376020', '3376', 'TEGAL TIMUR'),
('3376030', '3376', 'TEGAL BARAT'),
('3376040', '3376', 'MARGADANA'),
('3401010', '3401', 'TEMON'),
('3401020', '3401', 'WATES'),
('3401030', '3401', 'PANJATAN'),
('3401040', '3401', 'GALUR'),
('3401050', '3401', 'LENDAH'),
('3401060', '3401', 'SENTOLO'),
('3401070', '3401', 'PENGASIH'),
('3401080', '3401', 'KOKAP'),
('3401090', '3401', 'GIRIMULYO'),
('3401100', '3401', 'NANGGULAN'),
('3401110', '3401', 'KALIBAWANG'),
('3401120', '3401', 'SAMIGALUH'),
('3402010', '3402', 'SRANDAKAN'),
('3402020', '3402', 'SANDEN'),
('3402030', '3402', 'KRETEK'),
('3402040', '3402', 'PUNDONG'),
('3402050', '3402', 'BAMBANG LIPURO'),
('3402060', '3402', 'PANDAK'),
('3402070', '3402', 'BANTUL'),
('3402080', '3402', 'JETIS'),
('3402090', '3402', 'IMOGIRI'),
('3402100', '3402', 'DLINGO'),
('3402110', '3402', 'PLERET'),
('3402120', '3402', 'PIYUNGAN'),
('3402130', '3402', 'BANGUNTAPAN'),
('3402140', '3402', 'SEWON'),
('3402150', '3402', 'KASIHAN'),
('3402160', '3402', 'PAJANGAN'),
('3402170', '3402', 'SEDAYU'),
('3403010', '3403', 'PANGGANG'),
('3403011', '3403', 'PURWOSARI'),
('3403020', '3403', 'PALIYAN'),
('3403030', '3403', 'SAPTO SARI'),
('3403040', '3403', 'TEPUS'),
('3403041', '3403', 'TANJUNGSARI'),
('3403050', '3403', 'RONGKOP'),
('3403051', '3403', 'GIRISUBO'),
('3403060', '3403', 'SEMANU'),
('3403070', '3403', 'PONJONG'),
('3403080', '3403', 'KARANGMOJO'),
('3403090', '3403', 'WONOSARI'),
('3403100', '3403', 'PLAYEN'),
('3403110', '3403', 'PATUK'),
('3403120', '3403', '<NAME>');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3403130', '3403', 'NGLIPAR'),
('3403140', '3403', 'NGAWEN'),
('3403150', '3403', 'SEMIN'),
('3404010', '3404', 'MOYUDAN'),
('3404020', '3404', 'MINGGIR'),
('3404030', '3404', 'SEYEGAN'),
('3404040', '3404', 'GODEAN'),
('3404050', '3404', 'GAMPING'),
('3404060', '3404', 'MLATI'),
('3404070', '3404', 'DEPOK'),
('3404080', '3404', 'BERBAH'),
('3404090', '3404', 'PRAMBANAN'),
('3404100', '3404', 'KALASAN'),
('3404110', '3404', 'NGEMPLAK'),
('3404120', '3404', 'NGAGLIK'),
('3404130', '3404', 'SLEMAN'),
('3404140', '3404', 'TEMPEL'),
('3404150', '3404', 'TURI'),
('3404160', '3404', 'PAKEM'),
('3404170', '3404', 'CANGKRINGAN'),
('3471010', '3471', 'MANTRIJERON'),
('3471020', '3471', 'KRATON'),
('3471030', '3471', 'MERGANGSAN'),
('3471040', '3471', 'UMBULHARJO'),
('3471050', '3471', 'KOTAGEDE'),
('3471060', '3471', 'GONDOKUSUMAN'),
('3471070', '3471', 'DANUREJAN'),
('3471080', '3471', 'PAKUALAMAN'),
('3471090', '3471', 'GONDOMANAN'),
('3471100', '3471', 'NGAMPILAN'),
('3471110', '3471', 'WIROBRAJAN'),
('3471120', '3471', '<NAME>'),
('3471130', '3471', 'JETIS'),
('3471140', '3471', 'TEGALREJO'),
('3501010', '3501', 'DONOROJO'),
('3501020', '3501', 'PUNUNG'),
('3501030', '3501', 'PRINGKUKU'),
('3501040', '3501', 'PACITAN'),
('3501050', '3501', 'KEBONAGUNG'),
('3501060', '3501', 'ARJOSARI'),
('3501070', '3501', 'NAWANGAN'),
('3501080', '3501', 'BANDAR'),
('3501090', '3501', 'TEGALOMBO'),
('3501100', '3501', 'TULAKAN'),
('3501110', '3501', 'NGADIROJO'),
('3501120', '3501', 'SUDIMORO'),
('3502010', '3502', 'NGRAYUN'),
('3502020', '3502', 'SLAHUNG'),
('3502030', '3502', 'BUNGKAL'),
('3502040', '3502', 'SAMBIT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3502050', '3502', 'SAWOO'),
('3502060', '3502', 'SOOKO'),
('3502061', '3502', 'PUDAK'),
('3502070', '3502', 'PULUNG'),
('3502080', '3502', 'MLARAK'),
('3502090', '3502', 'SIMAN'),
('3502100', '3502', 'JETIS'),
('3502110', '3502', 'BALONG'),
('3502120', '3502', 'KAUMAN'),
('3502130', '3502', 'JAMBON'),
('3502140', '3502', 'BADEGAN'),
('3502150', '3502', 'SAMPUNG'),
('3502160', '3502', 'SUKOREJO'),
('3502170', '3502', 'PONOROGO'),
('3502180', '3502', 'BABADAN'),
('3502190', '3502', 'JENANGAN'),
('3502200', '3502', 'NGEBEL'),
('3503010', '3503', 'PANGGUL'),
('3503020', '3503', 'MUNJUNGAN'),
('3503030', '3503', 'WATULIMO'),
('3503040', '3503', 'KAMPAK'),
('3503050', '3503', 'DONGKO'),
('3503060', '3503', 'PULE'),
('3503070', '3503', 'KARANGAN'),
('3503071', '3503', 'SURUH'),
('3503080', '3503', 'GANDUSARI'),
('3503090', '3503', 'DURENAN'),
('3503100', '3503', 'POGALAN'),
('3503110', '3503', 'TRENGGALEK'),
('3503120', '3503', 'TUGU'),
('3503130', '3503', 'BENDUNGAN'),
('3504010', '3504', 'BESUKI'),
('3504020', '3504', 'BANDUNG'),
('3504030', '3504', 'PAKEL'),
('3504040', '3504', 'CAMPUR DARAT'),
('3504050', '3504', 'TANGGUNG GUNUNG'),
('3504060', '3504', 'KALIDAWIR'),
('3504070', '3504', 'PUCANG LABAN'),
('3504080', '3504', 'REJOTANGAN'),
('3504090', '3504', 'NGUNUT'),
('3504100', '3504', 'SUMBERGEMPOL'),
('3504110', '3504', 'BOYOLANGU'),
('3504120', '3504', 'TULUNGAGUNG'),
('3504130', '3504', 'KEDUNGWARU'),
('3504140', '3504', 'NGANTRU'),
('3504150', '3504', 'KARANGREJO'),
('3504160', '3504', 'KAUMAN'),
('3504170', '3504', 'GONDANG'),
('3504180', '3504', 'PAGER WOJO'),
('3504190', '3504', 'SENDANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3505010', '3505', 'BAKUNG'),
('3505020', '3505', 'WONOTIRTO'),
('3505030', '3505', 'PANGGUNGREJO'),
('3505040', '3505', 'WATES'),
('3505050', '3505', 'BINANGUN'),
('3505060', '3505', 'SUTOJAYAN'),
('3505070', '3505', 'KADEMANGAN'),
('3505080', '3505', 'KANIGORO'),
('3505090', '3505', 'TALUN'),
('3505100', '3505', 'SELOPURO'),
('3505110', '3505', 'KESAMBEN'),
('3505120', '3505', 'SELOREJO'),
('3505130', '3505', 'DOKO'),
('3505140', '3505', 'WLINGI'),
('3505150', '3505', 'GANDUSARI'),
('3505160', '3505', 'GARUM'),
('3505170', '3505', 'NGLEGOK'),
('3505180', '3505', 'SANANKULON'),
('3505190', '3505', 'PONGGOK'),
('3505200', '3505', 'SRENGAT'),
('3505210', '3505', 'WONODADI'),
('3505220', '3505', 'UDANAWU'),
('3506010', '3506', 'MOJO'),
('3506020', '3506', 'SEMEN'),
('3506030', '3506', 'NGADILUWIH'),
('3506040', '3506', 'KRAS'),
('3506050', '3506', 'RINGINREJO'),
('3506060', '3506', 'KANDAT'),
('3506070', '3506', 'WATES'),
('3506080', '3506', 'NGANCAR'),
('3506090', '3506', 'PLOSOKLATEN'),
('3506100', '3506', 'GURAH'),
('3506110', '3506', 'PUNCU'),
('3506120', '3506', 'KEPUNG'),
('3506130', '3506', 'KANDANGAN'),
('3506140', '3506', 'PARE'),
('3506141', '3506', 'BADAS'),
('3506150', '3506', 'KUNJANG'),
('3506160', '3506', 'PLEMAHAN'),
('3506170', '3506', 'PURWOASRI'),
('3506180', '3506', 'PAPAR'),
('3506190', '3506', 'PAGU'),
('3506191', '3506', 'KAYEN KIDUL'),
('3506200', '3506', 'GAMPENGREJO'),
('3506201', '3506', 'NGASEM'),
('3506210', '3506', 'BANYAKAN'),
('3506220', '3506', 'GROGOL'),
('3506230', '3506', 'TAROKAN'),
('3507010', '3507', 'DONOMULYO'),
('3507020', '3507', 'KALIPARE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3507030', '3507', 'PAGAK'),
('3507040', '3507', 'BANTUR'),
('3507050', '3507', 'GEDANGAN'),
('3507060', '3507', 'SUMBERMANJING'),
('3507070', '3507', 'DAMPIT'),
('3507080', '3507', '<NAME>UDO'),
('3507090', '3507', 'AMPELGADING'),
('3507100', '3507', 'PONCOKUSUMO'),
('3507110', '3507', 'WAJAK'),
('3507120', '3507', 'TUREN'),
('3507130', '3507', 'BULULAWANG'),
('3507140', '3507', 'GONDANGLEGI'),
('3507150', '3507', 'PAGELARAN'),
('3507160', '3507', 'KEPANJEN'),
('3507170', '3507', 'SUMBER PUCUNG'),
('3507180', '3507', 'KROMENGAN'),
('3507190', '3507', 'NGAJUM'),
('3507200', '3507', 'WONOSARI'),
('3507210', '3507', 'WAGIR'),
('3507220', '3507', 'PAKISAJI'),
('3507230', '3507', 'TAJINAN'),
('3507240', '3507', 'TUMPANG'),
('3507250', '3507', 'PAKIS'),
('3507260', '3507', 'JABUNG'),
('3507270', '3507', 'LAWANG'),
('3507280', '3507', 'SINGOSARI'),
('3507290', '3507', 'KARANGPLOSO'),
('3507300', '3507', 'DAU'),
('3507310', '3507', 'PUJON'),
('3507320', '3507', 'NGANTANG'),
('3507330', '3507', 'KASEMBON'),
('3508010', '3508', 'TEMPURSARI'),
('3508020', '3508', 'PRONOJIWO'),
('3508030', '3508', 'CANDIPURO'),
('3508040', '3508', 'PASIRIAN'),
('3508050', '3508', 'TEMPEH'),
('3508060', '3508', 'LUMAJANG'),
('3508061', '3508', 'SUMBERSUKO'),
('3508070', '3508', 'TEKUNG'),
('3508080', '3508', 'KUNIR'),
('3508090', '3508', 'YOSOWILANGUN'),
('3508100', '3508', 'ROWOKANGKUNG'),
('3508110', '3508', 'JATIROTO'),
('3508120', '3508', 'RANDUAGUNG'),
('3508130', '3508', 'SUKODONO'),
('3508140', '3508', 'PADANG'),
('3508150', '3508', 'PASRUJAMBE'),
('3508160', '3508', 'SENDURO'),
('3508170', '3508', 'GUCIALIT'),
('3508180', '3508', 'KEDUNGJAJANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3508190', '3508', 'KLAKAH'),
('3508200', '3508', 'RANUYOSO'),
('3509010', '3509', 'KENCONG'),
('3509020', '3509', 'GUMUK MAS'),
('3509030', '3509', 'PUGER'),
('3509040', '3509', 'WULUHAN'),
('3509050', '3509', 'AMBULU'),
('3509060', '3509', 'TEMPUREJO'),
('3509070', '3509', 'SILO'),
('3509080', '3509', 'MAYANG'),
('3509090', '3509', 'MUMBULSARI'),
('3509100', '3509', 'JENGGAWAH'),
('3509110', '3509', 'AJUNG'),
('3509120', '3509', 'RAMBIPUJI'),
('3509130', '3509', 'BALUNG'),
('3509140', '3509', 'UMBULSARI'),
('3509150', '3509', 'SEMBORO'),
('3509160', '3509', 'JOMBANG'),
('3509170', '3509', 'SUMBER BARU'),
('3509180', '3509', 'TANGGUL'),
('3509190', '3509', 'BANGSALSARI'),
('3509200', '3509', 'PANTI'),
('3509210', '3509', 'SUKORAMBI'),
('3509220', '3509', 'ARJASA'),
('3509230', '3509', 'PAKUSARI'),
('3509240', '3509', 'KALISAT'),
('3509250', '3509', 'LEDOKOMBO'),
('3509260', '3509', 'SUMBERJAMBE'),
('3509270', '3509', 'SUKOWONO'),
('3509280', '3509', 'JELBUK'),
('3509710', '3509', 'KALIWATES'),
('3509720', '3509', 'SUMBERSARI'),
('3509730', '3509', 'PATRANG'),
('3510010', '3510', 'PESANGGARAN'),
('3510011', '3510', 'SILIRAGUNG'),
('3510020', '3510', 'BANGOREJO'),
('3510030', '3510', 'PURWOHARJO'),
('3510040', '3510', 'TEGALDLIMO'),
('3510050', '3510', 'MUNCAR'),
('3510060', '3510', 'CLURING'),
('3510070', '3510', 'GAMBIRAN'),
('3510071', '3510', 'TEGALSARI'),
('3510080', '3510', 'GLENMORE'),
('3510090', '3510', 'KALIBARU'),
('3510100', '3510', 'GENTENG'),
('3510110', '3510', 'SRONO'),
('3510120', '3510', 'ROGOJAMPI'),
('3510130', '3510', 'KABAT'),
('3510140', '3510', 'SINGOJURUH'),
('3510150', '3510', 'SEMPU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3510160', '3510', 'SONGGON'),
('3510170', '3510', 'GLAGAH'),
('3510171', '3510', 'LICIN'),
('3510180', '3510', 'BANYUWANGI'),
('3510190', '3510', 'GIRI'),
('3510200', '3510', 'KALIPURO'),
('3510210', '3510', 'WONGSOREJO'),
('3511010', '3511', 'MAESAN'),
('3511020', '3511', 'GRUJUGAN'),
('3511030', '3511', 'TAMANAN'),
('3511031', '3511', 'JAMBESARI DARUS SHOLAH'),
('3511040', '3511', 'PUJER'),
('3511050', '3511', 'TLOGOSARI'),
('3511060', '3511', 'SUKOSARI'),
('3511061', '3511', 'SUMBER WRINGIN'),
('3511070', '3511', 'TAPEN'),
('3511080', '3511', 'WONOSARI'),
('3511090', '3511', 'TENGGARANG'),
('3511100', '3511', 'BONDOWOSO'),
('3511110', '3511', 'CURAH DAMI'),
('3511111', '3511', 'BINAKAL'),
('3511120', '3511', 'PAKEM'),
('3511130', '3511', 'WRINGIN'),
('3511140', '3511', 'TEGALAMPEL'),
('3511141', '3511', 'TAMAN KROCOK'),
('3511150', '3511', 'KLABANG'),
('3511151', '3511', 'SEMPOL'),
('3511152', '3511', 'BOTOLINGGO'),
('3511160', '3511', 'PRAJEKAN'),
('3511170', '3511', 'CERMEE'),
('3512010', '3512', 'SUMBERMALANG'),
('3512020', '3512', 'JATIBANTENG'),
('3512030', '3512', 'BANYUGLUGUR'),
('3512040', '3512', 'BESUKI'),
('3512050', '3512', 'SUBOH'),
('3512060', '3512', 'MLANDINGAN'),
('3512070', '3512', 'BUNGATAN'),
('3512080', '3512', 'KENDIT'),
('3512090', '3512', 'PANARUKAN'),
('3512100', '3512', 'SITUBONDO'),
('3512110', '3512', 'MANGARAN'),
('3512120', '3512', 'PANJI'),
('3512130', '3512', 'KAPONGAN'),
('3512140', '3512', 'ARJASA'),
('3512150', '3512', 'JANGKAR'),
('3512160', '3512', 'ASEMBAGUS'),
('3512170', '3512', 'BANYUPUTIH'),
('3513010', '3513', 'SUKAPURA'),
('3513020', '3513', 'SUMBER'),
('3513030', '3513', 'KURIPAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3513040', '3513', 'BANTARAN'),
('3513050', '3513', 'LECES'),
('3513060', '3513', 'TEGALSIWALAN'),
('3513070', '3513', 'BANYUANYAR'),
('3513080', '3513', 'TIRIS'),
('3513090', '3513', 'KRUCIL'),
('3513100', '3513', 'GADING'),
('3513110', '3513', 'PAKUNIRAN'),
('3513120', '3513', 'KOTAANYAR'),
('3513130', '3513', 'PAITON'),
('3513140', '3513', 'BESUK'),
('3513150', '3513', 'KRAKSAAN'),
('3513160', '3513', 'KREJENGAN'),
('3513170', '3513', 'PAJARAKAN'),
('3513180', '3513', 'MARON'),
('3513190', '3513', 'GENDING'),
('3513200', '3513', 'DRINGU'),
('3513210', '3513', 'WONOMERTO'),
('3513220', '3513', 'LUMBANG'),
('3513230', '3513', 'TONGAS'),
('3513240', '3513', 'SUMBERASIH'),
('3514010', '3514', 'PURWODADI'),
('3514020', '3514', 'TUTUR'),
('3514030', '3514', 'PUSPO'),
('3514040', '3514', 'TOSARI'),
('3514050', '3514', 'LUMBANG'),
('3514060', '3514', 'PASREPAN'),
('3514070', '3514', 'KEJAYAN'),
('3514080', '3514', 'WONOREJO'),
('3514090', '3514', 'PURWOSARI'),
('3514100', '3514', 'PRIGEN'),
('3514110', '3514', 'SUKOREJO'),
('3514120', '3514', 'PANDAAN'),
('3514130', '3514', 'GEMPOL'),
('3514140', '3514', 'BEJI'),
('3514150', '3514', 'BANGIL'),
('3514160', '3514', 'REMBANG'),
('3514170', '3514', 'KRATON'),
('3514180', '3514', 'POHJENTREK'),
('3514190', '3514', '<NAME>'),
('3514200', '3514', 'REJOSO'),
('3514210', '3514', 'WINONGAN'),
('3514220', '3514', 'GRATI'),
('3514230', '3514', 'LEKOK'),
('3514240', '3514', 'NGULING'),
('3515010', '3515', 'TARIK'),
('3515020', '3515', 'PRAMBON'),
('3515030', '3515', 'KREMBUNG'),
('3515040', '3515', 'PORONG'),
('3515050', '3515', 'JABON');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3515060', '3515', 'TANGGULANGIN'),
('3515070', '3515', 'CANDI'),
('3515080', '3515', 'TULANGAN'),
('3515090', '3515', 'WONOAYU'),
('3515100', '3515', 'SUKODONO'),
('3515110', '3515', 'SIDOARJO'),
('3515120', '3515', 'BUDURAN'),
('3515130', '3515', 'SEDATI'),
('3515140', '3515', 'WARU'),
('3515150', '3515', 'GEDANGAN'),
('3515160', '3515', 'TAMAN'),
('3515170', '3515', 'KRIAN'),
('3515180', '3515', '<NAME>'),
('3516010', '3516', 'JATIREJO'),
('3516020', '3516', 'GONDANG'),
('3516030', '3516', 'PACET'),
('3516040', '3516', 'TRAWAS'),
('3516050', '3516', 'NGORO'),
('3516060', '3516', 'PUNGGING'),
('3516070', '3516', 'KUTOREJO'),
('3516080', '3516', 'MOJOSARI'),
('3516090', '3516', 'BANGSAL'),
('3516091', '3516', 'MOJOANYAR'),
('3516100', '3516', 'DLANGGU'),
('3516110', '3516', 'PURI'),
('3516120', '3516', 'TROWULAN'),
('3516130', '3516', 'SOOKO'),
('3516140', '3516', 'GEDEK'),
('3516150', '3516', 'KEMLAGI'),
('3516160', '3516', 'JETIS'),
('3516170', '3516', '<NAME>'),
('3517010', '3517', '<NAME>'),
('3517020', '3517', 'PERAK'),
('3517030', '3517', 'GUDO'),
('3517040', '3517', 'DIWEK'),
('3517050', '3517', 'NGORO'),
('3517060', '3517', 'MOJOWARNO'),
('3517070', '3517', 'BARENG'),
('3517080', '3517', 'WONOSALAM'),
('3517090', '3517', 'MOJOAGUNG'),
('3517100', '3517', 'SUMOBITO'),
('3517110', '3517', '<NAME>'),
('3517120', '3517', 'PETERONGAN'),
('3517130', '3517', 'JOMBANG'),
('3517140', '3517', 'MEGALUH'),
('3517150', '3517', 'TEMBELANG'),
('3517160', '3517', 'KESAMBEN'),
('3517170', '3517', 'KUDU'),
('3517171', '3517', 'NGUSIKAN'),
('3517180', '3517', 'PLOSO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3517190', '3517', 'KABUH'),
('3517200', '3517', 'PLANDAAN'),
('3518010', '3518', 'SAWAHAN'),
('3518020', '3518', 'NGETOS'),
('3518030', '3518', 'BERBEK'),
('3518040', '3518', 'LOCERET'),
('3518050', '3518', 'PACE'),
('3518060', '3518', 'TANJUNGANOM'),
('3518070', '3518', 'PRAMBON'),
('3518080', '3518', 'NGRONGGOT'),
('3518090', '3518', 'KERTOSONO'),
('3518100', '3518', 'PATIANROWO'),
('3518110', '3518', 'BARON'),
('3518120', '3518', 'GONDANG'),
('3518130', '3518', 'SUKOMORO'),
('3518140', '3518', 'NGANJUK'),
('3518150', '3518', 'BAGOR'),
('3518160', '3518', 'WILANGAN'),
('3518170', '3518', 'REJOSO'),
('3518180', '3518', 'NGLUYU'),
('3518190', '3518', 'LENGKONG'),
('3518200', '3518', 'JATIKALEN'),
('3519010', '3519', 'KEBONSARI'),
('3519020', '3519', 'GEGER'),
('3519030', '3519', 'DOLOPO'),
('3519040', '3519', 'DAGANGAN'),
('3519050', '3519', 'WUNGU'),
('3519060', '3519', 'KARE'),
('3519070', '3519', 'GEMARANG'),
('3519080', '3519', 'SARADAN'),
('3519090', '3519', 'PILANGKENCENG'),
('3519100', '3519', 'MEJAYAN'),
('3519110', '3519', 'WONOASRI'),
('3519120', '3519', 'BALEREJO'),
('3519130', '3519', 'MADIUN'),
('3519140', '3519', 'SAWAHAN'),
('3519150', '3519', 'JIWAN'),
('3520010', '3520', 'PONCOL'),
('3520020', '3520', 'PARANG'),
('3520030', '3520', 'LEMBEYAN'),
('3520040', '3520', 'TAKERAN'),
('3520041', '3520', 'NGUNTORONADI'),
('3520050', '3520', 'KAWEDANAN'),
('3520060', '3520', 'MAGETAN'),
('3520061', '3520', 'NGARIBOYO'),
('3520070', '3520', 'PLAOSAN'),
('3520071', '3520', 'SIDOREJO'),
('3520080', '3520', 'PANEKAN'),
('3520090', '3520', 'SUKOMORO'),
('3520100', '3520', 'BENDO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3520110', '3520', 'MAOSPATI'),
('3520120', '3520', 'KARANGREJO'),
('3520121', '3520', 'KARAS'),
('3520130', '3520', 'BARAT'),
('3520131', '3520', 'KARTOHARJO'),
('3521010', '3521', 'SINE'),
('3521020', '3521', 'NGRAMBE'),
('3521030', '3521', 'JOGOROGO'),
('3521040', '3521', 'KENDAL'),
('3521050', '3521', 'GENENG'),
('3521051', '3521', 'GERIH'),
('3521060', '3521', 'KWADUNGAN'),
('3521070', '3521', 'PANGKUR'),
('3521080', '3521', 'KARANGJATI'),
('3521090', '3521', 'BRINGIN'),
('3521100', '3521', 'PADAS'),
('3521101', '3521', 'KASREMAN'),
('3521110', '3521', 'NGAWI'),
('3521120', '3521', 'PARON'),
('3521130', '3521', 'KEDUNGGALAR'),
('3521140', '3521', 'PITU'),
('3521150', '3521', 'WIDODAREN'),
('3521160', '3521', 'MANTINGAN'),
('3521170', '3521', 'KARANGANYAR'),
('3522010', '3522', 'MARGOMULYO'),
('3522020', '3522', 'NGRAHO'),
('3522030', '3522', 'TAMBAKREJO'),
('3522040', '3522', 'NGAMBON'),
('3522041', '3522', 'SEKAR'),
('3522050', '3522', 'BUBULAN'),
('3522051', '3522', 'GONDANG'),
('3522060', '3522', 'TEMAYANG'),
('3522070', '3522', 'SUGIHWARAS'),
('3522080', '3522', 'KEDUNGADEM'),
('3522090', '3522', 'KEPOH BARU'),
('3522100', '3522', 'BAURENO'),
('3522110', '3522', 'KANOR'),
('3522120', '3522', 'SUMBEREJO'),
('3522130', '3522', 'BALEN'),
('3522140', '3522', 'SUKOSEWU'),
('3522150', '3522', 'KAPAS'),
('3522160', '3522', 'BOJONEGORO'),
('3522170', '3522', 'TRUCUK'),
('3522180', '3522', 'DANDER'),
('3522190', '3522', 'NGASEM'),
('3522191', '3522', 'GAYAM'),
('3522200', '3522', 'KALITIDU'),
('3522210', '3522', 'MALO'),
('3522220', '3522', 'PURWOSARI'),
('3522230', '3522', 'PADANGAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3522240', '3522', 'KASIMAN'),
('3522241', '3522', 'KEDEWAN'),
('3523010', '3523', 'KENDURUAN'),
('3523020', '3523', 'BANGILAN'),
('3523030', '3523', 'SENORI'),
('3523040', '3523', 'SINGGAHAN'),
('3523050', '3523', 'MONTONG'),
('3523060', '3523', 'PARENGAN'),
('3523070', '3523', 'SOKO'),
('3523080', '3523', 'RENGEL'),
('3523081', '3523', 'GRABAGAN'),
('3523090', '3523', 'PLUMPANG'),
('3523100', '3523', 'WIDANG'),
('3523110', '3523', 'PALANG'),
('3523120', '3523', 'SEMANDING'),
('3523130', '3523', 'TUBAN'),
('3523140', '3523', 'JENU'),
('3523150', '3523', 'MERAKURAK'),
('3523160', '3523', 'KEREK'),
('3523170', '3523', 'TAMBAKBOYO'),
('3523180', '3523', 'JATIROGO'),
('3523190', '3523', 'BANCAR'),
('3524010', '3524', 'SUKORAME'),
('3524020', '3524', 'BLULUK'),
('3524030', '3524', 'NGIMBANG'),
('3524040', '3524', 'SAMBENG'),
('3524050', '3524', 'MANTUP'),
('3524060', '3524', 'KEMBANGBAHU'),
('3524070', '3524', 'SUGIO'),
('3524080', '3524', 'KEDUNGPRING'),
('3524090', '3524', 'MODO'),
('3524100', '3524', 'BABAT'),
('3524110', '3524', 'PUCUK'),
('3524120', '3524', 'SUKODADI'),
('3524130', '3524', 'LAMONGAN'),
('3524140', '3524', 'TIKUNG'),
('3524141', '3524', 'SARIREJO'),
('3524150', '3524', 'DEKET'),
('3524160', '3524', 'GLAGAH'),
('3524170', '3524', 'KARANGBINANGUN'),
('3524180', '3524', 'TURI'),
('3524190', '3524', 'KALITENGAH'),
('3524200', '3524', 'KARANG GENENG'),
('3524210', '3524', 'SEKARAN'),
('3524220', '3524', 'MADURAN'),
('3524230', '3524', 'LAREN'),
('3524240', '3524', 'SOLOKURO'),
('3524250', '3524', 'PACIRAN'),
('3524260', '3524', 'BRONDONG'),
('3525010', '3525', 'WRINGINANOM');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3525020', '3525', 'DRIYOREJO'),
('3525030', '3525', 'KEDAMEAN'),
('3525040', '3525', 'MENGANTI'),
('3525050', '3525', 'CERME'),
('3525060', '3525', 'BENJENG'),
('3525070', '3525', 'BALONGPANGGANG'),
('3525080', '3525', 'DUDUKSAMPEYAN'),
('3525090', '3525', 'KEBOMAS'),
('3525100', '3525', 'GRESIK'),
('3525110', '3525', 'MANYAR'),
('3525120', '3525', 'BUNGAH'),
('3525130', '3525', 'SIDAYU'),
('3525140', '3525', 'DUKUN'),
('3525150', '3525', 'PANCENG'),
('3525160', '3525', 'UJUNGPANGKAH'),
('3525170', '3525', 'SANGKAPURA'),
('3525180', '3525', 'TAMBAK'),
('3526010', '3526', 'KAMAL'),
('3526020', '3526', 'LABANG'),
('3526030', '3526', 'KWANYAR'),
('3526040', '3526', 'MODUNG'),
('3526050', '3526', 'BLEGA'),
('3526060', '3526', 'KONANG'),
('3526070', '3526', 'GALIS'),
('3526080', '3526', 'TANAH MERAH'),
('3526090', '3526', 'TRAGAH'),
('3526100', '3526', 'SOCAH'),
('3526110', '3526', 'BANGKALAN'),
('3526120', '3526', 'BURNEH'),
('3526130', '3526', 'AROSBAYA'),
('3526140', '3526', 'GEGER'),
('3526150', '3526', 'KOKOP'),
('3526160', '3526', 'TANJUNGBUMI'),
('3526170', '3526', 'SEPULU'),
('3526180', '3526', 'KLAMPIS'),
('3527010', '3527', 'SRESEH'),
('3527020', '3527', 'TORJUN'),
('3527021', '3527', 'PANGARENGAN'),
('3527030', '3527', 'SAMPANG'),
('3527040', '3527', 'CAMPLONG'),
('3527050', '3527', 'OMBEN'),
('3527060', '3527', 'KEDUNGDUNG'),
('3527070', '3527', 'JRENGIK'),
('3527080', '3527', 'TAMBELANGAN'),
('3527090', '3527', 'BANYUATES'),
('3527100', '3527', 'ROBATAL'),
('3527101', '3527', 'KARANG PENANG'),
('3527110', '3527', 'KETAPANG'),
('3527120', '3527', 'SOKOBANAH'),
('3528010', '3528', 'TLANAKAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3528020', '3528', 'PADEMAWU'),
('3528030', '3528', 'GALIS'),
('3528040', '3528', 'LARANGAN'),
('3528050', '3528', 'PAMEKASAN'),
('3528060', '3528', 'PROPPO'),
('3528070', '3528', 'PALENGAAN'),
('3528080', '3528', 'PEGANTENAN'),
('3528090', '3528', 'KADUR'),
('3528100', '3528', 'PAKONG'),
('3528110', '3528', 'WARU'),
('3528120', '3528', 'BATU MARMAR'),
('3528130', '3528', 'PASEAN'),
('3529010', '3529', 'PRAGAAN'),
('3529020', '3529', 'BLUTO'),
('3529030', '3529', 'SARONGGI'),
('3529040', '3529', 'GILIGENTENG'),
('3529050', '3529', 'TALANGO'),
('3529060', '3529', 'KALIANGET'),
('3529070', '3529', 'KOTA SUMENEP'),
('3529071', '3529', 'BATUAN'),
('3529080', '3529', 'LENTENG'),
('3529090', '3529', 'GANDING'),
('3529100', '3529', 'GULUK GULUK'),
('3529110', '3529', 'PASONGSONGAN'),
('3529120', '3529', 'AMBUNTEN'),
('3529130', '3529', 'RUBARU'),
('3529140', '3529', 'DASUK'),
('3529150', '3529', 'MANDING'),
('3529160', '3529', 'BATUPUTIH'),
('3529170', '3529', 'GAPURA'),
('3529180', '3529', 'BATANG BATANG'),
('3529190', '3529', 'DUNGKEK'),
('3529200', '3529', 'NONGGUNONG'),
('3529210', '3529', 'GAYAM'),
('3529220', '3529', 'RAAS'),
('3529230', '3529', 'SAPEKEN'),
('3529240', '3529', 'ARJASA'),
('3529241', '3529', 'KANGAYAN'),
('3529250', '3529', 'MASALEMBU'),
('3571010', '3571', 'MOJOROTO'),
('3571020', '3571', 'KOTA KEDIRI'),
('3571030', '3571', 'PESANTREN'),
('3572010', '3572', 'SUKOREJO'),
('3572020', '3572', 'KEPANJENKIDUL'),
('3572030', '3572', 'SANANWETAN'),
('3573010', '3573', 'KEDUNGKANDANG'),
('3573020', '3573', 'SUKUN'),
('3573030', '3573', 'KLOJEN'),
('3573040', '3573', 'BLIMBING'),
('3573050', '3573', 'LOWOKWARU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3574010', '3574', 'KADEMANGAN'),
('3574011', '3574', 'KEDOPOK'),
('3574020', '3574', 'WONOASIH'),
('3574030', '3574', 'MAYANGAN'),
('3574031', '3574', 'KANIGARAN'),
('3575010', '3575', 'GADINGREJO'),
('3575020', '3575', 'PURWOREJO'),
('3575030', '3575', 'BUGULKIDUL'),
('3575031', '3575', 'PANGGUNGREJO'),
('3576010', '3576', '<NAME>'),
('3576020', '3576', 'MAGERSARI'),
('3577010', '3577', '<NAME>'),
('3577020', '3577', 'TAMAN'),
('3577030', '3577', 'KARTOHARJO'),
('3578010', '3578', 'KARANG PILANG'),
('3578020', '3578', 'JAMBANGAN'),
('3578030', '3578', 'GAYUNGAN'),
('3578040', '3578', 'WONOCOLO'),
('3578050', '3578', '<NAME>'),
('3578060', '3578', '<NAME>'),
('3578070', '3578', 'RUNGKUT'),
('3578080', '3578', 'SUKOLILO'),
('3578090', '3578', 'MULYOREJO'),
('3578100', '3578', 'GUBENG'),
('3578110', '3578', 'WONOKROMO'),
('3578120', '3578', '<NAME>'),
('3578130', '3578', 'WIYUNG'),
('3578140', '3578', 'LAKARSANTRI'),
('3578141', '3578', 'SAMBIKEREP'),
('3578150', '3578', 'TANDES'),
('3578160', '3578', '<NAME>'),
('3578170', '3578', 'SAWAHAN'),
('3578180', '3578', 'TEGALSARI'),
('3578190', '3578', 'GENTENG'),
('3578200', '3578', 'TAMBAKSARI'),
('3578210', '3578', 'KENJERAN'),
('3578211', '3578', 'BULAK'),
('3578220', '3578', 'SIMOKERTO'),
('3578230', '3578', 'SEMAMPIR'),
('3578240', '3578', 'PABEAN CANTIAN'),
('3578250', '3578', 'BUBUTAN'),
('3578260', '3578', 'KREMBANGAN'),
('3578270', '3578', 'ASEMROWO'),
('3578280', '3578', 'BENOWO'),
('3578281', '3578', 'PAKAL'),
('3579010', '3579', 'BATU'),
('3579020', '3579', 'JUNREJO'),
('3579030', '3579', 'BUMIAJI'),
('3601010', '3601', 'SUMUR'),
('3601020', '3601', 'CIMANGGU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3601030', '3601', 'CIBALIUNG'),
('3601031', '3601', 'CIBITUNG'),
('3601040', '3601', 'CIKEUSIK'),
('3601050', '3601', 'CIGEULIS'),
('3601060', '3601', 'PANIMBANG'),
('3601061', '3601', 'SOBANG'),
('3601070', '3601', 'MUNJUL'),
('3601071', '3601', 'ANGSANA'),
('3601072', '3601', 'SINDANGRESMI'),
('3601080', '3601', 'PICUNG'),
('3601090', '3601', 'BOJONG'),
('3601100', '3601', 'SAKETI'),
('3601101', '3601', 'CISATA'),
('3601110', '3601', 'PAGELARAN'),
('3601111', '3601', 'PATIA'),
('3601112', '3601', 'SUKARESMI'),
('3601120', '3601', 'LABUAN'),
('3601121', '3601', 'CARITA'),
('3601130', '3601', 'JIPUT'),
('3601131', '3601', 'CIKEDAL'),
('3601140', '3601', 'MENES'),
('3601141', '3601', 'PULOSARI'),
('3601150', '3601', 'MANDALAWANGI'),
('3601160', '3601', 'CIMANUK'),
('3601161', '3601', 'CIPEUCANG'),
('3601170', '3601', 'BANJAR'),
('3601171', '3601', 'KADUHEJO'),
('3601172', '3601', 'MEKARJAYA'),
('3601180', '3601', 'PANDEGLANG'),
('3601181', '3601', 'MAJASARI'),
('3601190', '3601', 'CADASARI'),
('3601191', '3601', 'KARANGTANJUNG'),
('3601192', '3601', 'KORONCONG'),
('3602010', '3602', 'MALINGPING'),
('3602011', '3602', 'WANASALAM'),
('3602020', '3602', 'PANGGARANGAN'),
('3602021', '3602', 'CIHARA'),
('3602030', '3602', 'BAYAH'),
('3602031', '3602', 'CILOGRANG'),
('3602040', '3602', 'CIBEBER'),
('3602050', '3602', 'CIJAKU'),
('3602051', '3602', 'CIGEMBLONG'),
('3602060', '3602', 'BANJARSARI'),
('3602070', '3602', 'CILELES'),
('3602080', '3602', '<NAME>'),
('3602090', '3602', 'BOJONGMANIK'),
('3602091', '3602', 'CIRINTEN'),
('3602100', '3602', 'LEUWIDAMAR'),
('3602110', '3602', 'MUNCANG'),
('3602111', '3602', 'SOBANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3602120', '3602', 'CIPANAS'),
('3602121', '3602', 'LEBAKGEDONG'),
('3602130', '3602', 'SAJIRA'),
('3602140', '3602', 'CIMARGA'),
('3602150', '3602', 'CIKULUR'),
('3602160', '3602', 'WARUNGGUNUNG'),
('3602170', '3602', 'CIBADAK'),
('3602180', '3602', 'RANGKASBITUNG'),
('3602181', '3602', 'KALANGANYAR'),
('3602190', '3602', 'MAJA'),
('3602191', '3602', 'CURUGBITUNG'),
('3603010', '3603', 'CISOKA'),
('3603011', '3603', 'SOLEAR'),
('3603020', '3603', 'TIGARAKSA'),
('3603021', '3603', 'JAMBE'),
('3603030', '3603', 'CIKUPA'),
('3603040', '3603', 'PANONGAN'),
('3603050', '3603', 'CURUG'),
('3603051', '3603', 'KELAPA DUA'),
('3603060', '3603', 'LEGOK'),
('3603070', '3603', 'PAGEDANGAN'),
('3603081', '3603', 'CISAUK'),
('3603120', '3603', 'PASARKEMIS'),
('3603121', '3603', 'SINDANG JAYA'),
('3603130', '3603', 'BALARAJA'),
('3603131', '3603', 'JAYANTI'),
('3603132', '3603', 'SUKAMULYA'),
('3603140', '3603', 'KRESEK'),
('3603141', '3603', '<NAME>'),
('3603150', '3603', 'KRONJO'),
('3603151', '3603', 'MEKAR BARU'),
('3603160', '3603', 'MAUK'),
('3603161', '3603', 'KEMIRI'),
('3603162', '3603', 'SUKADIRI'),
('3603170', '3603', 'RAJEG'),
('3603180', '3603', 'SEPATAN'),
('3603181', '3603', 'SEPATAN TIMUR'),
('3603190', '3603', 'PAKUHAJI'),
('3603200', '3603', 'TELUKNAGA'),
('3603210', '3603', 'KOSAMBI'),
('3604010', '3604', 'CINANGKA'),
('3604020', '3604', 'PADARINCANG'),
('3604030', '3604', 'CIOMAS'),
('3604040', '3604', 'PABUARAN'),
('3604041', '3604', 'GUNUNG SARI'),
('3604050', '3604', 'BAROS'),
('3604060', '3604', 'PETIR'),
('3604061', '3604', 'TUNJUNG TEJA'),
('3604080', '3604', 'CIKEUSAL'),
('3604090', '3604', 'PAMARAYAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3604091', '3604', 'BANDUNG'),
('3604100', '3604', 'JAWILAN'),
('3604110', '3604', 'KOPO'),
('3604120', '3604', 'CIKANDE'),
('3604121', '3604', 'KIBIN'),
('3604130', '3604', 'KRAGILAN'),
('3604180', '3604', 'WARINGINKURUNG'),
('3604190', '3604', 'MANCAK'),
('3604200', '3604', 'ANYAR'),
('3604210', '3604', 'BOJONEGARA'),
('3604211', '3604', 'P<NAME>'),
('3604220', '3604', 'KRAMATWATU'),
('3604240', '3604', 'CIRUAS'),
('3604250', '3604', 'PONTANG'),
('3604251', '3604', 'LEBAK WANGI'),
('3604260', '3604', 'CARENANG'),
('3604261', '3604', 'BINUANG'),
('3604270', '3604', 'TIRTAYASA'),
('3604271', '3604', 'TANARA'),
('3671010', '3671', 'CILEDUG'),
('3671011', '3671', 'LARANGAN'),
('3671012', '3671', 'KARANG TENGAH'),
('3671020', '3671', 'CIPONDOH'),
('3671021', '3671', 'PINANG'),
('3671030', '3671', 'TANGERANG'),
('3671031', '3671', 'KARAWACI'),
('3671040', '3671', '<NAME>'),
('3671041', '3671', 'CIBODAS'),
('3671042', '3671', 'PERIUK'),
('3671050', '3671', 'BATUCEPER'),
('3671051', '3671', 'NEGLASARI'),
('3671060', '3671', 'BENDA'),
('3672010', '3672', 'CIWANDAN'),
('3672011', '3672', 'CITANGKIL'),
('3672020', '3672', 'PULOMERAK'),
('3672021', '3672', 'PURWAKARTA'),
('3672022', '3672', 'GROGOL'),
('3672030', '3672', 'CILEGON'),
('3672031', '3672', 'JOMBANG'),
('3672040', '3672', 'CIBEBER'),
('3673010', '3673', 'CURUG'),
('3673020', '3673', 'WALANTAKA'),
('3673030', '3673', '<NAME>'),
('3673040', '3673', 'SERANG'),
('3673050', '3673', 'TAKTAKAN'),
('3673060', '3673', 'KASEMEN'),
('3674010', '3674', 'SETU'),
('3674020', '3674', 'SERPONG'),
('3674030', '3674', 'PAMULANG'),
('3674040', '3674', 'CIPUTAT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('3674050', '3674', 'CIPUTAT TIMUR'),
('3674060', '3674', 'PONDOK AREN'),
('3674070', '3674', 'SERPONG UTARA'),
('5101010', '5101', 'MELAYA'),
('5101020', '5101', 'NEGARA'),
('5101021', '5101', 'JEMBRANA'),
('5101030', '5101', 'MENDOYO'),
('5101040', '5101', 'PEKUTATAN'),
('5102010', '5102', 'SELEMADEG'),
('5102011', '5102', 'SELEMADEG TIMUR'),
('5102012', '5102', 'SELEMADEG BARAT'),
('5102020', '5102', 'KERAMBITAN'),
('5102030', '5102', 'TABANAN'),
('5102040', '5102', 'KEDIRI'),
('5102050', '5102', 'MARGA'),
('5102060', '5102', 'BATURITI'),
('5102070', '5102', 'PENEBEL'),
('5102080', '5102', 'PUPUAN'),
('5103010', '5103', 'KUTA SELATAN'),
('5103020', '5103', 'KUTA'),
('5103030', '5103', 'KUTA UTARA'),
('5103040', '5103', 'MENGWI'),
('5103050', '5103', 'ABIANSEMAL'),
('5103060', '5103', 'PETANG'),
('5104010', '5104', 'SUKAWATI'),
('5104020', '5104', 'BLAHBATUH'),
('5104030', '5104', 'GIANYAR'),
('5104040', '5104', 'TAMPAKSIRING'),
('5104050', '5104', 'UBUD'),
('5104060', '5104', 'TEGALLALANG'),
('5104070', '5104', 'PAYANGAN'),
('5105010', '5105', 'NUSAPENIDA'),
('5105020', '5105', 'BANJARANGKAN'),
('5105030', '5105', 'KLUNGKUNG'),
('5105040', '5105', 'DAWAN'),
('5106010', '5106', 'SUSUT'),
('5106020', '5106', 'BANGLI'),
('5106030', '5106', 'TEMBUKU'),
('5106040', '5106', 'KINTAMANI'),
('5107010', '5107', 'RENDANG'),
('5107020', '5107', 'SIDEMEN'),
('5107030', '5107', 'MANGGIS'),
('5107040', '5107', 'KARANGASEM'),
('5107050', '5107', 'ABANG'),
('5107060', '5107', 'BEBANDEM'),
('5107070', '5107', 'SELAT'),
('5107080', '5107', 'KUBU'),
('5108010', '5108', 'GEROKGAK'),
('5108020', '5108', 'SERIRIT'),
('5108030', '5108', 'BUSUNGBIU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5108040', '5108', 'BANJAR'),
('5108050', '5108', 'SUKASADA'),
('5108060', '5108', 'BULELENG'),
('5108070', '5108', 'SAWAN'),
('5108080', '5108', 'KUBUTAMBAHAN'),
('5108090', '5108', 'TEJAKULA'),
('5171010', '5171', 'DENPASAR SELATAN'),
('5171020', '5171', 'DENPASAR TIMUR'),
('5171030', '5171', 'DENPASAR BARAT'),
('5171031', '5171', 'DENPASAR UTARA'),
('5201010', '5201', 'SEKOTONG'),
('5201011', '5201', 'LEMBAR'),
('5201020', '5201', 'GERUNG'),
('5201030', '5201', 'LABU API'),
('5201040', '5201', 'KEDIRI'),
('5201041', '5201', 'KURIPAN'),
('5201050', '5201', 'NARMADA'),
('5201051', '5201', 'LINGSAR'),
('5201060', '5201', 'GUNUNG SARI'),
('5201061', '5201', 'BATU LAYAR'),
('5202010', '5202', 'PRAYA BARAT'),
('5202011', '5202', 'PRAYA BARAT DAYA'),
('5202020', '5202', 'PUJUT'),
('5202030', '5202', 'PRAYA TIMUR'),
('5202040', '5202', 'JANAPRIA'),
('5202050', '5202', 'KOPANG'),
('5202060', '5202', 'PRAYA'),
('5202061', '5202', 'PRAYA TENGAH'),
('5202070', '5202', 'JONGGAT'),
('5202080', '5202', 'PRINGGARATA'),
('5202090', '5202', 'BATUKLIANG'),
('5202091', '5202', 'BATUKLIANG UTARA'),
('5203010', '5203', 'KERUAK'),
('5203011', '5203', 'JEROWARU'),
('5203020', '5203', 'SAKRA'),
('5203021', '5203', 'SAKRA BARAT'),
('5203022', '5203', 'SAKRA TIMUR'),
('5203030', '5203', 'TERARA'),
('5203031', '5203', 'MONTONG GADING'),
('5203040', '5203', 'SIKUR'),
('5203050', '5203', 'MASBAGIK'),
('5203051', '5203', 'PRINGGASELA'),
('5203060', '5203', 'SUKAMULIA'),
('5203061', '5203', 'SURALAGA'),
('5203070', '5203', 'SELONG'),
('5203071', '5203', 'LABUHAN HAJI'),
('5203080', '5203', 'PRINGGABAYA'),
('5203081', '5203', 'SUELA'),
('5203090', '5203', 'AIKMEL'),
('5203091', '5203', 'WANASABA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5203092', '5203', 'SEMBALUN'),
('5203100', '5203', 'SAMBELIA'),
('5204020', '5204', 'LUNYUK'),
('5204021', '5204', 'ORONG TELU'),
('5204050', '5204', 'ALAS'),
('5204051', '5204', 'ALAS BARAT'),
('5204052', '5204', 'BUER'),
('5204061', '5204', 'UTAN'),
('5204062', '5204', 'RHEE'),
('5204070', '5204', 'BATULANTEH'),
('5204080', '5204', 'SUMBAWA'),
('5204081', '5204', 'LABUHAN BADAS'),
('5204082', '5204', 'UNTER IWES'),
('5204090', '5204', 'MOYOHILIR'),
('5204091', '5204', '<NAME>'),
('5204100', '5204', 'MOYOHULU'),
('5204110', '5204', 'ROPANG'),
('5204111', '5204', 'LENANGGUAR'),
('5204112', '5204', 'LANTUNG'),
('5204121', '5204', 'LAPE'),
('5204122', '5204', 'LOPOK'),
('5204130', '5204', 'PLAMPANG'),
('5204131', '5204', 'LABANGKA'),
('5204132', '5204', 'MARONGE'),
('5204140', '5204', 'EMPANG'),
('5204141', '5204', 'TARANO'),
('5205010', '5205', 'HU\'U'),
('5205011', '5205', 'PAJO'),
('5205020', '5205', 'DOMPU'),
('5205030', '5205', 'WOJA'),
('5205040', '5205', 'KILO'),
('5205050', '5205', 'KEMPO'),
('5205051', '5205', 'MANGGALEWA'),
('5205060', '5205', 'PEKAT'),
('5206010', '5206', 'MONTA'),
('5206011', '5206', 'PARADO'),
('5206020', '5206', 'BOLO'),
('5206021', '5206', 'MADA PANGGA'),
('5206030', '5206', 'WOHA'),
('5206040', '5206', 'BELO'),
('5206041', '5206', 'PALIBELO'),
('5206050', '5206', 'WAWO'),
('5206051', '5206', 'LANGGUDU'),
('5206052', '5206', 'LAMBITU'),
('5206060', '5206', 'SAPE'),
('5206061', '5206', 'LAMBU'),
('5206070', '5206', 'WERA'),
('5206071', '5206', 'AMBALAWI'),
('5206080', '5206', 'DONGGO'),
('5206081', '5206', 'SOROMANDI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5206090', '5206', 'SANGGAR'),
('5206091', '5206', 'TAMBORA'),
('5207010', '5207', 'SEKONGKANG'),
('5207020', '5207', 'JEREWEH'),
('5207021', '5207', 'MALUK'),
('5207030', '5207', 'TALIWANG'),
('5207031', '5207', 'BRANG ENE'),
('5207040', '5207', 'BRANG REA'),
('5207050', '5207', 'SETELUK'),
('5207051', '5207', 'POTO TANO'),
('5208010', '5208', 'PEMENANG'),
('5208020', '5208', 'TANJUNG'),
('5208030', '5208', 'GANGGA'),
('5208040', '5208', 'KAYANGAN'),
('5208050', '5208', 'BAYAN'),
('5271010', '5271', 'AMPENAN'),
('5271011', '5271', 'SEKARBELA'),
('5271020', '5271', 'MATARAM'),
('5271021', '5271', 'SELAPARANG'),
('5271030', '5271', 'CAKRANEGARA'),
('5271031', '5271', 'SANDUBAYA'),
('5272010', '5272', 'RASANAE BARAT'),
('5272011', '5272', 'MPUNDA'),
('5272020', '5272', 'RASANAE TIMUR'),
('5272021', '5272', 'RABA'),
('5272030', '5272', 'ASAKOTA'),
('5301021', '5301', 'LAMBOYA'),
('5301022', '5301', 'WANOKAKA'),
('5301023', '5301', 'LABOYA BARAT'),
('5301050', '5301', 'LOLI'),
('5301060', '5301', 'KOTA WAIKABUBAK'),
('5301072', '5301', 'TANA RIGHU'),
('5302010', '5302', 'LEWA'),
('5302011', '5302', 'NGGAHA ORIANGU'),
('5302012', '5302', 'LEWA TIDAHU'),
('5302013', '5302', 'KATALA HAMU LINGU'),
('5302020', '5302', 'TABUNDUNG'),
('5302021', '5302', 'PINUPAHAR'),
('5302030', '5302', 'PABERIWAI'),
('5302031', '5302', 'KARERA'),
('5302032', '5302', 'MATAWAI LA PAWU'),
('5302033', '5302', 'KAHAUNGU ETI'),
('5302034', '5302', 'MAHU'),
('5302035', '5302', 'NGADU NGALA'),
('5302040', '5302', 'PAHUNGA LODU'),
('5302041', '5302', 'WULA WAIJELU'),
('5302051', '5302', 'RINDI'),
('5302052', '5302', 'UMALULU'),
('5302060', '5302', 'PANDAWAI'),
('5302061', '5302', 'KAMBATA MAPAMBUHANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5302070', '5302', 'KOTA WAINGAPU'),
('5302071', '5302', 'KAMBERA'),
('5302080', '5302', 'HAHARU'),
('5302081', '5302', 'KANATANG'),
('5303100', '5303', 'SEMAU'),
('5303101', '5303', 'SEMAU SELATAN'),
('5303110', '5303', 'KUPANG BARAT'),
('5303111', '5303', 'NEKAMESE'),
('5303120', '5303', 'KUPANG TENGAH'),
('5303121', '5303', 'TAEBENU'),
('5303130', '5303', 'AMARASI'),
('5303131', '5303', 'AMARASI BARAT'),
('5303132', '5303', 'AMARASI SELATAN'),
('5303133', '5303', 'AMARASI TIMUR'),
('5303140', '5303', 'KUPANG TIMUR'),
('5303141', '5303', 'AMABI OEFETO TIMUR'),
('5303142', '5303', 'AMABI OEFETO'),
('5303150', '5303', 'SULAMU'),
('5303160', '5303', 'FATULEU'),
('5303161', '5303', 'FATULEU TENGAH'),
('5303162', '5303', 'FATULEU BARAT'),
('5303170', '5303', 'TAKARI'),
('5303180', '5303', 'AMFOANG SELATAN'),
('5303181', '5303', 'AMFOANG BARAT DAYA'),
('5303182', '5303', 'AMFOANG TENGAH'),
('5303190', '5303', 'AMFOANG UTARA'),
('5303191', '5303', 'AMFOANG BARAT LAUT'),
('5303192', '5303', 'AMFOANG TIMUR'),
('5304010', '5304', 'MOLLO UTARA'),
('5304011', '5304', 'FATUMNASI'),
('5304012', '5304', 'TOBU'),
('5304013', '5304', 'NUNBENA'),
('5304020', '5304', 'MOLLO SELATAN'),
('5304021', '5304', 'POLEN'),
('5304022', '5304', 'MOLLO BARAT'),
('5304023', '5304', 'MOLLO TENGAH'),
('5304030', '5304', 'KOTA SOE'),
('5304040', '5304', 'AMANUBAN BARAT'),
('5304041', '5304', 'BATU PUTIH'),
('5304042', '5304', 'KUATNANA'),
('5304050', '5304', 'AMANUBAN SELATAN'),
('5304051', '5304', 'NOEBEBA'),
('5304060', '5304', 'KUAN FATU'),
('5304061', '5304', 'KUALIN'),
('5304070', '5304', 'AMANUBAN TENGAH'),
('5304071', '5304', 'KOLBANO'),
('5304072', '5304', 'OENINO'),
('5304080', '5304', 'AMANUBAN TIMUR'),
('5304081', '5304', 'FAUTMOLO'),
('5304082', '5304', 'FATUKOPA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5304090', '5304', 'KIE'),
('5304091', '5304', 'KOT\'OLIN'),
('5304100', '5304', 'AMANATUN SELATAN'),
('5304101', '5304', 'BOKING'),
('5304102', '5304', 'NUNKOLO'),
('5304103', '5304', 'NOEBANA'),
('5304104', '5304', 'SANTIAN'),
('5304110', '5304', 'AMANATUN UTARA'),
('5304111', '5304', 'TOIANAS'),
('5304112', '5304', 'KOKBAUN'),
('5305010', '5305', 'MIOMAFFO BARAT'),
('5305011', '5305', 'MIOMAFFO TENGAH'),
('5305012', '5305', 'MUSI'),
('5305013', '5305', 'MUTIS'),
('5305020', '5305', 'MIOMAFFO TIMUR'),
('5305021', '5305', 'NOEMUTI'),
('5305022', '5305', 'BIKOMI SELATAN'),
('5305023', '5305', 'BIKOMI TENGAH'),
('5305024', '5305', 'BIKOMI NILULAT'),
('5305025', '5305', 'BIKOMI UTARA'),
('5305026', '5305', 'NAIBENU'),
('5305027', '5305', 'NOEMUTI TIMUR'),
('5305030', '5305', 'KOTA KEFAMENANU'),
('5305040', '5305', 'INSANA'),
('5305041', '5305', 'INSANA UTARA'),
('5305042', '5305', 'INSANA BARAT'),
('5305043', '5305', 'INSANA TENGAH'),
('5305044', '5305', 'INSANA FAFINESU'),
('5305050', '5305', 'BIBOKI SELATAN'),
('5305051', '5305', 'BIBOKI TANPAH'),
('5305052', '5305', 'BIBOKI MOENLEU'),
('5305060', '5305', 'BIBOKI UTARA'),
('5305061', '5305', 'BIBOKI ANLEU'),
('5305062', '5305', 'BIBOKI FEOTLEU'),
('5306032', '5306', 'RAI MANUK'),
('5306050', '5306', 'TASIFETO BARAT'),
('5306051', '5306', 'KAKULUK MESAK'),
('5306052', '5306', 'NANAET DUBESI'),
('5306060', '5306', 'ATAMBUA'),
('5306061', '5306', 'ATAMBUA BARAT'),
('5306062', '5306', 'ATAMBUA SELATAN'),
('5306070', '5306', 'TASIFETO TIMUR'),
('5306071', '5306', 'RAIHAT'),
('5306072', '5306', 'LASIOLAT'),
('5306080', '5306', 'LAMAKNEN'),
('5306081', '5306', 'LAMAKNEN SELATAN'),
('5307010', '5307', 'PANTAR'),
('5307011', '5307', 'PANTAR BARAT'),
('5307012', '5307', 'PANTAR TIMUR'),
('5307013', '5307', 'PANTAR BARAT LAUT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5307014', '5307', 'PANTAR TENGAH'),
('5307020', '5307', 'ALOR BARAT DAYA'),
('5307021', '5307', 'MATARU'),
('5307030', '5307', 'ALOR SELATAN'),
('5307040', '5307', 'ALOR TIMUR'),
('5307041', '5307', 'ALOR TIMUR LAUT'),
('5307042', '5307', 'PUREMAN'),
('5307050', '5307', 'TELUK MUTIARA'),
('5307051', '5307', 'KABOLA'),
('5307060', '5307', 'ALOR BARAT LAUT'),
('5307061', '5307', 'ALOR TENGAH UTARA'),
('5307062', '5307', 'PULAU PURA'),
('5307063', '5307', 'LEMBUR'),
('5308010', '5308', 'NAGAWUTUNG'),
('5308011', '5308', 'WULANDONI'),
('5308020', '5308', 'ATADEI'),
('5308030', '5308', 'ILE APE'),
('5308031', '5308', 'ILE APE TIMUR'),
('5308040', '5308', 'LEBATUKAN'),
('5308050', '5308', 'NUBATUKAN'),
('5308060', '5308', 'OMESURI'),
('5308070', '5308', 'BUYASARI'),
('5309010', '5309', 'WULANGGITANG'),
('5309011', '5309', 'TITEHENA'),
('5309012', '5309', 'ILEBURA'),
('5309020', '5309', 'TANJUNG BUNGA'),
('5309021', '5309', 'LEWO LEMA'),
('5309030', '5309', 'LARANTUKA'),
('5309031', '5309', 'ILE MANDIRI'),
('5309032', '5309', '<NAME>'),
('5309040', '5309', 'SOLOR BARAT'),
('5309041', '5309', 'SOLOR SELATAN'),
('5309050', '5309', 'SOLOR TIMUR'),
('5309060', '5309', 'ADONARA BARAT'),
('5309061', '5309', 'WOTAN ULU MADO'),
('5309062', '5309', 'ADONARA TENGAH'),
('5309070', '5309', '<NAME>'),
('5309071', '5309', 'ILE BOLENG'),
('5309072', '5309', 'WITIHAMA'),
('5309073', '5309', 'KELUBAGOLIT'),
('5309074', '5309', 'ADONARA'),
('5310010', '5310', 'PAGA'),
('5310011', '5310', 'MEGO'),
('5310012', '5310', 'TANA WAWO'),
('5310020', '5310', 'LELA'),
('5310030', '5310', 'BOLA'),
('5310031', '5310', 'DORENG'),
('5310032', '5310', 'MAPITARA'),
('5310040', '5310', 'TALIBURA'),
('5310041', '5310', 'WAIGETE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5310042', '5310', 'WAIBLAMA'),
('5310050', '5310', 'KEWAPANTE'),
('5310051', '5310', 'HEWOKLOANG'),
('5310052', '5310', 'KANGAE'),
('5310061', '5310', 'PALUE'),
('5310062', '5310', 'KOTING'),
('5310063', '5310', 'NELLE'),
('5310070', '5310', 'NITA'),
('5310071', '5310', 'MAGEPANDA'),
('5310080', '5310', 'ALOK'),
('5310081', '5310', 'ALOK BARAT'),
('5310082', '5310', 'ALOK TIMUR'),
('5311010', '5311', 'NANGAPANDA'),
('5311011', '5311', 'PULAU ENDE'),
('5311012', '5311', 'MAUKARO'),
('5311020', '5311', 'ENDE'),
('5311030', '5311', 'ENDE SELATAN'),
('5311031', '5311', 'ENDE TIMUR'),
('5311032', '5311', 'ENDE TENGAH'),
('5311033', '5311', 'ENDE UTARA'),
('5311040', '5311', 'NDONA'),
('5311041', '5311', 'NDONA TIMUR'),
('5311050', '5311', 'WOLOWARU'),
('5311051', '5311', 'WOLOJITA'),
('5311052', '5311', 'LIO TIMUR'),
('5311053', '5311', 'KELIMUTU'),
('5311054', '5311', 'NDORI'),
('5311060', '5311', 'MAUROLE'),
('5311061', '5311', 'KOTABARU'),
('5311062', '5311', 'DETUKELI'),
('5311063', '5311', 'LEPEMBUSU KELISOKE'),
('5311070', '5311', 'DETUSOKO'),
('5311071', '5311', 'WEWARIA'),
('5312010', '5312', 'AIMERE'),
('5312011', '5312', 'JEREBUU'),
('5312012', '5312', 'INERIE'),
('5312020', '5312', 'BAJAWA'),
('5312030', '5312', 'GOLEWA'),
('5312031', '5312', 'GOLEWA SELATAN'),
('5312032', '5312', 'GOLEWA BARAT'),
('5312070', '5312', 'BAJAWA UTARA'),
('5312071', '5312', 'SOA'),
('5312080', '5312', 'RIUNG'),
('5312081', '5312', 'RIUNG BARAT'),
('5312082', '5312', 'WOLOMEZE'),
('5313040', '5313', 'SATAR MESE'),
('5313041', '5313', 'SATAR MESE BARAT'),
('5313110', '5313', '<NAME>ONG'),
('5313120', '5313', 'RUTENG'),
('5313121', '5313', 'WAE RII');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5313122', '5313', 'LELAK'),
('5313123', '5313', 'RAHONG UTARA'),
('5313130', '5313', 'CIBAL'),
('5313131', '5313', 'CIBAL BARAT'),
('5313140', '5313', 'REOK'),
('5313141', '5313', 'REOK BARAT'),
('5314010', '5314', 'ROTE BARAT DAYA'),
('5314020', '5314', 'ROTE BARAT LAUT'),
('5314030', '5314', 'LOBALAIN'),
('5314040', '5314', 'ROTE TENGAH'),
('5314041', '5314', 'ROTE SELATAN'),
('5314050', '5314', 'PANTAI BARU'),
('5314060', '5314', 'ROTE TIMUR'),
('5314061', '5314', 'LANDU LEKO'),
('5314070', '5314', 'ROTE BARAT'),
('5314071', '5314', 'NDAO NUSE'),
('5315010', '5315', 'KOMODO'),
('5315011', '5315', 'BOLENG'),
('5315020', '5315', 'SANO NGGOANG'),
('5315021', '5315', 'MBELILING'),
('5315030', '5315', 'LEMBOR'),
('5315031', '5315', 'WELAK'),
('5315032', '5315', 'LEMBOR SELATAN'),
('5315040', '5315', 'KUWUS'),
('5315041', '5315', 'NDOSO'),
('5315050', '5315', 'MACANG PACAR'),
('5316010', '5316', 'KATIKUTANA'),
('5316011', '5316', 'KATIKUTANA SELATAN'),
('5316020', '5316', 'UMBU RATU NGGAY BARAT'),
('5316030', '5316', 'UMBU RATU NGGAY'),
('5316040', '5316', 'MAMBORO'),
('5317010', '5317', 'KODI BANGEDO'),
('5317011', '5317', 'KODI BALAGHAR'),
('5317020', '5317', 'KODI'),
('5317030', '5317', 'KODI UTARA'),
('5317040', '5317', 'WEWEWA SELATAN'),
('5317050', '5317', 'WEWEWA BARAT'),
('5317060', '5317', 'WEWEWA TIMUR'),
('5317061', '5317', 'WEWEWA TENGAH'),
('5317070', '5317', 'WEWEWA UTARA'),
('5317080', '5317', 'LOURA'),
('5317081', '5317', 'KOTA TAMBOLAKA'),
('5318010', '5318', 'MAUPONGGO'),
('5318020', '5318', 'KEO TENGAH'),
('5318030', '5318', 'NANGARORO'),
('5318040', '5318', 'BOAWAE'),
('5318050', '5318', 'AESESA SELATAN'),
('5318060', '5318', 'AESESA'),
('5318070', '5318', 'WOLOWAE'),
('5319010', '5319', 'BORONG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('5319011', '5319', 'RANA MESE'),
('5319020', '5319', 'KOTA KOMBA'),
('5319030', '5319', 'ELAR'),
('5319031', '5319', 'ELAR SELATAN'),
('5319040', '5319', 'SAMBI RAMPAS'),
('5319050', '5319', 'POCO RANAKA'),
('5319051', '5319', 'POCO RANAKA TIMUR'),
('5319060', '5319', 'LAMBA LEDA'),
('5320010', '5320', 'RAIJUA'),
('5320020', '5320', 'HAWU MEHARA'),
('5320030', '5320', 'SABU LIAE'),
('5320040', '5320', 'SABU BARAT'),
('5320050', '5320', 'SABU TENGAH'),
('5320060', '5320', 'SABU TIMUR'),
('5321010', '5321', 'WEWIKU'),
('5321020', '5321', 'MALAKA BARAT'),
('5321030', '5321', 'WELIMAN'),
('5321040', '5321', 'RINHAT'),
('5321050', '5321', 'IO KUFEU'),
('5321060', '5321', 'SASITA MEAN'),
('5321070', '5321', 'MALAKA TENGAH'),
('5321080', '5321', '<NAME>'),
('5321090', '5321', 'LAEN MANEN'),
('5321100', '5321', 'MALAKA TIMUR'),
('5321110', '5321', 'KOBALIMA'),
('5321120', '5321', 'KOBALIMA TIMUR'),
('5371010', '5371', 'ALAK'),
('5371020', '5371', 'MAULAFA'),
('5371030', '5371', 'OEBOBO'),
('5371031', '5371', 'KOTA RAJA'),
('5371040', '5371', 'KELAPA LIMA'),
('5371041', '5371', 'KOTA LAMA'),
('6101010', '6101', 'SELAKAU'),
('6101011', '6101', 'SELAKAU TIMUR'),
('6101020', '6101', 'PEMANGKAT'),
('6101021', '6101', 'SEMPARUK'),
('6101022', '6101', 'SALATIGA'),
('6101030', '6101', 'TEBAS'),
('6101031', '6101', 'TEKARANG'),
('6101040', '6101', 'SAMBAS'),
('6101041', '6101', 'SUBAH'),
('6101042', '6101', 'SEBAWI'),
('6101043', '6101', 'SAJAD'),
('6101050', '6101', 'JAWAI'),
('6101051', '6101', 'JAWAI SELATAN'),
('6101060', '6101', 'TELUK KERAMAT'),
('6101061', '6101', 'GALING'),
('6101062', '6101', 'TANGARAN'),
('6101070', '6101', 'SEJANGKUNG'),
('6101080', '6101', 'SAJINGAN BESAR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6101090', '6101', 'PALOH'),
('6102010', '6102', 'SUNGAI RAYA'),
('6102011', '6102', 'CAPKALA'),
('6102012', '6102', 'SUNGAI RAYA KEPULAUAN'),
('6102030', '6102', 'SAMALANTAN'),
('6102031', '6102', 'MONTERADO'),
('6102032', '6102', 'LEMBAH BAWANG'),
('6102040', '6102', 'BENGKAYANG'),
('6102041', '6102', 'TERIAK'),
('6102042', '6102', 'SUNGAI BETUNG'),
('6102050', '6102', 'LEDO'),
('6102051', '6102', 'SUTI SEMARANG'),
('6102052', '6102', 'LUMAR'),
('6102060', '6102', 'SANGGAU LEDO'),
('6102061', '6102', 'TUJUHBELAS'),
('6102070', '6102', 'SELUAS'),
('6102080', '6102', '<NAME>'),
('6102081', '6102', 'SIDING'),
('6103020', '6103', 'SEBANGKI'),
('6103030', '6103', 'NGABANG'),
('6103031', '6103', 'JELIMPO'),
('6103040', '6103', 'SENGAH TEMILA'),
('6103050', '6103', 'MANDOR'),
('6103060', '6103', 'MENJALIN'),
('6103070', '6103', 'MEMPAWAH HULU'),
('6103071', '6103', 'SOMPAK'),
('6103080', '6103', 'MENYUKE'),
('6103081', '6103', 'BANYUKE HULU'),
('6103090', '6103', 'MERANTI'),
('6103100', '6103', 'KUALA BEHE'),
('6103110', '6103', 'AIR BESAR'),
('6104080', '6104', 'SIANTAN'),
('6104081', '6104', 'SEGEDONG'),
('6104090', '6104', 'SUNGAI PINYUH'),
('6104091', '6104', 'ANJONGAN'),
('6104100', '6104', 'MEMPAWAH HILIR'),
('6104101', '6104', 'MEMPAWAH TIMUR'),
('6104110', '6104', 'SUNGAI KUNYIT'),
('6104120', '6104', 'TOHO'),
('6104121', '6104', 'SADANIANG'),
('6105010', '6105', 'TOBA'),
('6105020', '6105', 'MELIAU'),
('6105060', '6105', 'KAPUAS'),
('6105070', '6105', 'MUKOK'),
('6105120', '6105', 'JANGKANG'),
('6105130', '6105', 'BONTI'),
('6105140', '6105', 'PARINDU'),
('6105150', '6105', 'TAYAN HILIR'),
('6105160', '6105', 'BALAI'),
('6105170', '6105', 'TAYAN HULU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6105180', '6105', 'KEMBAYAN'),
('6105190', '6105', 'BEDUWAI'),
('6105200', '6105', 'NOYAN'),
('6105210', '6105', 'SEKAYAM'),
('6105220', '6105', 'ENTIKONG'),
('6106010', '6106', 'KENDAWANGAN'),
('6106020', '6106', '<NAME>'),
('6106030', '6106', 'MARAU'),
('6106031', '6106', 'SINGKUP'),
('6106032', '6106', 'AIR UPAS'),
('6106040', '6106', 'JELAI HULU'),
('6106050', '6106', 'TUMBANG TITI'),
('6106051', '6106', 'PEMAHAN'),
('6106052', '6106', 'SUNGAI MELAYU RAYAK'),
('6106060', '6106', '<NAME>'),
('6106061', '6106', '<NAME>'),
('6106070', '6106', '<NAME>'),
('6106071', '6106', 'DELTA PAWAN'),
('6106072', '6106', 'MUARA PAWAN'),
('6106090', '6106', 'NANGA TAYAP'),
('6106100', '6106', 'SANDAI'),
('6106101', '6106', 'HULU SUNGAI'),
('6106110', '6106', 'SUNGAI LAUR'),
('6106120', '6106', 'SIMPANG HULU'),
('6106121', '6106', 'SIMPANG DUA'),
('6107060', '6107', 'SERAWAI'),
('6107070', '6107', 'AMBALAU'),
('6107080', '6107', 'KAYAN HULU'),
('6107110', '6107', 'SEPAUK'),
('6107120', '6107', 'TEMPUNAK'),
('6107130', '6107', 'SUNGAI TEBELIAN'),
('6107140', '6107', 'SINTANG'),
('6107150', '6107', 'DEDAI'),
('6107160', '6107', 'KAYAN HILIR'),
('6107170', '6107', 'KELAM PERMAI'),
('6107180', '6107', 'BINJAI HULU'),
('6107190', '6107', 'KETUNGAU HILIR'),
('6107200', '6107', 'KETUNGAU TENGAH'),
('6107210', '6107', 'KETUNGAU HULU'),
('6108010', '6108', 'SILAT HILIR'),
('6108020', '6108', 'SILAT HULU'),
('6108030', '6108', 'HULU GURUNG'),
('6108040', '6108', 'BUNUT HULU'),
('6108050', '6108', 'MENTEBAH'),
('6108060', '6108', 'BIKA'),
('6108070', '6108', 'KALIS'),
('6108080', '6108', 'PUTUSSIBAU SELATAN'),
('6108090', '6108', 'EMBALOH HILIR'),
('6108100', '6108', 'BUNUT HILIR'),
('6108110', '6108', 'BOYAN TANJUNG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6108120', '6108', 'PENGKADAN'),
('6108130', '6108', 'JONGKONG'),
('6108140', '6108', 'SELIMBAU'),
('6108150', '6108', 'SUHAID'),
('6108160', '6108', 'SEBERUANG'),
('6108170', '6108', 'SEMITAU'),
('6108180', '6108', 'EMPANANG'),
('6108190', '6108', 'PURING KENCANA'),
('6108200', '6108', 'BADAU'),
('6108210', '6108', 'BATANG LUPAR'),
('6108220', '6108', 'EMBALOH HULU'),
('6108230', '6108', 'PUTUSSIBAU UTARA'),
('6109010', '6109', 'NANGA MAHAP'),
('6109020', '6109', 'NANGA TAMAN'),
('6109030', '6109', 'SEKADAU HULU'),
('6109040', '6109', 'SEKADAU HILIR'),
('6109050', '6109', 'BELITANG HILIR'),
('6109060', '6109', 'BELITANG'),
('6109070', '6109', 'BELITANG HULU'),
('6110010', '6110', 'SOKAN'),
('6110020', '6110', 'TANAH PINOH'),
('6110021', '6110', 'TANAH PINOH BARAT'),
('6110030', '6110', 'SAYAN'),
('6110040', '6110', 'BELIMBING'),
('6110041', '6110', 'BELIMBING HULU'),
('6110050', '6110', 'NANGA PINOH'),
('6110051', '6110', 'PINOH SELATAN'),
('6110052', '6110', 'PINOH UTARA'),
('6110060', '6110', 'ELLA HILIR'),
('6110070', '6110', 'MENUKUNG'),
('6111010', '6111', 'PULAU MAYA'),
('6111011', '6111', 'KEPULAUAN KARIMATA'),
('6111020', '6111', 'SUKADANA'),
('6111030', '6111', 'SIMPANG HILIR'),
('6111040', '6111', 'TELUK BATANG'),
('6111050', '6111', 'SEPONTI'),
('6112010', '6112', 'BATU AMPAR'),
('6112020', '6112', 'TERENTANG'),
('6112030', '6112', 'KUBU'),
('6112040', '6112', 'TELOK PA\'KEDAI'),
('6112050', '6112', 'SUNGAI KAKAP'),
('6112060', '6112', 'RASAU JAYA'),
('6112070', '6112', 'SUNGAI RAYA'),
('6112080', '6112', 'SUNGAI AMBAWANG'),
('6112090', '6112', 'KUALA MANDOR-B'),
('6171010', '6171', 'PONTIANAK SELATAN'),
('6171011', '6171', 'PONTIANAK TENGGARA'),
('6171020', '6171', 'PONTIANAK TIMUR'),
('6171030', '6171', 'PONTIANAK BARAT'),
('6171031', '6171', 'PONTIANAK KOTA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6171040', '6171', 'PONTIANAK UTARA'),
('6172010', '6172', 'SINGKAWANG SELATAN'),
('6172020', '6172', 'SINGKAWANG TIMUR'),
('6172030', '6172', 'SINGKAWANG UTARA'),
('6172040', '6172', 'SINGKAWANG BARAT'),
('6172050', '6172', 'SINGKAWANG TENGAH'),
('6201040', '6201', 'KOTAWARINGIN LAMA'),
('6201050', '6201', 'ARUT SELATAN'),
('6201060', '6201', 'KUMAI'),
('6201061', '6201', 'PANGKALAN BANTENG'),
('6201062', '6201', 'PANGKALAN LADA'),
('6201070', '6201', 'ARUT UTARA'),
('6202020', '6202', 'MENTAYA HILIR SELATAN'),
('6202021', '6202', 'TELUK SAMPIT'),
('6202050', '6202', 'PULAU HANAUT'),
('6202060', '6202', 'MENTAWA BARU/KETAPANG'),
('6202061', '6202', 'SERANAU'),
('6202070', '6202', 'MENTAYA HILIR UTARA'),
('6202110', '6202', 'KOTA BESI'),
('6202111', '6202', 'TELAWANG'),
('6202120', '6202', 'BAAMANG'),
('6202190', '6202', 'CEMPAGA'),
('6202191', '6202', 'CEMPAGA HULU'),
('6202200', '6202', 'PARENGGEAN'),
('6202201', '6202', 'TUALAN HULU'),
('6202210', '6202', 'MENTAYA HULU'),
('6202211', '6202', 'BUKIT SANTUAI'),
('6202230', '6202', 'ANTANG KALANG'),
('6202231', '6202', 'TELAGA ANTANG'),
('6203020', '6203', 'KAPUAS KUALA'),
('6203021', '6203', 'TAMBAN CATUR'),
('6203030', '6203', 'KAPUAS TIMUR'),
('6203040', '6203', 'SELAT'),
('6203041', '6203', 'BATAGUH'),
('6203070', '6203', 'BASARANG'),
('6203080', '6203', 'KAPUAS HILIR'),
('6203090', '6203', 'PULAU PETAK'),
('6203100', '6203', 'KAPUAS MURUNG'),
('6203101', '6203', 'DADAHUP'),
('6203110', '6203', 'KAPUAS BARAT'),
('6203150', '6203', 'MANTANGAI'),
('6203160', '6203', 'TIMPAH'),
('6203170', '6203', 'KAPUAS TENGAH'),
('6203171', '6203', 'PASAK TALAWANG'),
('6203180', '6203', 'KAPUAS HULU'),
('6203181', '6203', 'MANDAU TALAWANG'),
('6204010', '6204', 'JENAMAS'),
('6204020', '6204', 'DUSUN HILIR'),
('6204030', '6204', 'KARAU KUALA'),
('6204040', '6204', 'DUSUN SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6204050', '6204', 'DUSUN UTARA'),
('6204060', '6204', 'GUNUNG BINTANG AWAI'),
('6205010', '6205', 'MONTALLAT'),
('6205020', '6205', 'GUNUNG TIMANG'),
('6205030', '6205', 'GUNUNG PUREI'),
('6205040', '6205', 'TEWEH TIMUR'),
('6205050', '6205', 'TEWEH TENGAH'),
('6205051', '6205', 'TEWEH BARU'),
('6205052', '6205', 'TEWEH SELATAN'),
('6205060', '6205', 'LAHEI'),
('6205061', '6205', 'LAHEI BARAT'),
('6206010', '6206', 'JELAI'),
('6206011', '6206', 'PANTAI LUNCI'),
('6206020', '6206', 'SUKAMARA'),
('6206030', '6206', 'BALAI RIAM'),
('6206031', '6206', 'PERMATA KECUBUNG'),
('6207010', '6207', 'BULIK'),
('6207011', '6207', 'SEMATU JAYA'),
('6207012', '6207', 'MENTHOBI RAYA'),
('6207013', '6207', 'BULIK TIMUR'),
('6207020', '6207', 'LAMANDAU'),
('6207021', '6207', 'BELANTIKAN RAYA'),
('6207030', '6207', 'DELANG'),
('6207031', '6207', 'BATANGKAWA'),
('6208010', '6208', 'SERUYAN HILIR'),
('6208011', '6208', 'SERUYAN HILIR TIMUR'),
('6208020', '6208', 'DANAU SEMBULUH'),
('6208021', '6208', 'SERUYAN RAYA'),
('6208030', '6208', 'HANAU'),
('6208031', '6208', 'DANAU SELULUK'),
('6208040', '6208', 'SERUYAN TENGAH'),
('6208041', '6208', 'BATU AMPAR'),
('6208050', '6208', 'SERUYAN HULU'),
('6208051', '6208', 'SULING TAMBUN'),
('6209010', '6209', 'KATINGAN KUALA'),
('6209020', '6209', 'MENDAWAI'),
('6209030', '6209', 'KAMIPANG'),
('6209040', '6209', 'TASIK PAYAWAN'),
('6209050', '6209', 'KATINGAN HILIR'),
('6209060', '6209', 'TEWANG SANGALANG GARING'),
('6209070', '6209', 'PULAU MALAN'),
('6209080', '6209', 'KATINGAN TENGAH'),
('6209090', '6209', 'SANAMAN MANTIKEI'),
('6209091', '6209', 'PETAK MALAI'),
('6209100', '6209', 'MARIKIT'),
('6209110', '6209', 'KATINGAN HULU'),
('6209111', '6209', 'BUKIT RAYA'),
('6210010', '6210', 'KAHAYAN KUALA'),
('6210011', '6210', 'SEBANGAU KUALA'),
('6210020', '6210', 'PANDIH BATU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6210030', '6210', 'MALIKU'),
('6210040', '6210', 'KAHAYAN HILIR'),
('6210041', '6210', 'JABIREN RAYA'),
('6210050', '6210', 'KAHAYAN TENGAH'),
('6210060', '6210', '<NAME>'),
('6211010', '6211', 'MANUHING'),
('6211011', '6211', '<NAME>'),
('6211020', '6211', 'RUNGAN'),
('6211021', '6211', '<NAME>'),
('6211022', '6211', '<NAME>'),
('6211030', '6211', 'SEPANG'),
('6211031', '6211', '<NAME>'),
('6211040', '6211', 'KURUN'),
('6211050', '6211', 'TEWAH'),
('6211060', '6211', '<NAME>'),
('6211061', '6211', '<NAME>'),
('6211062', '6211', '<NAME>'),
('6212010', '6212', '<NAME>'),
('6212020', '6212', '<NAME>'),
('6212021', '6212', '<NAME>'),
('6212030', '6212', 'AWANG'),
('6212040', '6212', '<NAME>'),
('6212050', '6212', '<NAME>'),
('6212051', '6212', '<NAME>'),
('6212052', '6212', 'PAKU'),
('6212053', '6212', 'KARUSEN JANANG'),
('6212060', '6212', 'PEMATANG KARAU'),
('6213010', '6213', 'PERMATA INTAN'),
('6213011', '6213', 'SUNGAI BABUAT'),
('6213020', '6213', 'MURUNG'),
('6213030', '6213', 'LAUNG TUHUP'),
('6213031', '6213', 'BARITO TUHUP RAYA'),
('6213040', '6213', 'TANAH SIANG'),
('6213041', '6213', 'TANAH SIANG SELATAN'),
('6213050', '6213', 'SUMBER BARITO'),
('6213051', '6213', 'SERIBU RIAM'),
('6213052', '6213', 'UUT MURUNG'),
('6271010', '6271', 'PAHANDUT'),
('6271011', '6271', 'SABANGAU'),
('6271012', '6271', 'JEKAN RAYA'),
('6271020', '6271', 'BUKIT BATU'),
('6271021', '6271', 'RAKUMPIT'),
('6301010', '6301', 'PANYIPATAN'),
('6301020', '6301', 'TAKISUNG'),
('6301030', '6301', 'KURAU'),
('6301031', '6301', 'BUMI MAKMUR'),
('6301040', '6301', 'BATI - BATI'),
('6301050', '6301', 'TAMBANG ULANG'),
('6301060', '6301', 'PELAIHARI'),
('6301061', '6301', 'BAJUIN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6301070', '6301', 'BATU AMPAR'),
('6301080', '6301', 'JORONG'),
('6301090', '6301', 'KINTAP'),
('6302010', '6302', 'PULAU SEMBILAN'),
('6302020', '6302', 'PULAU LAUT BARAT'),
('6302021', '6302', 'PULAU LAUT TANJUNG SELAYAR'),
('6302030', '6302', 'PULAU LAUT SELATAN'),
('6302031', '6302', 'PULAU LAUT KEPULAUAN'),
('6302040', '6302', 'PULAU LAUT TIMUR'),
('6302050', '6302', 'PULAU SEBUKU'),
('6302060', '6302', 'PULAU LAUT UTARA'),
('6302061', '6302', 'PULAU LAUT TENGAH'),
('6302120', '6302', 'KELUMPANG SELATAN'),
('6302121', '6302', 'KELUMPANG HILIR'),
('6302130', '6302', 'KELUMPANG HULU'),
('6302140', '6302', 'HAMPANG'),
('6302150', '6302', 'SUNGAI DURIAN'),
('6302160', '6302', 'KELUMPANG TENGAH'),
('6302161', '6302', 'KELUMPANG BARAT'),
('6302170', '6302', 'KELUMPANG UTARA'),
('6302180', '6302', 'PAMUKAN SELATAN'),
('6302190', '6302', 'SAMPANAHAN'),
('6302200', '6302', 'PAMUKAN UTARA'),
('6302201', '6302', 'PAMUKAN BARAT'),
('6303010', '6303', 'ALUH - ALUH'),
('6303011', '6303', 'BERUNTUNG BARU'),
('6303020', '6303', 'GAMBUT'),
('6303030', '6303', 'KERTAK HANYAR'),
('6303031', '6303', 'TATAH MAKMUR'),
('6303040', '6303', 'SUNGAI TABUK'),
('6303050', '6303', 'MARTAPURA'),
('6303051', '6303', 'MARTAPURA TIMUR'),
('6303052', '6303', 'MARTAPURA BARAT'),
('6303060', '6303', 'ASTAMBUL'),
('6303070', '6303', 'KARANG INTAN'),
('6303080', '6303', 'ARANIO'),
('6303090', '6303', 'SUNGAI PINANG'),
('6303091', '6303', 'PARAMASAN'),
('6303100', '6303', 'PENGARON'),
('6303101', '6303', 'SAMBUNG MAKMUR'),
('6303110', '6303', 'MATARAMAN'),
('6303120', '6303', 'SIMPANG EMPAT'),
('6303121', '6303', 'TELAGA BAUNTUNG'),
('6304010', '6304', 'TABUNGANEN'),
('6304020', '6304', 'TAMBAN'),
('6304030', '6304', 'MEKAR SARI'),
('6304040', '6304', 'ANJIR PASAR'),
('6304050', '6304', 'ANJIR MUARA'),
('6304060', '6304', 'ALALAK'),
('6304070', '6304', 'MANDASTANA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6304071', '6304', 'JEJANGKIT'),
('6304080', '6304', 'BELAWANG'),
('6304090', '6304', 'WANARAYA'),
('6304100', '6304', 'BARAMBAI'),
('6304110', '6304', 'RANTAU BADAUH'),
('6304120', '6304', 'CERBON'),
('6304130', '6304', 'BAKUMPAI'),
('6304140', '6304', 'MARABAHAN'),
('6304150', '6304', 'TABUKAN'),
('6304160', '6304', 'KURIPAN'),
('6305010', '6305', 'BINUANG'),
('6305011', '6305', 'HATUNGUN'),
('6305020', '6305', 'TAPIN SELATAN'),
('6305021', '6305', 'SALAM BABARIS'),
('6305030', '6305', 'TAPIN TENGAH'),
('6305040', '6305', 'BUNGUR'),
('6305050', '6305', 'PIANI'),
('6305060', '6305', 'LOKPAIKAT'),
('6305070', '6305', 'TAPIN UTARA'),
('6305080', '6305', 'BAKARANGAN'),
('6305090', '6305', 'CANDI LARAS SELATAN'),
('6305100', '6305', 'CANDI LARAS UTARA'),
('6306010', '6306', 'PADANG BATUNG'),
('6306020', '6306', 'LOKSADO'),
('6306030', '6306', 'TELAGA LANGSAT'),
('6306040', '6306', 'ANGKINANG'),
('6306050', '6306', 'KANDANGAN'),
('6306060', '6306', 'SUNGAI RAYA'),
('6306070', '6306', 'SIMPUR'),
('6306080', '6306', 'KALUMPANG'),
('6306090', '6306', 'DAHA SELATAN'),
('6306091', '6306', 'DAHA BARAT'),
('6306100', '6306', 'DAHA UTARA'),
('6307010', '6307', 'HARUYAN'),
('6307020', '6307', 'BATU BENAWA'),
('6307030', '6307', 'HANTAKAN'),
('6307040', '6307', 'BATANG ALAI SELATAN'),
('6307041', '6307', 'BATANG ALAI TIMUR'),
('6307050', '6307', 'BARABAI'),
('6307060', '6307', 'LABUAN AMAS SELATAN'),
('6307070', '6307', 'LABUAN AMAS UTARA'),
('6307080', '6307', 'PANDAWAN'),
('6307090', '6307', 'BATANG ALAI UTARA'),
('6307091', '6307', 'LIMPASU'),
('6308010', '6308', 'DANAU PANGGANG'),
('6308011', '6308', 'PAMINGGIR'),
('6308020', '6308', 'BABIRIK'),
('6308030', '6308', 'SUNGAI PANDAN'),
('6308031', '6308', 'SUNGAI TABUKAN'),
('6308040', '6308', 'AMUNTAI SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6308050', '6308', 'AMUNTAI TENGAH'),
('6308060', '6308', 'BANJANG'),
('6308070', '6308', 'AMUNTAI UTARA'),
('6308071', '6308', 'HAUR GADING'),
('6309010', '6309', 'BANUA LAWAS'),
('6309020', '6309', 'PUGAAN'),
('6309030', '6309', 'KELUA'),
('6309040', '6309', 'MUARA HARUS'),
('6309050', '6309', 'TANTA'),
('6309060', '6309', 'TANJUNG'),
('6309070', '6309', 'MURUNG PUDAK'),
('6309080', '6309', 'HARUAI'),
('6309081', '6309', 'BINTANG ARA'),
('6309090', '6309', 'UPAU'),
('6309100', '6309', 'MUARA UYA'),
('6309110', '6309', 'JARO'),
('6310010', '6310', 'KUSAN HILIR'),
('6310020', '6310', 'SUNGAI LOBAN'),
('6310030', '6310', 'SATUI'),
('6310031', '6310', 'ANGSANA'),
('6310040', '6310', 'KUSAN HULU'),
('6310041', '6310', 'KURANJI'),
('6310050', '6310', 'BATU LICIN'),
('6310051', '6310', 'KARANG BINTANG'),
('6310052', '6310', 'SIMPANG EMPAT'),
('6310053', '6310', 'MANTEWE'),
('6311010', '6311', 'LAMPIHONG'),
('6311020', '6311', 'BATU MANDI'),
('6311030', '6311', 'AWAYAN'),
('6311031', '6311', 'TEBING TINGGI'),
('6311040', '6311', 'PARINGIN'),
('6311041', '6311', 'PARINGIN SELATAN'),
('6311050', '6311', 'JUAI'),
('6311060', '6311', 'HALONG'),
('6371010', '6371', 'BANJARMASIN SELATAN'),
('6371020', '6371', 'BANJARMASIN TIMUR'),
('6371030', '6371', 'BANJARMASIN BARAT'),
('6371031', '6371', 'BANJARMASIN TENGAH'),
('6371040', '6371', 'BANJARMASIN UTARA'),
('6372010', '6372', 'LANDASAN ULIN'),
('6372011', '6372', 'LIANG ANGGANG'),
('6372020', '6372', 'CEMPAKA'),
('6372031', '6372', 'BANJAR BARU UTARA'),
('6372032', '6372', 'BANJAR BARU SELATAN'),
('6401010', '6401', 'BATU SOPANG'),
('6401011', '6401', 'MUARA SAMU'),
('6401021', '6401', 'BATU ENGAU'),
('6401022', '6401', 'TANJUNG HARAPAN'),
('6401030', '6401', 'PASIR BELENGKONG'),
('6401040', '6401', 'TANAH GROGOT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6401050', '6401', 'KUARO'),
('6401060', '6401', 'LONG IKIS'),
('6401070', '6401', 'MUARA KOMAM'),
('6401080', '6401', 'LONG KALI'),
('6402010', '6402', 'BONGAN'),
('6402020', '6402', 'JEMPANG'),
('6402030', '6402', 'PENYINGGAHAN'),
('6402040', '6402', 'MUARA PAHU'),
('6402041', '6402', 'SILUQ NGURAI'),
('6402050', '6402', 'MUARA LAWA'),
('6402051', '6402', 'BENTIAN BESAR'),
('6402060', '6402', 'DAMAI'),
('6402061', '6402', 'NYUATAN'),
('6402070', '6402', 'BARONG TONGKOK'),
('6402071', '6402', 'LINGGANG BIGUNG'),
('6402080', '6402', 'MELAK'),
('6402081', '6402', 'SEKOLAQ DARAT'),
('6402082', '6402', 'MANOR BULATN'),
('6402090', '6402', 'LONG IRAM'),
('6402091', '6402', 'TERING'),
('6403010', '6403', 'SEMBOJA'),
('6403020', '6403', 'MUARA JAWA'),
('6403030', '6403', 'SANGA-SANGA'),
('6403040', '6403', 'LOA JANAN'),
('6403050', '6403', 'LOA KULU'),
('6403060', '6403', 'MUARA MUNTAI'),
('6403070', '6403', 'MUARA WIS'),
('6403080', '6403', 'KOTABANGUN'),
('6403090', '6403', 'TENGGARONG'),
('6403100', '6403', 'SEBULU'),
('6403110', '6403', 'TENGGARONG SEBERANG'),
('6403120', '6403', 'ANGGANA'),
('6403130', '6403', 'MUARA BADAK'),
('6403140', '6403', 'MARANG KAYU'),
('6403150', '6403', 'MUARA KAMAN'),
('6403160', '6403', 'KENOHAN'),
('6403170', '6403', 'KEMBANG JANGGUT'),
('6403180', '6403', 'TABANG'),
('6404010', '6404', 'MUARA ANCALONG'),
('6404011', '6404', 'BUSANG'),
('6404012', '6404', 'LONG MESANGAT'),
('6404020', '6404', 'MUARA WAHAU'),
('6404021', '6404', 'TELEN'),
('6404022', '6404', 'KONGBENG'),
('6404030', '6404', 'MUARA BENGKAL'),
('6404031', '6404', 'BATU AMPAR'),
('6404040', '6404', 'SANGATTA UTARA'),
('6404041', '6404', 'BENGALON'),
('6404042', '6404', 'TELUK PANDAN'),
('6404043', '6404', 'SANGATTA SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6404044', '6404', 'RANTAU PULUNG'),
('6404050', '6404', 'SANGKULIRANG'),
('6404051', '6404', 'KALIORANG'),
('6404052', '6404', 'SANDARAN'),
('6404053', '6404', 'KAUBUN'),
('6404054', '6404', 'KARANGAN'),
('6405010', '6405', 'KELAY'),
('6405020', '6405', 'TALISAYAN'),
('6405021', '6405', 'TABALAR'),
('6405030', '6405', 'BIDUK BIDUK'),
('6405040', '6405', 'PULAU DERAWAN'),
('6405041', '6405', 'MARATUA'),
('6405050', '6405', 'SAMBALIUNG'),
('6405060', '6405', 'TANJUNG REDEB'),
('6405070', '6405', 'GUNUNG TABUR'),
('6405080', '6405', 'SEGAH'),
('6405090', '6405', 'TELUK BAYUR'),
('6405100', '6405', 'BATU PUTIH'),
('6405110', '6405', 'BIATAN'),
('6409010', '6409', 'BABULU'),
('6409020', '6409', 'WARU'),
('6409030', '6409', 'PENAJAM'),
('6409040', '6409', 'SEPAKU'),
('6411010', '6411', 'LAHAM'),
('6411020', '6411', 'LONG HUBUNG'),
('6411030', '6411', 'LONG BAGUN'),
('6411040', '6411', 'LONG PAHANGAI'),
('6411050', '6411', 'LONG APARI'),
('6471010', '6471', 'BALIKPAPAN SELATAN'),
('6471011', '6471', 'BALIKPAPAN KOTA'),
('6471020', '6471', 'BALIKPAPAN TIMUR'),
('6471030', '6471', 'BALIKPAPAN UTARA'),
('6471040', '6471', 'BALIKPAPAN TENGAH'),
('6471050', '6471', 'BALIKPAPAN BARAT'),
('6472010', '6472', 'PALARAN'),
('6472020', '6472', 'SAMARINDA ILIR'),
('6472021', '6472', 'SAMARINDA KOTA'),
('6472022', '6472', 'SAMBUTAN'),
('6472030', '6472', 'SAMARINDA SEBERANG'),
('6472031', '6472', 'LOA JANAN ILIR'),
('6472040', '6472', 'SUNGAI KUNJANG'),
('6472050', '6472', 'SAMARINDA ULU'),
('6472060', '6472', 'SAMARINDA UTARA'),
('6472061', '6472', 'SUNGAI PINANG'),
('6474010', '6474', 'BONTANG SELATAN'),
('6474020', '6474', 'BONTANG UTARA'),
('6474030', '6474', 'BONTANG BARAT'),
('6501010', '6501', 'SUNGAI BOH'),
('6501020', '6501', 'KAYAN SELATAN'),
('6501030', '6501', 'KAYAN HULU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('6501040', '6501', 'KAYAN HILIR'),
('6501050', '6501', 'PUJUNGAN'),
('6501060', '6501', 'BAHAU HULU'),
('6501070', '6501', 'SUNGAI TUBU'),
('6501080', '6501', 'MALINAU SELATAN HULU'),
('6501090', '6501', 'MALINAU SELATAN'),
('6501100', '6501', 'MALINAU SELATAN HILIR'),
('6501110', '6501', 'MENTARANG'),
('6501120', '6501', 'MENTARANG HULU'),
('6501130', '6501', 'MALINAU UTARA'),
('6501140', '6501', 'MALINAU BARAT'),
('6501150', '6501', 'MALINAU KOTA'),
('6502010', '6502', 'PESO'),
('6502020', '6502', '<NAME>'),
('6502030', '6502', 'TANJUNG PALAS BARAT'),
('6502040', '6502', 'TANJUNG PALAS'),
('6502050', '6502', 'TANJUNG SELOR'),
('6502060', '6502', 'TANJUNG PALAS TIMUR'),
('6502070', '6502', 'TANJUNG PALAS TENGAH'),
('6502080', '6502', 'TANJUNG PALAS UTARA'),
('6502090', '6502', 'SEKATAK'),
('6502100', '6502', 'BUNYU'),
('6503010', '6503', 'MURUK RIAN'),
('6503020', '6503', 'SESAYAP'),
('6503030', '6503', 'BETAYAU'),
('6503040', '6503', 'SESAYAP HILIR'),
('6503050', '6503', 'TANA LIA'),
('6504010', '6504', 'KRAYAN SELATAN'),
('6504020', '6504', 'KRAYAN'),
('6504030', '6504', 'LUMBIS OGONG'),
('6504040', '6504', 'LUMBIS'),
('6504050', '6504', 'SEMBAKUNG ATULAI'),
('6504060', '6504', 'SEMBAKUNG'),
('6504070', '6504', 'SEBUKU'),
('6504080', '6504', 'TULIN ONSOI'),
('6504090', '6504', 'SEI MENGGARIS'),
('6504100', '6504', 'NUNUKAN'),
('6504110', '6504', 'NUNUKAN SELATAN'),
('6504120', '6504', 'SEBATIK BARAT'),
('6504130', '6504', 'SEBATIK'),
('6504140', '6504', 'SEBATIK TIMUR'),
('6504150', '6504', 'SEBATIK TENGAH'),
('6504160', '6504', 'SEBATIK UTARA'),
('6571010', '6571', 'TARAKAN TIMUR'),
('6571020', '6571', 'TARAKAN TENGAH'),
('6571030', '6571', 'TARAKAN BARAT'),
('6571040', '6571', 'TARAKAN UTARA'),
('7101021', '7101', 'DUMOGA BARAT'),
('7101022', '7101', 'DUMOGA UTARA'),
('7101023', '7101', 'DUMOGA TIMUR');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7101024', '7101', 'DUMOGA TENGAH'),
('7101025', '7101', 'DUMOGA TENGGARA'),
('7101026', '7101', 'DUMOGA'),
('7101060', '7101', 'LOLAYAN'),
('7101081', '7101', 'PASSI BARAT'),
('7101082', '7101', 'PASSI TIMUR'),
('7101083', '7101', 'BILALANG'),
('7101090', '7101', 'POIGAR'),
('7101100', '7101', 'BOLAANG'),
('7101101', '7101', 'BOLAANG TIMUR'),
('7101110', '7101', 'LOLAK'),
('7101120', '7101', 'SANGTOMBOLANG'),
('7102091', '7102', 'LANGOWAN TIMUR'),
('7102092', '7102', 'LANGOWAN BARAT'),
('7102093', '7102', 'LANGOWAN SELATAN'),
('7102094', '7102', 'LANGOWAN UTARA'),
('7102110', '7102', 'TOMPASO'),
('7102111', '7102', 'TOMPASO BARAT'),
('7102120', '7102', 'KAWANGKOAN'),
('7102121', '7102', 'KAWANGKOAN BARAT'),
('7102122', '7102', 'KAWANGKOAN UTARA'),
('7102130', '7102', 'SONDER'),
('7102160', '7102', 'TOMBARIRI'),
('7102161', '7102', 'TOMBARIRI TIMUR'),
('7102170', '7102', 'PINELENG'),
('7102171', '7102', 'TOMBULU'),
('7102172', '7102', 'MANDOLANG'),
('7102190', '7102', 'TONDANO BARAT'),
('7102191', '7102', 'TONDANO SELATAN'),
('7102200', '7102', 'REMBOKEN'),
('7102210', '7102', 'KAKAS'),
('7102211', '7102', 'KAKAS BARAT'),
('7102220', '7102', 'LEMBEAN TIMUR'),
('7102230', '7102', 'ERIS'),
('7102240', '7102', 'KOMBI'),
('7102250', '7102', 'TONDANO TIMUR'),
('7102251', '7102', 'TONDANO UTARA'),
('7103040', '7103', 'MANGANITU SELATAN'),
('7103041', '7103', 'TATOARENG'),
('7103050', '7103', 'TAMAKO'),
('7103060', '7103', 'TABUKAN SELATAN'),
('7103061', '7103', 'TABUKAN SELATAN TENGAH'),
('7103062', '7103', 'TABUKAN SELATAN TENGGARA'),
('7103070', '7103', 'TABUKAN TENGAH'),
('7103080', '7103', 'MANGANITU'),
('7103090', '7103', 'TAHUNA'),
('7103091', '7103', 'TAHUNA TIMUR'),
('7103092', '7103', 'TAHUNA BARAT'),
('7103100', '7103', 'TABUKAN UTARA'),
('7103101', '7103', 'NUSA TABUKAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7103102', '7103', 'KEPULAUAN MARORE'),
('7103110', '7103', 'KENDAHE'),
('7104010', '7104', 'KABARUAN'),
('7104011', '7104', 'DAMAU'),
('7104020', '7104', 'LIRUNG'),
('7104021', '7104', 'SALIBABU'),
('7104022', '7104', 'KALONGAN'),
('7104023', '7104', 'MORONGE'),
('7104030', '7104', 'MELONGUANE'),
('7104031', '7104', 'MELONGUANE TIMUR'),
('7104040', '7104', 'BEO'),
('7104041', '7104', 'BEO UTARA'),
('7104042', '7104', 'BEO SELATAN'),
('7104050', '7104', 'RAINIS'),
('7104051', '7104', 'TAMPA NA\'MMA'),
('7104052', '7104', 'PULUTAN'),
('7104060', '7104', 'ESSANG'),
('7104061', '7104', 'ESSANG SELATAN'),
('7104070', '7104', 'GEMEH'),
('7104080', '7104', 'NANUSA'),
('7104081', '7104', 'MIANGAS'),
('7105010', '7105', 'MODOINDING'),
('7105020', '7105', 'TOMPASO BARU'),
('7105021', '7105', 'MAESAAN'),
('7105070', '7105', 'RANOYAPO'),
('7105080', '7105', 'MOTOLING'),
('7105081', '7105', 'KUMELEMBUAI'),
('7105082', '7105', 'MOTOLING BARAT'),
('7105083', '7105', 'MOTOLING TIMUR'),
('7105090', '7105', 'SINONSAYANG'),
('7105100', '7105', 'TENGA'),
('7105111', '7105', 'AMURANG'),
('7105112', '7105', 'AMURANG BARAT'),
('7105113', '7105', 'AMURANG TIMUR'),
('7105120', '7105', 'TARERAN'),
('7105121', '7105', 'SULTA'),
('7105130', '7105', 'TUMPAAN'),
('7105131', '7105', 'TATAPAAN'),
('7106010', '7106', 'KEMA'),
('7106020', '7106', 'KAUDITAN'),
('7106030', '7106', 'AIRMADIDI'),
('7106040', '7106', 'KALAWAT'),
('7106050', '7106', 'DIMEMBE'),
('7106051', '7106', 'TALAWAAN'),
('7106060', '7106', 'WORI'),
('7106070', '7106', 'LIKUPANG BARAT'),
('7106080', '7106', 'LIKUPANG TIMUR'),
('7106081', '7106', 'LIKUPANG SELATAN'),
('7107010', '7107', 'SANGKUB'),
('7107020', '7107', 'BINTAUNA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7107030', '7107', 'BOLANG ITANG TIMUR'),
('7107040', '7107', 'BOLANG ITANG BARAT'),
('7107050', '7107', 'KAIDIPANG'),
('7107060', '7107', 'PINOGALUMAN'),
('7108010', '7108', 'BIARO'),
('7108020', '7108', 'TAGULANDANG SELATAN'),
('7108030', '7108', 'TAGULANDANG'),
('7108040', '7108', 'TAGULANDANG UTARA'),
('7108050', '7108', 'SIAU BARAT SELATAN'),
('7108060', '7108', 'SIAU TIMUR SELATAN'),
('7108070', '7108', 'SIAU BARAT'),
('7108080', '7108', 'SIAU TENGAH'),
('7108090', '7108', 'SIAU TIMUR'),
('7108100', '7108', 'SIAU BARAT UTARA'),
('7109010', '7109', 'RATATOTOK'),
('7109020', '7109', 'PUSOMAEN'),
('7109030', '7109', 'BELANG'),
('7109040', '7109', 'RATAHAN'),
('7109041', '7109', 'PASAN'),
('7109042', '7109', 'RATAHAN TIMUR'),
('7109050', '7109', 'TOMBATU'),
('7109051', '7109', 'TOMBATU TIMUR'),
('7109052', '7109', 'TOMBATU UTARA'),
('7109060', '7109', 'TOULUAAN'),
('7109061', '7109', 'TOULUAAN SELATAN'),
('7109062', '7109', 'SILIAN RAYA'),
('7110010', '7110', 'POSIGADAN'),
('7110020', '7110', 'BOLANG UKI'),
('7110021', '7110', 'HELUMO'),
('7110030', '7110', 'PINOLOSIAN'),
('7110040', '7110', 'PINOLOSIAN TENGAH'),
('7110050', '7110', 'PINOLOSIAN TIMUR'),
('7111010', '7111', 'NUANGAN'),
('7111020', '7111', 'TUTUYAN'),
('7111030', '7111', 'KOTABUNAN'),
('7111040', '7111', 'MODAYAG'),
('7111050', '7111', 'MODAYAG BARAT'),
('7171010', '7171', 'MALALAYANG'),
('7171020', '7171', 'SARIO'),
('7171021', '7171', 'WANEA'),
('7171030', '7171', 'WENANG'),
('7171031', '7171', 'TIKALA'),
('7171032', '7171', 'PAAL DUA'),
('7171040', '7171', 'MAPANGET'),
('7171051', '7171', 'SINGKIL'),
('7171052', '7171', 'TUMINTING'),
('7171053', '7171', 'BUNAKEN'),
('7171054', '7171', 'BUNAKEN KEPULAUAN'),
('7172010', '7172', 'MADIDIR'),
('7172011', '7172', 'MATUARI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7172012', '7172', 'GIRIAN'),
('7172021', '7172', 'LEMBEH SELATAN'),
('7172022', '7172', 'LEMBEH UTARA'),
('7172030', '7172', 'AERTEMBAGA'),
('7172031', '7172', 'MAESA'),
('7172040', '7172', 'RANOWULU'),
('7173010', '7173', 'TOMOHON SELATAN'),
('7173020', '7173', 'TOMOHON TENGAH'),
('7173021', '7173', 'TOMOHON TIMUR'),
('7173022', '7173', 'TOMOHON BARAT'),
('7173030', '7173', 'TOMOHON UTARA'),
('7174010', '7174', 'KOTAMOBAGU SELATAN'),
('7174020', '7174', 'KOTAMOBAGU TIMUR'),
('7174030', '7174', 'KOTAMOBAGU BARAT'),
('7174040', '7174', 'KOTAMOBAGU UTARA'),
('7201030', '7201', 'TOTIKUM'),
('7201031', '7201', 'TOTIKUM SELATAN'),
('7201040', '7201', 'TINANGKUNG'),
('7201041', '7201', 'TINANGKUNG SELATAN'),
('7201042', '7201', 'TINANGKUNG UTARA'),
('7201050', '7201', 'LIANG'),
('7201051', '7201', 'PELING TENGAH'),
('7201060', '7201', 'BULAGI'),
('7201061', '7201', 'BULAGI SELATAN'),
('7201062', '7201', 'BULAGI UTARA'),
('7201070', '7201', 'BUKO'),
('7201071', '7201', 'BUKO SELATAN'),
('7202010', '7202', 'TOILI'),
('7202011', '7202', 'TOILI BARAT'),
('7202012', '7202', 'MOILONG'),
('7202020', '7202', 'BATUI'),
('7202021', '7202', 'BATUI SELATAN'),
('7202030', '7202', 'BUNTA'),
('7202031', '7202', 'NUHON'),
('7202032', '7202', 'SIMPANG RAYA'),
('7202040', '7202', 'KINTOM'),
('7202050', '7202', 'LUWUK'),
('7202051', '7202', 'LUWUK TIMUR'),
('7202052', '7202', 'LUWUK UTARA'),
('7202053', '7202', 'LUWUK SELATAN'),
('7202054', '7202', 'NAMBO'),
('7202060', '7202', 'PAGIMANA'),
('7202061', '7202', 'BUALEMO'),
('7202062', '7202', 'LOBU'),
('7202070', '7202', 'LAMALA'),
('7202071', '7202', 'MASAMA'),
('7202072', '7202', 'MANTOH'),
('7202080', '7202', 'BALANTAK'),
('7202081', '7202', 'BALANTAK SELATAN'),
('7202082', '7202', 'BALANTAK UTARA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7203010', '7203', 'MENUI KEPULAUAN'),
('7203020', '7203', 'BUNGKU SELATAN'),
('7203021', '7203', 'BAHODOPI'),
('7203022', '7203', 'BUNGKU PESISIR'),
('7203030', '7203', 'BUNGKU TENGAH'),
('7203031', '7203', 'BUNGKU TIMUR'),
('7203040', '7203', 'BUNGKU BARAT'),
('7203041', '7203', 'BUMI RAYA'),
('7203042', '7203', 'WITA PONDA'),
('7204010', '7204', 'PAMONA SELATAN'),
('7204011', '7204', 'PAMONA BARAT'),
('7204012', '7204', 'PAMONA TENGGARA'),
('7204020', '7204', 'LORE SELATAN'),
('7204021', '7204', 'LORE BARAT'),
('7204030', '7204', 'PAMONA PUSALEMBA'),
('7204031', '7204', 'PAMONA TIMUR'),
('7204032', '7204', 'PAMONA UTARA'),
('7204040', '7204', 'LORE UTARA'),
('7204041', '7204', 'LORE TENGAH'),
('7204042', '7204', 'LORE TIMUR'),
('7204043', '7204', 'LORE PEORE'),
('7204050', '7204', 'POSO PESISIR'),
('7204051', '7204', 'POSO PESISIR SELATAN'),
('7204052', '7204', 'POSO PESISIR UTARA'),
('7204060', '7204', 'LAGE'),
('7204070', '7204', 'POSO KOTA'),
('7204071', '7204', 'POSO KOTA UTARA'),
('7204072', '7204', 'POSO KOTA SELATAN'),
('7205041', '7205', 'RIO PAKAVA'),
('7205051', '7205', 'PINEMBANI'),
('7205080', '7205', 'BANAWA'),
('7205081', '7205', 'BANAWA SELATAN'),
('7205082', '7205', 'BANAWA TENGAH'),
('7205090', '7205', 'LABUAN'),
('7205091', '7205', 'TANANTOVEA'),
('7205100', '7205', 'SINDUE'),
('7205101', '7205', 'SINDUE TOMBUSABORA'),
('7205102', '7205', 'SINDUE TOBATA'),
('7205120', '7205', 'SIRENJA'),
('7205130', '7205', 'BALAESANG'),
('7205131', '7205', 'BALAESANG TANJUNG'),
('7205140', '7205', 'DAMPELAS'),
('7205160', '7205', 'SOJOL'),
('7205161', '7205', 'SOJOL UTARA'),
('7206010', '7206', 'DAMPAL SELATAN'),
('7206020', '7206', 'DAMPAL UTARA'),
('7206030', '7206', 'DONDO'),
('7206031', '7206', 'OGODEIDE'),
('7206032', '7206', 'BASIDONDO'),
('7206040', '7206', 'BAOLAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7206041', '7206', 'LAMPASIO'),
('7206050', '7206', 'GALANG'),
('7206060', '7206', 'TOLITOLI UTARA'),
('7206061', '7206', 'DAKO PAMEAN'),
('7207010', '7207', 'LAKEA'),
('7207011', '7207', 'BIAU'),
('7207012', '7207', 'KARAMAT'),
('7207020', '7207', 'MOMUNU'),
('7207021', '7207', 'TILOAN'),
('7207030', '7207', 'BOKAT'),
('7207031', '7207', 'BUKAL'),
('7207040', '7207', 'BUNOBOGU'),
('7207041', '7207', 'GADUNG'),
('7207050', '7207', 'PALELEH'),
('7207051', '7207', 'PALELEH BARAT'),
('7208010', '7208', 'SAUSU'),
('7208011', '7208', 'TORUE'),
('7208012', '7208', 'BALINGGI'),
('7208020', '7208', 'PARIGI'),
('7208021', '7208', 'PARIGI SELATAN'),
('7208022', '7208', 'PARIGI BARAT'),
('7208023', '7208', 'PARIGI UTARA'),
('7208024', '7208', 'PARIGI TENGAH'),
('7208030', '7208', 'AMPIBABO'),
('7208031', '7208', 'KASIMBAR'),
('7208032', '7208', 'TORIBULU'),
('7208033', '7208', 'SINIU'),
('7208040', '7208', 'TINOMBO'),
('7208041', '7208', 'TINOMBO SELATAN'),
('7208042', '7208', 'SIDOAN'),
('7208050', '7208', 'TOMINI'),
('7208051', '7208', 'MEPANGA'),
('7208052', '7208', 'PALASA'),
('7208060', '7208', 'MOUTONG'),
('7208061', '7208', 'BOLANO LAMBUNU'),
('7208062', '7208', 'TAOPA'),
('7208063', '7208', 'BOLANO'),
('7208064', '7208', 'ONGKA MALINO'),
('7209010', '7209', 'TOJO BARAT'),
('7209020', '7209', 'TOJO'),
('7209030', '7209', 'ULUBONGKA'),
('7209040', '7209', 'AMPANA TETE'),
('7209050', '7209', 'AMPANA KOTA'),
('7209051', '7209', 'RATOLINDO'),
('7209060', '7209', 'UNA - UNA'),
('7209061', '7209', 'BATUDAKA'),
('7209070', '7209', 'TOGEAN'),
('7209080', '7209', 'WALEA KEPULAUAN'),
('7209081', '7209', 'WALEA BESAR'),
('7209082', '7209', 'TALATAKO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7210010', '7210', 'PIPIKORO'),
('7210020', '7210', 'KULAWI SELATAN'),
('7210030', '7210', 'KULAWI'),
('7210040', '7210', 'LINDU'),
('7210050', '7210', 'NOKILALAKI'),
('7210060', '7210', 'PALOLO'),
('7210070', '7210', 'GUMBASA'),
('7210080', '7210', 'DOLO SELATAN'),
('7210090', '7210', 'DOLO BARAT'),
('7210100', '7210', 'TANAMBULAVA'),
('7210110', '7210', 'DOLO'),
('7210120', '7210', 'SIGI BIROMARU'),
('7210130', '7210', 'MARAWOLA'),
('7210140', '7210', 'MARAWOLA BARAT'),
('7210150', '7210', 'KINOVARO'),
('7211010', '7211', 'BANGKURUNG'),
('7211020', '7211', 'LABOBO'),
('7211030', '7211', 'BANGGAI UTARA'),
('7211040', '7211', 'BANGGAI'),
('7211050', '7211', 'BANGGAI TENGAH'),
('7211060', '7211', 'BANGGAI SELATAN'),
('7211070', '7211', 'BOKAN KEPULAUAN'),
('7212010', '7212', 'MORI ATAS'),
('7212020', '7212', 'LEMBO'),
('7212030', '7212', '<NAME>'),
('7212040', '7212', 'PETASIA TIMUR'),
('7212050', '7212', 'PETASIA'),
('7212060', '7212', 'PETASIA BARAT'),
('7212070', '7212', 'MORI UTARA'),
('7212080', '7212', 'SOYO JAYA'),
('7212090', '7212', 'BUNGKU UTARA'),
('7212100', '7212', 'MAMOSALATO'),
('7271010', '7271', 'PALU BARAT'),
('7271011', '7271', 'TATANGA'),
('7271012', '7271', 'ULUJADI'),
('7271020', '7271', 'PALU SELATAN'),
('7271030', '7271', 'PALU TIMUR'),
('7271031', '7271', 'MANTIKULORE'),
('7271040', '7271', 'PALU UTARA'),
('7271041', '7271', 'TAWAELI'),
('7301010', '7301', 'PASIMARANNU'),
('7301011', '7301', 'PASILAMBENA'),
('7301020', '7301', 'PASIMASSUNGGU'),
('7301021', '7301', 'TAKABONERATE'),
('7301022', '7301', '<NAME>'),
('7301030', '7301', 'BONTOSIKUYU'),
('7301040', '7301', 'BONTOHARU'),
('7301041', '7301', 'BENTENG'),
('7301042', '7301', 'BONTOMANAI'),
('7301050', '7301', 'BONTOMATENE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7301051', '7301', 'BUKI'),
('7302010', '7302', 'GANTARANG'),
('7302020', '7302', 'UJUNG BULU'),
('7302021', '7302', 'UJUNG LOE'),
('7302030', '7302', 'BONTO BAHARI'),
('7302040', '7302', 'BONTOTIRO'),
('7302050', '7302', 'HERO LANGE-LANGE'),
('7302060', '7302', 'KAJANG'),
('7302070', '7302', 'BULUKUMPA'),
('7302080', '7302', 'RILAU ALE'),
('7302090', '7302', 'KINDANG'),
('7303010', '7303', 'BISSAPPU'),
('7303011', '7303', 'ULUERE'),
('7303012', '7303', 'SINOA'),
('7303020', '7303', 'BANTAENG'),
('7303021', '7303', 'EREMERASA'),
('7303030', '7303', 'TOMPOBULU'),
('7303031', '7303', 'PA\'JUKUKANG'),
('7303032', '7303', 'GANTARANGKEKE'),
('7304010', '7304', 'BANGKALA'),
('7304011', '7304', 'BANGKALA BARAT'),
('7304020', '7304', 'TAMALATEA'),
('7304021', '7304', 'BONTORAMBA'),
('7304030', '7304', 'BINAMU'),
('7304031', '7304', 'TURATEA'),
('7304040', '7304', 'BATANG'),
('7304041', '7304', 'ARUNGKEKE'),
('7304042', '7304', 'TAROWANG'),
('7304050', '7304', 'KELARA'),
('7304051', '7304', 'RUMBIA'),
('7305010', '7305', 'MANGARA BOMBANG'),
('7305020', '7305', 'MAPPAKASUNGGU'),
('7305021', '7305', 'SANROBONE'),
('7305030', '7305', 'POLOMBANGKENG SELATAN'),
('7305031', '7305', 'PATTALLASSANG'),
('7305040', '7305', 'POLOMBANGKENG UTARA'),
('7305050', '7305', 'GALESONG SELATAN'),
('7305051', '7305', 'GALESONG'),
('7305060', '7305', 'GALESONG UTARA'),
('7306010', '7306', 'BONTONOMPO'),
('7306011', '7306', 'BONTONOMPO SELATAN'),
('7306020', '7306', 'BAJENG'),
('7306021', '7306', 'BAJENG BARAT'),
('7306030', '7306', 'PALLANGGA'),
('7306031', '7306', 'BAROMBONG'),
('7306040', '7306', 'SOMBA OPU'),
('7306050', '7306', 'BONTOMARANNU'),
('7306051', '7306', 'PATTALLASSANG'),
('7306060', '7306', 'PARANGLOE'),
('7306061', '7306', 'MANUJU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7306070', '7306', 'TINGGIMONCONG'),
('7306071', '7306', 'TOMBOLO PAO'),
('7306072', '7306', 'PARIGI'),
('7306080', '7306', 'BUNGAYA'),
('7306081', '7306', 'BONTOLEMPANGAN'),
('7306090', '7306', 'TOMPOBULU'),
('7306091', '7306', 'BIRINGBULU'),
('7307010', '7307', '<NAME>'),
('7307020', '7307', '<NAME>'),
('7307030', '7307', '<NAME>'),
('7307040', '7307', '<NAME>'),
('7307050', '7307', '<NAME>'),
('7307060', '7307', '<NAME>'),
('7307070', '7307', '<NAME>'),
('7307080', '7307', 'BULUPODDO'),
('7307090', '7307', 'PULAU SEMBILAN'),
('7308010', '7308', 'MANDAI'),
('7308011', '7308', 'MONCONGLOE'),
('7308020', '7308', '<NAME>'),
('7308021', '7308', 'MARUSU'),
('7308022', '7308', 'TURIKALE'),
('7308023', '7308', 'LAU'),
('7308030', '7308', 'BONTOA'),
('7308040', '7308', 'BANTIMURUNG'),
('7308041', '7308', 'SIMBANG'),
('7308050', '7308', 'TANRALILI'),
('7308051', '7308', 'TOMPU BULU'),
('7308060', '7308', 'CAMBA'),
('7308061', '7308', 'CENRANA'),
('7308070', '7308', 'MALLAWA'),
('7309010', '7309', 'LIUKANG TANGAYA'),
('7309020', '7309', 'LIUKANG KALMAS'),
('7309030', '7309', 'LIUKANG TUPABBIRING'),
('7309031', '7309', 'LIUKANG TUPABBIRING UTARA'),
('7309040', '7309', 'PANGKAJENE'),
('7309041', '7309', 'MINASATENE'),
('7309050', '7309', 'BALOCCI'),
('7309051', '7309', 'TONDONG TALLASA'),
('7309060', '7309', 'BUNGORO'),
('7309070', '7309', 'LABAKKANG'),
('7309080', '7309', 'MA\'RANG'),
('7309091', '7309', 'SEGERI'),
('7309092', '7309', 'MANDALLE'),
('7310010', '7310', 'TANETE RIAJA'),
('7310011', '7310', 'PUJANANTING'),
('7310020', '7310', 'TANETE RILAU'),
('7310030', '7310', 'BARRU'),
('7310040', '7310', 'SOPPENG RIAJA'),
('7310041', '7310', 'BALUSU'),
('7310050', '7310', 'MALLUSETASI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7311010', '7311', 'BONTOCANI'),
('7311020', '7311', 'KAHU'),
('7311030', '7311', 'KAJUARA'),
('7311040', '7311', 'SALOMEKKO'),
('7311050', '7311', 'TONRA'),
('7311060', '7311', 'PATIMPENG'),
('7311070', '7311', 'LIBURENG'),
('7311080', '7311', 'MARE'),
('7311090', '7311', 'SIBULUE'),
('7311100', '7311', 'CINA'),
('7311110', '7311', 'BAREBBO'),
('7311120', '7311', 'PONRE'),
('7311130', '7311', 'LAPPARIAJA'),
('7311140', '7311', 'LAMURU'),
('7311141', '7311', '<NAME>'),
('7311150', '7311', 'BENGO'),
('7311160', '7311', 'ULAWENG'),
('7311170', '7311', 'PALAKKA'),
('7311180', '7311', 'AWANGPONE'),
('7311190', '7311', '<NAME>'),
('7311200', '7311', 'AMALI'),
('7311210', '7311', 'AJANGALE'),
('7311220', '7311', '<NAME>'),
('7311230', '7311', 'CENRANA'),
('7311710', '7311', '<NAME>'),
('7311720', '7311', '<NAME>'),
('7311730', '7311', '<NAME>'),
('7312010', '7312', '<NAME>'),
('7312020', '7312', 'LALABATA'),
('7312030', '7312', '<NAME>'),
('7312031', '7312', 'GANRA'),
('7312032', '7312', 'CITTA'),
('7312040', '7312', '<NAME>'),
('7312050', '7312', '<NAME>'),
('7312060', '7312', '<NAME>'),
('7313010', '7313', '<NAME>'),
('7313020', '7313', 'TEMPE'),
('7313030', '7313', 'PAMMANA'),
('7313040', '7313', 'BOLA'),
('7313050', '7313', 'TAKKALALLA'),
('7313060', '7313', 'SAJOANGING'),
('7313061', '7313', 'PENRANG'),
('7313070', '7313', 'MAJAULENG'),
('7313080', '7313', 'TANA SITOLO'),
('7313090', '7313', 'BELAWA'),
('7313100', '7313', '<NAME>'),
('7313101', '7313', 'GILIRENG'),
('7313110', '7313', 'KEERA'),
('7313120', '7313', 'PITUMPANUA'),
('7314010', '7314', 'PANCA LAUTANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7314020', '7314', 'TELLULIMPO E'),
('7314030', '7314', 'WATANG PULU'),
('7314040', '7314', 'BARANTI'),
('7314050', '7314', 'PANCA RIJANG'),
('7314051', '7314', 'KULO'),
('7314060', '7314', 'MARITENGNGAE'),
('7314061', '7314', '<NAME>'),
('7314070', '7314', 'PITU RIAWA'),
('7314080', '7314', 'DUAPITUE'),
('7314081', '7314', 'PITU RIASE'),
('7315010', '7315', 'SUPPA'),
('7315020', '7315', 'MATTIROSOMPE'),
('7315021', '7315', 'LANRISANG'),
('7315030', '7315', 'MATTIRO BULU'),
('7315040', '7315', 'WATANG SAWITTO'),
('7315041', '7315', 'PALETEANG'),
('7315042', '7315', 'TIROANG'),
('7315050', '7315', 'PATAMPANUA'),
('7315060', '7315', 'CEMPA'),
('7315070', '7315', 'DUAMPANUA'),
('7315071', '7315', 'BATULAPPA'),
('7315080', '7315', 'LEMBANG'),
('7316010', '7316', 'MAIWA'),
('7316011', '7316', 'BUNGIN'),
('7316020', '7316', 'ENREKANG'),
('7316021', '7316', 'CENDANA'),
('7316030', '7316', 'BARAKA'),
('7316031', '7316', 'BUNTU BATU'),
('7316040', '7316', 'ANGGERAJA'),
('7316041', '7316', 'MALUA'),
('7316050', '7316', 'ALLA'),
('7316051', '7316', 'CURIO'),
('7316052', '7316', 'MASALLE'),
('7316053', '7316', 'BAROKO'),
('7317010', '7317', 'LAROMPONG'),
('7317011', '7317', 'LAROMPONG SELATAN'),
('7317020', '7317', 'SULI'),
('7317021', '7317', 'SULI BARAT'),
('7317030', '7317', 'BELOPA'),
('7317031', '7317', 'KAMANRE'),
('7317032', '7317', 'BELOPA UTARA'),
('7317040', '7317', 'BAJO'),
('7317041', '7317', 'BAJO BARAT'),
('7317050', '7317', 'BASSESANGTEMPE'),
('7317051', '7317', 'LATIMOJONG'),
('7317052', '7317', 'BASSESANGTEMPE UTARA'),
('7317060', '7317', 'BUPON'),
('7317061', '7317', 'PONRANG'),
('7317062', '7317', 'PONRANG SELATAN'),
('7317070', '7317', 'BUA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7317080', '7317', 'WALENRANG'),
('7317081', '7317', 'WALENRANG TIMUR'),
('7317090', '7317', 'LAMASI'),
('7317091', '7317', 'WALENRANG UTARA'),
('7317092', '7317', 'WALENRANG BARAT'),
('7317093', '7317', 'LAMASI TIMUR'),
('7318010', '7318', 'BONGGAKARADENG'),
('7318011', '7318', 'SIMBUANG'),
('7318012', '7318', 'RANO'),
('7318013', '7318', 'MAPPAK'),
('7318020', '7318', 'MENGKENDEK'),
('7318021', '7318', 'GANDANG BATU SILANAN'),
('7318030', '7318', 'SANGALLA'),
('7318031', '7318', 'SANGALA SELATAN'),
('7318032', '7318', 'SANGALLA UTARA'),
('7318040', '7318', 'MAKALE'),
('7318041', '7318', 'MAKALE SELATAN'),
('7318042', '7318', 'MAKALE UTARA'),
('7318050', '7318', 'SALUPUTTI'),
('7318051', '7318', 'BITTUANG'),
('7318052', '7318', 'REMBON'),
('7318053', '7318', 'MASANDA'),
('7318054', '7318', 'MALIMBONG BALEPE'),
('7318061', '7318', 'RANTETAYO'),
('7318067', '7318', 'KURRA'),
('7322010', '7322', 'SABBANG'),
('7322020', '7322', 'BAEBUNTA'),
('7322030', '7322', 'MALANGKE'),
('7322031', '7322', 'MALANGKE BARAT'),
('7322040', '7322', 'SUKAMAJU'),
('7322050', '7322', 'BONE-BONE'),
('7322051', '7322', 'TANA LILI'),
('7322120', '7322', 'MASAMBA'),
('7322121', '7322', 'MAPPEDECENG'),
('7322122', '7322', 'RAMPI'),
('7322130', '7322', 'LIMBONG'),
('7322131', '7322', 'SEKO'),
('7325010', '7325', 'BURAU'),
('7325020', '7325', 'WOTU'),
('7325030', '7325', 'TOMONI'),
('7325031', '7325', '<NAME>'),
('7325040', '7325', 'ANGKONA'),
('7325050', '7325', 'MALILI'),
('7325060', '7325', 'TOWUTI'),
('7325070', '7325', 'NUHA'),
('7325071', '7325', 'WASUPONDA'),
('7325080', '7325', 'MANGKUTANA'),
('7325081', '7325', 'KALAENA'),
('7326010', '7326', 'SOPAI'),
('7326020', '7326', 'KESU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7326030', '7326', 'SANGGALANGI'),
('7326040', '7326', 'BUNTAO'),
('7326050', '7326', 'RANTEBUA'),
('7326060', '7326', 'NANGGALA'),
('7326070', '7326', 'TONDON'),
('7326080', '7326', 'TALLUNGLIPU'),
('7326090', '7326', 'RANTEPAO'),
('7326100', '7326', 'TIKALA'),
('7326110', '7326', 'SESEAN'),
('7326120', '7326', 'BALUSU'),
('7326130', '7326', 'SA\'DAN'),
('7326140', '7326', 'BENGKELEKILA'),
('7326150', '7326', 'SESEAN SULOARA'),
('7326160', '7326', 'KAPALA PITU'),
('7326170', '7326', 'DENDE PIONGAN NAPO'),
('7326180', '7326', 'AWAN RANTE KARUA'),
('7326190', '7326', 'RINDINGALO'),
('7326200', '7326', 'BUNTU PEPASAN'),
('7326210', '7326', 'BARUPPU'),
('7371010', '7371', 'MARISO'),
('7371020', '7371', 'MAMAJANG'),
('7371030', '7371', 'TAMALATE'),
('7371031', '7371', 'RAPPOCINI'),
('7371040', '7371', 'MAKASSAR'),
('7371050', '7371', 'UJUNG PANDANG'),
('7371060', '7371', 'WAJO'),
('7371070', '7371', 'BONTOALA'),
('7371080', '7371', 'UJUNG TANAH'),
('7371090', '7371', 'TALLO'),
('7371100', '7371', 'PANAKKUKANG'),
('7371101', '7371', 'MANGGALA'),
('7371110', '7371', 'BIRING KANAYA'),
('7371111', '7371', 'TAMALANREA'),
('7372010', '7372', 'BACUKIKI'),
('7372011', '7372', 'BACUKIKI BARAT'),
('7372020', '7372', 'UJUNG'),
('7372030', '7372', 'SOREANG'),
('7373010', '7373', 'WARA SELATAN'),
('7373011', '7373', 'SENDANA'),
('7373020', '7373', 'WARA'),
('7373021', '7373', 'WARA TIMUR'),
('7373022', '7373', 'MUNGKAJANG'),
('7373030', '7373', 'WARA UTARA'),
('7373031', '7373', 'BARA'),
('7373040', '7373', 'TELLUWANUA'),
('7373041', '7373', 'WARA BARAT'),
('7401050', '7401', 'LASALIMU'),
('7401051', '7401', 'LASALIMU SELATAN'),
('7401052', '7401', 'SIONTAPINA'),
('7401060', '7401', 'PASAR WAJO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7401061', '7401', 'WOLOWA'),
('7401062', '7401', 'WABULA'),
('7401110', '7401', 'KAPONTORI'),
('7402010', '7402', 'TONGKUNO'),
('7402011', '7402', 'TONGKUNO SELATAN'),
('7402020', '7402', 'PARIGI'),
('7402021', '7402', 'BONE'),
('7402022', '7402', 'MAROBO'),
('7402030', '7402', 'KABAWO'),
('7402031', '7402', 'KABANGKA'),
('7402032', '7402', 'KONTUKOWUNA'),
('7402061', '7402', 'KONTUNAGA'),
('7402062', '7402', 'WATOPUTE'),
('7402070', '7402', 'KATOBU'),
('7402071', '7402', 'LOHIA'),
('7402072', '7402', 'DURUKA'),
('7402073', '7402', 'BATALAIWORU'),
('7402080', '7402', 'NAPABALANO'),
('7402081', '7402', 'LASALEPA'),
('7402083', '7402', 'TOWEA'),
('7402090', '7402', 'WAKORUMBA SELATAN'),
('7402091', '7402', 'PASIR PUTIH'),
('7402092', '7402', 'PASI KOLAGA'),
('7402111', '7402', 'MALIGANO'),
('7402112', '7402', 'BATUKARA'),
('7403090', '7403', 'SOROPIA'),
('7403091', '7403', 'LALONGGASUMEETO'),
('7403100', '7403', 'SAMPARA'),
('7403101', '7403', 'BONDOALA'),
('7403102', '7403', 'BESULUTU'),
('7403103', '7403', 'KAPOIALA'),
('7403104', '7403', 'ANGGALOMOARE'),
('7403105', '7403', 'MOROSI'),
('7403130', '7403', 'LAMBUYA'),
('7403131', '7403', 'UEPAI'),
('7403132', '7403', 'PURIALA'),
('7403133', '7403', 'ONEMBUTE'),
('7403140', '7403', 'PONDIDAHA'),
('7403141', '7403', 'WONGGEDUKU'),
('7403142', '7403', 'AMONGGEDO'),
('7403143', '7403', 'WONGGEDUKU BARAT'),
('7403150', '7403', 'WAWOTOBI'),
('7403151', '7403', 'MELUHU'),
('7403152', '7403', 'KONAWE'),
('7403170', '7403', 'UNAAHA'),
('7403171', '7403', 'ANGGABERI'),
('7403180', '7403', 'ABUKI'),
('7403181', '7403', 'LATOMA'),
('7403182', '7403', 'TONGAUNA'),
('7403183', '7403', 'ASINUA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7403184', '7403', 'PADANGGUNI'),
('7403193', '7403', 'ROUTA'),
('7404010', '7404', 'WATUBANGGA'),
('7404011', '7404', 'TANGGETADA'),
('7404012', '7404', 'TOARI'),
('7404013', '7404', 'POLINGGONA'),
('7404020', '7404', 'POMALAA'),
('7404030', '7404', 'WUNDULAKO'),
('7404031', '7404', 'BAULA'),
('7404060', '7404', 'KOLAKA'),
('7404061', '7404', 'LATAMBAGA'),
('7404070', '7404', 'WOLO'),
('7404071', '7404', 'SAMATURU'),
('7404072', '7404', 'IWOIMENDAA'),
('7405010', '7405', 'TINANGGEA'),
('7405011', '7405', 'LALEMBUU'),
('7405020', '7405', 'ANDOOLO'),
('7405021', '7405', 'BUKE'),
('7405022', '7405', 'ANDOOLO BARAT'),
('7405030', '7405', 'PALANGGA'),
('7405031', '7405', 'PALANGGA SELATAN'),
('7405032', '7405', 'BAITO'),
('7405040', '7405', 'LAINEA'),
('7405041', '7405', 'LAEYA'),
('7405050', '7405', 'KOLONO'),
('7405051', '7405', '<NAME>'),
('7405060', '7405', 'LAONTI'),
('7405070', '7405', 'MORAMO'),
('7405071', '7405', '<NAME>'),
('7405080', '7405', 'KONDA'),
('7405081', '7405', 'WOLASI'),
('7405090', '7405', 'RANOMEETO'),
('7405091', '7405', '<NAME>'),
('7405100', '7405', 'LANDONO'),
('7405101', '7405', 'MOWILA'),
('7405102', '7405', 'SABULAKOA'),
('7405110', '7405', 'ANGATA'),
('7405111', '7405', 'BENUA'),
('7405112', '7405', 'BASALA'),
('7406010', '7406', 'KABAENA'),
('7406011', '7406', 'KABAENA UTARA'),
('7406012', '7406', 'KABAENA SELATAN'),
('7406013', '7406', 'KABAENA BARAT'),
('7406020', '7406', 'KABAENA TIMUR'),
('7406021', '7406', 'KABAENA TENGAH'),
('7406030', '7406', 'RUMBIA'),
('7406031', '7406', 'MATA OLEO'),
('7406032', '7406', 'KEP. MASALOKA RAYA'),
('7406033', '7406', 'RUMBIA TENGAH'),
('7406040', '7406', 'RAROWATU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7406041', '7406', 'RAROWATU UTARA'),
('7406042', '7406', 'MATA USU'),
('7406043', '7406', 'LANTARI JAYA'),
('7406050', '7406', 'POLEANG TIMUR'),
('7406051', '7406', 'POLEANG UTARA'),
('7406052', '7406', 'POLEANG SELATAN'),
('7406053', '7406', 'POLEANG TENGGARA'),
('7406060', '7406', 'POLEANG'),
('7406061', '7406', 'POLEANG BARAT'),
('7406062', '7406', 'TONTONUNU'),
('7406063', '7406', 'POLEANG TENGAH'),
('7407010', '7407', 'BINONGKO'),
('7407011', '7407', 'TOGO BINONGKO'),
('7407020', '7407', 'TOMIA'),
('7407021', '7407', 'TOMIA TIMUR'),
('7407030', '7407', 'KALEDUPA'),
('7407031', '7407', 'KALEDUPA SELATAN'),
('7407040', '7407', 'WANGI-WANGI'),
('7407050', '7407', 'WANGI-WANGI SELATAN'),
('7408010', '7408', 'RANTEANGIN'),
('7408011', '7408', 'LAMBAI'),
('7408012', '7408', 'WAWO'),
('7408020', '7408', 'LASUSUA'),
('7408021', '7408', 'KATOI'),
('7408030', '7408', 'KODEOHA'),
('7408031', '7408', 'TIWU'),
('7408040', '7408', 'NGAPA'),
('7408041', '7408', 'WATUNOHU'),
('7408050', '7408', 'PAKUE'),
('7408051', '7408', 'PAKUE UTARA'),
('7408052', '7408', 'PAKUE TENGAH'),
('7408060', '7408', 'BATU PUTIH'),
('7408061', '7408', 'POREHU'),
('7408062', '7408', 'TOLALA'),
('7409100', '7409', 'BONEGUNU'),
('7409101', '7409', 'KAMBOWA'),
('7409110', '7409', 'WAKORUMBA'),
('7409120', '7409', 'KULISUSU'),
('7409121', '7409', 'KULISUSU BARAT'),
('7409122', '7409', 'KULISUSU UTARA'),
('7410010', '7410', 'SAWA'),
('7410011', '7410', 'MOTUI'),
('7410020', '7410', 'LEMBO'),
('7410030', '7410', 'LASOLO'),
('7410040', '7410', 'MOLAWE'),
('7410050', '7410', 'ASERA'),
('7410051', '7410', 'ANDOWIA'),
('7410052', '7410', 'OHEO'),
('7410060', '7410', 'LANGGIKIMA'),
('7410070', '7410', 'WIWIRANO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7411010', '7411', 'AERE'),
('7411020', '7411', 'LAMBANDIA'),
('7411030', '7411', 'POLI-POLIA'),
('7411040', '7411', 'DANGIA'),
('7411050', '7411', 'LADONGI'),
('7411060', '7411', 'LOEA'),
('7411070', '7411', 'TIRAWUTA'),
('7411080', '7411', 'LALOLAE'),
('7411090', '7411', 'MOWEWE'),
('7411100', '7411', 'TINONDO'),
('7411110', '7411', 'ULUIWOI'),
('7411120', '7411', 'UEESI'),
('7412010', '7412', 'WAWONII TENGGARA'),
('7412020', '7412', 'WAWONII TIMUR'),
('7412030', '7412', 'WAWONII TIMUR LAUT'),
('7412040', '7412', 'WAWONII UTARA'),
('7412050', '7412', 'WAWONII SELATAN'),
('7412060', '7412', 'WAWONII TENGAH'),
('7412070', '7412', 'WAWONII BARAT'),
('7413010', '7413', 'TIWORO KEPULAUAN'),
('7413020', '7413', 'MAGINTI'),
('7413030', '7413', 'TIWORO TENGAH'),
('7413040', '7413', 'TIWORO SELATAN'),
('7413050', '7413', 'TIWORO UTARA'),
('7413060', '7413', 'LAWA'),
('7413070', '7413', 'SAWERIGADI'),
('7413080', '7413', 'BARANGKA'),
('7413090', '7413', 'WA DAGA'),
('7413100', '7413', 'KUSAMBI'),
('7413110', '7413', 'NAPANO KUSAMBI'),
('7414010', '7414', 'TALAGA RAYA'),
('7414020', '7414', 'MAWASANGKA'),
('7414030', '7414', 'MAWASANGKA TENGAH'),
('7414040', '7414', 'MAWASANGKA TIMUR'),
('7414050', '7414', 'LAKUDO'),
('7414060', '7414', 'GU'),
('7414070', '7414', 'SANGIA WAMBULU'),
('7415010', '7415', 'BATU ATAS'),
('7415020', '7415', 'LAPANDEWA'),
('7415030', '7415', 'SAMPOLAWA'),
('7415040', '7415', 'BATAUGA'),
('7415050', '7415', 'SIOMPU BARAT'),
('7415060', '7415', 'SIOMPU'),
('7415070', '7415', 'KADATUA'),
('7471010', '7471', 'MANDONGA'),
('7471011', '7471', 'BARUGA'),
('7471012', '7471', 'PUUWATU'),
('7471013', '7471', 'KADIA'),
('7471014', '7471', 'WUA-WUA'),
('7471020', '7471', 'POASIA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7471021', '7471', 'ABELI'),
('7471022', '7471', 'KAMBU'),
('7471030', '7471', 'KENDARI'),
('7471031', '7471', 'KENDARI BARAT'),
('7472010', '7472', 'BETOAMBARI'),
('7472011', '7472', 'MURHUM'),
('7472012', '7472', 'BATUPOARO'),
('7472020', '7472', 'WOLIO'),
('7472021', '7472', 'KOKALUKUNA'),
('7472030', '7472', 'SORAWOLIO'),
('7472040', '7472', 'BUNGI'),
('7472041', '7472', 'LEA-LEA'),
('7501031', '7501', 'MANANGGU'),
('7501040', '7501', 'TILAMUTA'),
('7501041', '7501', 'DULUPI'),
('7501042', '7501', 'BOTUMOITO'),
('7501050', '7501', 'PAGUYAMAN'),
('7501051', '7501', 'WONOSARI'),
('7501052', '7501', 'PAGUYAMAN PANTAI'),
('7502010', '7502', 'BATUDAA PANTAI'),
('7502011', '7502', 'BILUHU'),
('7502020', '7502', 'BATUDAA'),
('7502021', '7502', 'BONGOMEME'),
('7502022', '7502', 'TABONGO'),
('7502023', '7502', 'DUNGALIYO'),
('7502030', '7502', 'TIBAWA'),
('7502031', '7502', 'PULUBALA'),
('7502040', '7502', 'BOLIYOHUTO'),
('7502041', '7502', 'MOOTILANGO'),
('7502042', '7502', 'TOLANGOHULA'),
('7502043', '7502', 'ASPARAGA'),
('7502044', '7502', 'BILATO'),
('7502070', '7502', 'LIMBOTO'),
('7502071', '7502', 'LIMBOTO BARAT'),
('7502080', '7502', 'TELAGA'),
('7502081', '7502', 'TELAGA BIRU'),
('7502082', '7502', 'TILANGO'),
('7502083', '7502', 'TELAGA JAYA'),
('7503010', '7503', 'POPAYATO'),
('7503011', '7503', 'POPAYATO BARAT'),
('7503012', '7503', 'POPAYATO TIMUR'),
('7503020', '7503', 'LEMITO'),
('7503021', '7503', 'WANGGARASI'),
('7503030', '7503', 'MARISA'),
('7503031', '7503', 'PATILANGGIO'),
('7503032', '7503', 'BUNTULIA'),
('7503033', '7503', 'DUHIADAA'),
('7503040', '7503', 'RANDANGAN'),
('7503041', '7503', 'TALUDITI'),
('7503050', '7503', 'PAGUAT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7503051', '7503', 'DENGILO'),
('7504010', '7504', 'TAPA'),
('7504011', '7504', 'BULANGO UTARA'),
('7504012', '7504', 'BULANGO SELATAN'),
('7504013', '7504', 'BULANGO TIMUR'),
('7504014', '7504', 'BULANGO ULU'),
('7504020', '7504', 'KABILA'),
('7504021', '7504', 'BOTU PINGGE'),
('7504022', '7504', 'TILONGKABILA'),
('7504030', '7504', 'SUWAWA'),
('7504031', '7504', 'SUWAWA SELATAN'),
('7504032', '7504', 'SUWAWA TIMUR'),
('7504033', '7504', 'SUWAWA TENGAH'),
('7504034', '7504', 'PINOGU'),
('7504040', '7504', 'BONEPANTAI'),
('7504041', '7504', 'KABILA BONE'),
('7504042', '7504', 'BONE RAYA'),
('7504043', '7504', 'BONE'),
('7504044', '7504', 'BULAWA'),
('7505010', '7505', 'ATINGGOLA'),
('7505011', '7505', 'GENTUMA RAYA'),
('7505020', '7505', 'KWANDANG'),
('7505021', '7505', 'TOMILITO'),
('7505022', '7505', 'PONELO KEPULAUAN'),
('7505030', '7505', 'ANGGREK'),
('7505031', '7505', 'MONANO'),
('7505040', '7505', 'SUMALATA'),
('7505041', '7505', 'SUMALATA TIMUR'),
('7505050', '7505', 'TOLINGGULA'),
('7505051', '7505', 'BIAU'),
('7571010', '7571', 'KOTA BARAT'),
('7571011', '7571', 'DUNGINGI'),
('7571020', '7571', 'KOTA SELATAN'),
('7571021', '7571', 'KOTA TIMUR'),
('7571022', '7571', 'HULONTHALANGI'),
('7571023', '7571', 'DUMBO RAYA'),
('7571030', '7571', 'KOTA UTARA'),
('7571031', '7571', 'KOTA TENGAH'),
('7571032', '7571', 'SIPATANA'),
('7601010', '7601', 'BANGGAE'),
('7601011', '7601', 'BANGGAE TIMUR'),
('7601020', '7601', 'PAMBOANG'),
('7601030', '7601', 'SENDANA'),
('7601031', '7601', 'TAMMERODO'),
('7601033', '7601', '<NAME>'),
('7601040', '7601', 'MALUNDA'),
('7601041', '7601', 'ULUMANDA'),
('7602010', '7602', 'TINAMBUNG'),
('7602011', '7602', 'BALANIPA'),
('7602012', '7602', 'LIMBORO');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7602020', '7602', 'TUBBI TARAMANU'),
('7602021', '7602', 'ALU'),
('7602030', '7602', 'CAMPALAGIAN'),
('7602031', '7602', 'LUYO'),
('7602040', '7602', 'WONOMULYO'),
('7602041', '7602', 'MAPILLI'),
('7602042', '7602', 'TAPANGO'),
('7602043', '7602', 'MATAKALI'),
('7602044', '7602', 'B U L O'),
('7602050', '7602', 'POLEWALI'),
('7602051', '7602', 'BINUANG'),
('7602052', '7602', 'ANREAPI'),
('7602061', '7602', 'MATANGNGA'),
('7603010', '7603', 'SUMARORONG'),
('7603020', '7603', 'MESSAWA'),
('7603030', '7603', 'PANA'),
('7603031', '7603', 'NOSU'),
('7603040', '7603', 'TABANG'),
('7603050', '7603', 'MAMASA'),
('7603060', '7603', 'TANDUK KALUA'),
('7603061', '7603', 'BALLA'),
('7603070', '7603', 'SESENAPADANG'),
('7603071', '7603', 'TAWALIAN'),
('7603080', '7603', 'MAMBI'),
('7603081', '7603', 'BAMBANG'),
('7603082', '7603', 'RANTEBULAHAN TIMUR'),
('7603083', '7603', 'MEHALAAN'),
('7603090', '7603', 'ARALLE'),
('7603091', '7603', 'BUNTU MALANGKA'),
('7603100', '7603', 'TABULAHAN'),
('7604010', '7604', 'TAPALANG'),
('7604011', '7604', 'TAPALANG BARAT'),
('7604020', '7604', 'MAMUJU'),
('7604022', '7604', 'SIMBORO'),
('7604023', '7604', 'BALABALAKANG'),
('7604030', '7604', 'KALUKKU'),
('7604031', '7604', 'PAPALANG'),
('7604032', '7604', 'SAMPAGA'),
('7604033', '7604', 'TOMMO'),
('7604040', '7604', 'KALUMPANG'),
('7604041', '7604', 'BONEHAU'),
('7605010', '7605', 'SARUDU'),
('7605011', '7605', 'DAPURANG'),
('7605012', '7605', 'DURIPOKU'),
('7605020', '7605', 'BARAS'),
('7605021', '7605', 'BULU TABA'),
('7605022', '7605', 'LARIANG'),
('7605030', '7605', 'PASANGKAYU'),
('7605031', '7605', 'TIKKE RAYA'),
('7605032', '7605', 'PEDONGGA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('7605040', '7605', 'BAMBALAMOTU'),
('7605041', '7605', 'BAMBAIRA'),
('7605042', '7605', 'SARJO'),
('7606010', '7606', 'PANGALE'),
('7606020', '7606', 'BUDONG-BUDONG'),
('7606030', '7606', 'TOBADAK'),
('7606040', '7606', 'TOPOYO'),
('7606050', '7606', 'KAROSSA'),
('8101040', '8101', 'TANIMBAR SELATAN'),
('8101041', '8101', 'WER TAMRIAN'),
('8101042', '8101', '<NAME>'),
('8101043', '8101', 'SELARU'),
('8101050', '8101', 'TANIMBAR UTARA'),
('8101051', '8101', 'YARU'),
('8101052', '8101', 'WUAR LABOBAR'),
('8101053', '8101', 'NIRUNMAS'),
('8101054', '8101', 'KORMOMOLIN'),
('8101055', '8101', 'MOLU MARU'),
('8102010', '8102', 'KEI KECIL'),
('8102012', '8102', 'KEI KECIL BARAT'),
('8102013', '8102', 'KEI KECIL TIMUR'),
('8102014', '8102', 'HOAT SORBAY'),
('8102015', '8102', 'MANYEUW'),
('8102016', '8102', 'KEI KECIL TIMUR SELATAN'),
('8102020', '8102', 'KEI BESAR'),
('8102021', '8102', 'KEI BESAR UTARA TIMUR'),
('8102022', '8102', 'KEI BESAR SELATAN'),
('8102023', '8102', 'KEI BESAR UTARA BARAT'),
('8102024', '8102', 'KEI BESAR SELATAN BARAT'),
('8103010', '8103', 'BANDA'),
('8103040', '8103', 'TEHORU'),
('8103041', '8103', 'TELUTIH'),
('8103050', '8103', 'AMAHAI'),
('8103051', '8103', 'KOTA MASOHI'),
('8103052', '8103', 'TELUK ELPAPUTIH'),
('8103060', '8103', 'TEON NILA SERUA'),
('8103080', '8103', 'SAPARUA'),
('8103081', '8103', 'NUSALAUT'),
('8103082', '8103', 'SAPARUA TIMUR'),
('8103090', '8103', '<NAME>'),
('8103100', '8103', 'SALAHUTU'),
('8103110', '8103', 'LEIHITU'),
('8103111', '8103', 'LEIHITU BARAT'),
('8103140', '8103', 'SERAM UTARA'),
('8103141', '8103', 'SERAM UTARA BARAT'),
('8103142', '8103', 'SERAM UTARA TIMUR KOBI'),
('8103143', '8103', 'SERAM UTARA TIMUR SETI'),
('8104020', '8104', 'NAMLEA'),
('8104021', '8104', 'WAEAPO'),
('8104022', '8104', 'WAPLAU');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('8104023', '8104', 'BATA BUAL'),
('8104024', '8104', 'TELUK KAIELY'),
('8104025', '8104', 'WAELATA'),
('8104026', '8104', '<NAME>'),
('8104027', '8104', 'LILIALY'),
('8104030', '8104', 'AIR BUAYA'),
('8104031', '8104', '<NAME>'),
('8105010', '8105', 'ARU SELATAN'),
('8105011', '8105', 'ARU SELATAN TIMUR'),
('8105012', '8105', 'ARU SELATAN UTARA'),
('8105020', '8105', 'ARU TENGAH'),
('8105021', '8105', 'ARU TENGAH TIMUR'),
('8105022', '8105', 'ARU TENGAH SELATAN'),
('8105030', '8105', 'PULAU-PULAU ARU'),
('8105031', '8105', 'ARU UTARA'),
('8105032', '8105', 'ARU UTARA TIMUR BATULEY'),
('8105033', '8105', 'SIR-SIR'),
('8106010', '8106', 'HUAMUAL BELAKANG'),
('8106011', '8106', 'KEPULAUAN MANIPA'),
('8106020', '8106', 'SERAM BARAT'),
('8106021', '8106', 'HUAMUAL'),
('8106030', '8106', 'KAIRATU'),
('8106031', '8106', 'KAIRATU BARAT'),
('8106032', '8106', 'INAMOSOL'),
('8106033', '8106', 'AMALATU'),
('8106034', '8106', 'ELPAPUTIH'),
('8106040', '8106', 'TANIWEL'),
('8106041', '8106', 'TANIWEL TIMUR'),
('8107010', '8107', 'PULAU GOROM'),
('8107011', '8107', 'WAKATE'),
('8107012', '8107', 'TEOR'),
('8107013', '8107', 'GOROM TIMUR'),
('8107014', '8107', 'PULAU PANJANG'),
('8107020', '8107', 'SERAM TIMUR'),
('8107021', '8107', 'TUTUK TOLU'),
('8107022', '8107', 'KILMURY'),
('8107023', '8107', 'LIAN VITU'),
('8107024', '8107', 'KIAN DARAT'),
('8107030', '8107', 'WERINAMA'),
('8107031', '8107', 'SIWALALAT'),
('8107040', '8107', 'BULA'),
('8107041', '8107', 'BULA BARAT'),
('8107042', '8107', 'TELUK WARU'),
('8108010', '8108', 'WETAR'),
('8108011', '8108', 'WETAR BARAT'),
('8108012', '8108', 'WETAR UTARA'),
('8108013', '8108', 'WETAR TIMUR'),
('8108020', '8108', 'PP. TERSELATAN'),
('8108021', '8108', 'KISAR UTARA'),
('8108022', '8108', 'KEPULAUAN ROMANG');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('8108030', '8108', 'LETTI'),
('8108041', '8108', 'MOA'),
('8108042', '8108', 'LAKOR'),
('8108050', '8108', 'DAMER'),
('8108060', '8108', '<NAME>'),
('8108070', '8108', 'PP. BABAR'),
('8108071', '8108', 'PULAU WETANG'),
('8108080', '8108', 'BABAR TIMUR'),
('8108081', '8108', 'PULAU MASELA'),
('8108082', '8108', 'DAWELOR DAWERA'),
('8109010', '8109', 'KEPALA MADAN'),
('8109020', '8109', 'LEKSULA'),
('8109021', '8109', 'FENA FAFAN'),
('8109030', '8109', 'NAMROLE'),
('8109040', '8109', 'WAISAMA'),
('8109050', '8109', 'AMBALAU'),
('8171010', '8171', 'NUSANIWE'),
('8171020', '8171', 'SIRIMAU'),
('8171021', '8171', 'LEITIMUR SELATAN'),
('8171030', '8171', 'TELUK AMBON BAGUALA'),
('8171031', '8171', 'TELUK AMBON'),
('8172010', '8172', 'PP. KUR'),
('8172011', '8172', 'KUR SELATAN'),
('8172020', '8172', 'TAYANDO TAM'),
('8172030', '8172', 'PULAU DULLAH UTARA'),
('8172040', '8172', 'PULAU DULLAH SELATAN'),
('8201090', '8201', 'JAILOLO'),
('8201091', '8201', 'JAILOLO SELATAN'),
('8201100', '8201', 'SAHU'),
('8201101', '8201', 'SAHU TIMUR'),
('8201130', '8201', 'IBU'),
('8201131', '8201', 'IBU SELATAN'),
('8201132', '8201', 'TABARU'),
('8201140', '8201', 'LOLODA'),
('8202030', '8202', 'WEDA'),
('8202031', '8202', 'WEDA SELATAN'),
('8202032', '8202', 'WEDA UTARA'),
('8202033', '8202', 'WEDA TENGAH'),
('8202034', '8202', 'WEDA TIMUR'),
('8202041', '8202', 'PULAU GEBE'),
('8202042', '8202', 'PATANI'),
('8202043', '8202', 'PATANI UTARA'),
('8202044', '8202', 'PATANI BARAT'),
('8202045', '8202', 'PATANI TIMUR'),
('8203010', '8203', 'SULA BESI BARAT'),
('8203011', '8203', 'SULABESI SELATAN'),
('8203020', '8203', 'SANANA'),
('8203021', '8203', 'SULA BESI TENGAH'),
('8203022', '8203', 'SULABESI TIMUR'),
('8203023', '8203', 'SANANA UTARA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('8203030', '8203', 'MANGOLI TIMUR'),
('8203031', '8203', 'MANGOLI TENGAH'),
('8203032', '8203', 'MANGOLI UTARA TIMUR'),
('8203040', '8203', 'MANGOLI BARAT'),
('8203041', '8203', 'MANGOLI UTARA'),
('8203042', '8203', 'MANGOLI SELATAN'),
('8204010', '8204', 'OBI SELATAN'),
('8204020', '8204', 'OBI'),
('8204021', '8204', 'OBI BARAT'),
('8204022', '8204', 'OBI TIMUR'),
('8204023', '8204', 'OBI UTARA'),
('8204030', '8204', 'BACAN'),
('8204031', '8204', 'MANDIOLI SELATAN'),
('8204032', '8204', 'MANDIOLI UTARA'),
('8204033', '8204', 'BACAN SELATAN'),
('8204034', '8204', 'BATANG LOMANG'),
('8204040', '8204', 'BACAN TIMUR'),
('8204041', '8204', 'BACAN TIMUR SELATAN'),
('8204042', '8204', 'BACAN TIMUR TENGAH'),
('8204050', '8204', 'BACAN BARAT'),
('8204051', '8204', 'KASIRUTA BARAT'),
('8204052', '8204', 'KASIRUTA TIMUR'),
('8204053', '8204', 'BACAN BARAT UTARA'),
('8204060', '8204', 'KAYOA'),
('8204061', '8204', 'KAYOA BARAT'),
('8204062', '8204', 'KAYOA SELATAN'),
('8204063', '8204', 'KAYOA UTARA'),
('8204070', '8204', 'PULAU MAKIAN'),
('8204071', '8204', 'MAKIAN BARAT'),
('8204080', '8204', 'GANE BARAT'),
('8204081', '8204', 'GANE BARAT SELATAN'),
('8204082', '8204', 'GANE BARAT UTARA'),
('8204083', '8204', 'KEPULAUAN JORONGA'),
('8204090', '8204', 'GANE TIMUR'),
('8204091', '8204', 'GANE TIMUR TENGAH'),
('8204092', '8204', 'GANE TIMUR SELATAN'),
('8205010', '8205', 'MALIFUT'),
('8205011', '8205', 'KAO TELUK'),
('8205020', '8205', 'KAO'),
('8205021', '8205', 'KAO BARAT'),
('8205022', '8205', 'KAO UTARA'),
('8205030', '8205', 'TOBELO SELATAN'),
('8205031', '8205', 'TOBELO BARAT'),
('8205032', '8205', 'TOBELO TIMUR'),
('8205040', '8205', 'TOBELO'),
('8205041', '8205', 'TOBELO TENGAH'),
('8205042', '8205', 'TOBELO UTARA'),
('8205050', '8205', 'GALELA'),
('8205051', '8205', 'GALELA SELATAN'),
('8205052', '8205', 'GALELA BARAT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('8205053', '8205', 'GALELA UTARA'),
('8205060', '8205', 'LOLODA UTARA'),
('8205061', '8205', 'LOLODA KEPULAUAN'),
('8206010', '8206', 'MABA SELATAN'),
('8206011', '8206', 'KOTA MABA'),
('8206020', '8206', 'WASILE SELATAN'),
('8206030', '8206', 'WASILE'),
('8206031', '8206', 'WASILE TIMUR'),
('8206032', '8206', 'WASILE TENGAH'),
('8206033', '8206', 'WASILE UTARA'),
('8206040', '8206', 'MABA'),
('8206041', '8206', 'MABA TENGAH'),
('8206042', '8206', 'MABA UTARA'),
('8207010', '8207', 'MOROTAI SELATAN'),
('8207020', '8207', 'MOROTAI TIMUR'),
('8207030', '8207', 'MOROTAI SELATAN BARAT'),
('8207040', '8207', 'MOROTAI JAYA'),
('8207050', '8207', 'MOROTAI UTARA'),
('8208010', '8208', 'TALIABU BARAT'),
('8208020', '8208', 'TALIABU SELATAN'),
('8208030', '8208', 'TABONA'),
('8208040', '8208', 'TALIABU TIMUR SELATAN'),
('8208050', '8208', 'TALIABU TIMUR'),
('8208060', '8208', 'TALIABU UTARA'),
('8208070', '8208', 'LEDE'),
('8208080', '8208', 'TALIABU BARAT LAUT'),
('8271010', '8271', 'PULAU TERNATE'),
('8271011', '8271', 'MOTI'),
('8271012', '8271', 'PULAU BATANG DUA'),
('8271013', '8271', 'PULAU HIRI'),
('8271020', '8271', 'TERNATE SELATAN'),
('8271021', '8271', 'TERNATE TENGAH'),
('8271030', '8271', 'TERNATE UTARA'),
('8272010', '8272', 'TIDORE SELATAN'),
('8272020', '8272', 'TIDORE UTARA'),
('8272030', '8272', 'TIDORE'),
('8272031', '8272', 'TIDORE TIMUR'),
('8272040', '8272', 'OBA'),
('8272041', '8272', 'OBA SELATAN'),
('8272050', '8272', 'OBA UTARA'),
('8272051', '8272', 'OBA TENGAH'),
('9101050', '9101', 'FAKFAK TIMUR'),
('9101051', '9101', 'KARAS'),
('9101060', '9101', 'FAKFAK'),
('9101061', '9101', 'FAKFAK TENGAH'),
('9101070', '9101', 'FAKFAK BARAT'),
('9101080', '9101', 'KOKAS'),
('9101081', '9101', 'TELUK PATIPI'),
('9101082', '9101', 'KRAMONGMONGGA'),
('9101083', '9101', 'BOMBERAY');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9102010', '9102', 'BURUWAY'),
('9102020', '9102', 'TELUK ARGUNI'),
('9102021', '9102', 'TELUK ARGUNI BAWAH'),
('9102030', '9102', 'KAIMANA'),
('9102031', '9102', 'KAMBRAU'),
('9102040', '9102', 'TELUK ETNA'),
('9102041', '9102', 'YAMOR'),
('9103010', '9103', 'NAIKERE'),
('9103020', '9103', 'WONDIBOY'),
('9103021', '9103', 'RASIEY'),
('9103022', '9103', '<NAME>'),
('9103030', '9103', 'WASIOR'),
('9103040', '9103', 'DUAIRI'),
('9103041', '9103', 'ROON'),
('9103050', '9103', 'WINDESI'),
('9103051', '9103', 'NIKIWAR'),
('9103060', '9103', 'WAMESA'),
('9103061', '9103', 'ROSWAR'),
('9103070', '9103', 'RUMBERPON'),
('9103071', '9103', 'SOUG JAYA'),
('9104010', '9104', 'FAFURWAR'),
('9104020', '9104', 'BABO'),
('9104021', '9104', 'SUMURI'),
('9104022', '9104', 'AROBA'),
('9104023', '9104', 'KAITARO'),
('9104030', '9104', 'KURI'),
('9104040', '9104', 'WAMESA'),
('9104050', '9104', 'BINTUNI'),
('9104051', '9104', 'MANIMERI'),
('9104052', '9104', 'TUHIBA'),
('9104053', '9104', '<NAME>'),
('9104060', '9104', 'TEMBUNI'),
('9104070', '9104', 'ARANDAY'),
('9104071', '9104', 'KAMUNDAN'),
('9104072', '9104', 'TOMU'),
('9104073', '9104', 'WERIAGAR'),
('9104080', '9104', 'MOSKONA SELATAN'),
('9104081', '9104', 'MEYADO'),
('9104082', '9104', '<NAME>'),
('9104090', '9104', 'MERDEY'),
('9104091', '9104', 'BISCOOP'),
('9104092', '9104', 'MASYETA'),
('9104100', '9104', 'MOSKONA UTARA'),
('9104101', '9104', 'MOSKONA TIMUR'),
('9105110', '9105', 'WARMARE'),
('9105120', '9105', 'PRAFI'),
('9105141', '9105', 'MANOKWARI BARAT'),
('9105142', '9105', 'MANOKWARI TIMUR'),
('9105143', '9105', 'MANOKWARI UTARA'),
('9105144', '9105', 'MANOKWARI SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9105146', '9105', 'TANAH RUBU'),
('9105170', '9105', 'MASNI'),
('9105171', '9105', 'SIDEY'),
('9106010', '9106', 'INANWATAN'),
('9106011', '9106', 'METEMANI'),
('9106020', '9106', 'KOKODA'),
('9106021', '9106', 'KAIS'),
('9106022', '9106', 'KOKODA UTARA'),
('9106023', '9106', 'KAIS DARAT'),
('9106060', '9106', 'MOSWAREN'),
('9106070', '9106', 'TEMINABUAN'),
('9106071', '9106', 'SEREMUK'),
('9106072', '9106', 'WAYER'),
('9106073', '9106', 'KONDA'),
('9106074', '9106', 'SAIFI'),
('9106080', '9106', 'SAWIAT'),
('9106081', '9106', 'FOKOUR'),
('9106082', '9106', 'SALKMA'),
('9107060', '9107', 'MORAID'),
('9107061', '9107', 'KLASO'),
('9107100', '9107', 'MAKBON'),
('9107101', '9107', 'KLAYILI'),
('9107110', '9107', 'BERAUR'),
('9107111', '9107', 'KLAMONO'),
('9107112', '9107', 'KLABOT'),
('9107113', '9107', 'KLAWAK'),
('9107120', '9107', 'SALAWATI'),
('9107121', '9107', 'MAYAMUK'),
('9107122', '9107', '<NAME>'),
('9107130', '9107', 'SEGET'),
('9107131', '9107', 'SEGUN'),
('9107132', '9107', '<NAME>'),
('9107170', '9107', 'AIMAS'),
('9107171', '9107', 'MARIAT'),
('9107172', '9107', 'SORONG'),
('9107180', '9107', 'SAYOSA'),
('9107181', '9107', 'MAUDUS'),
('9108011', '9108', 'MISOOL SELATAN'),
('9108012', '9108', 'MISOOL BARAT'),
('9108020', '9108', 'MISOOL'),
('9108021', '9108', 'KOFIAU'),
('9108022', '9108', 'MISOOL TIMUR'),
('9108023', '9108', 'KEPULAUAN SEMBILAN'),
('9108031', '9108', 'SALAWATI UTARA'),
('9108033', '9108', 'SALAWATI TENGAH'),
('9108034', '9108', 'SALAWATI BARAT'),
('9108035', '9108', 'BATANTA SELATAN'),
('9108036', '9108', 'BATANTA UTARA'),
('9108040', '9108', 'WAIGEO SELATAN'),
('9108041', '9108', 'TELUK MAYALIBIT');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9108042', '9108', 'MEOS MANSAR'),
('9108043', '9108', 'KOTA WAISAI'),
('9108044', '9108', 'TIPLOL MAYALIBIT'),
('9108050', '9108', 'WAIGEO BARAT'),
('9108051', '9108', 'WAIGEO BARAT KEPULAUAN'),
('9108060', '9108', 'WAIGEO UTARA'),
('9108061', '9108', 'WARWARBOMI'),
('9108062', '9108', 'SUPNIN'),
('9108070', '9108', 'KEPULAUAN AYAU'),
('9108071', '9108', 'AYAU'),
('9108080', '9108', 'WAIGEO TIMUR'),
('9109010', '9109', 'FEF'),
('9109011', '9109', 'SYUJAK'),
('9109020', '9109', 'MIYAH'),
('9109030', '9109', 'ABUN'),
('9109040', '9109', 'KWOOR'),
('9109050', '9109', 'SAUSAPOR'),
('9109060', '9109', 'YEMBUN'),
('9109070', '9109', 'KEBAR'),
('9109080', '9109', 'SENOPI'),
('9109090', '9109', 'AMBERBAKEN'),
('9109100', '9109', 'MUBARNI / ARFU'),
('9110010', '9110', 'AITINYO BARAT/ATHABU'),
('9110011', '9110', 'AYAMARU SELATAN JAYA'),
('9110020', '9110', 'AITINYO'),
('9110021', '9110', 'AITINYO TENGAH'),
('9110030', '9110', 'AIFAT SELATAN'),
('9110031', '9110', 'AIFAT TIMUR SELATAN'),
('9110040', '9110', 'AIFAT'),
('9110050', '9110', 'AITINYO UTARA'),
('9110051', '9110', 'AITINYO RAYA'),
('9110060', '9110', 'AYAMARU TIMUR'),
('9110061', '9110', 'AYAMARU TIMUR SELATAN'),
('9110070', '9110', 'AYAMARU'),
('9110071', '9110', 'AYAMARU SELATAN'),
('9110072', '9110', 'AYAMARU JAYA'),
('9110073', '9110', 'AYAMARU TENGAH'),
('9110074', '9110', 'AYAMARU BARAT'),
('9110080', '9110', 'AYAMARU UTARA'),
('9110081', '9110', 'AYAMARU UTARA TIMUR'),
('9110090', '9110', 'MARE'),
('9110091', '9110', 'MARE SELATAN'),
('9110100', '9110', 'AIFAT UTARA'),
('9110110', '9110', 'AIFAT TIMUR'),
('9110111', '9110', 'AIFAT TIMUR TENGAH'),
('9110112', '9110', 'AIFAT TIMUR JAUH'),
('9111010', '9111', 'TAHOTA'),
('9111020', '9111', 'DATARAN ISIM'),
('9111030', '9111', 'NENEI'),
('9111040', '9111', 'MOMI WAREN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9111050', '9111', 'RANSIKI'),
('9111060', '9111', 'ORANSBARI'),
('9112010', '9112', 'DIDOHU'),
('9112020', '9112', 'SURUREY'),
('9112030', '9112', 'ANGGI GIDA'),
('9112040', '9112', 'MEMBEY'),
('9112050', '9112', 'ANGGI'),
('9112060', '9112', 'TAIGE'),
('9112070', '9112', 'HINGK'),
('9112080', '9112', 'MENYAMBOUW'),
('9112090', '9112', 'CATUBOUW'),
('9112100', '9112', 'TESTEGA'),
('9171010', '9171', 'SORONG BARAT'),
('9171011', '9171', 'SORONG KEPULAUAN'),
('9171012', '9171', 'MALADOMES'),
('9171020', '9171', 'SORONG TIMUR'),
('9171021', '9171', 'SORONG UTARA'),
('9171022', '9171', 'SORONG'),
('9171023', '9171', 'SORONG MANOI'),
('9171024', '9171', 'KLAURUNG'),
('9171025', '9171', 'MALAIMSIMSA'),
('9171026', '9171', 'SORONG KOTA'),
('9401010', '9401', 'KIMAAM'),
('9401011', '9401', 'WAAN'),
('9401012', '9401', 'TABONJI'),
('9401013', '9401', 'ILWAYAB'),
('9401020', '9401', 'OKABA'),
('9401021', '9401', 'TUBANG'),
('9401022', '9401', 'NGGUTI'),
('9401023', '9401', 'KAPTEL'),
('9401030', '9401', 'KURIK'),
('9401031', '9401', 'MALIND'),
('9401032', '9401', 'ANIMHA'),
('9401040', '9401', 'MERAUKE'),
('9401041', '9401', 'SEMANGGA'),
('9401042', '9401', '<NAME>'),
('9401043', '9401', 'JAGEBOB'),
('9401044', '9401', 'SOTA'),
('9401045', '9401', 'NAUKENJERAI'),
('9401050', '9401', 'MUTING'),
('9401051', '9401', 'ELIGOBEL'),
('9401052', '9401', 'ULILIN'),
('9402110', '9402', 'WAMENA'),
('9402111', '9402', 'ASOLOKOBAL'),
('9402112', '9402', 'WALELAGAMA'),
('9402113', '9402', 'TRIKORA'),
('9402114', '9402', 'NAPUA'),
('9402115', '9402', 'WALAIK'),
('9402116', '9402', 'WOUMA'),
('9402117', '9402', 'WALESI');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9402118', '9402', 'ASOTIPO'),
('9402119', '9402', 'MAIMA'),
('9402120', '9402', 'HUBIKOSI'),
('9402121', '9402', 'PELEBAGA'),
('9402122', '9402', 'IBELE'),
('9402123', '9402', 'TAILAREK'),
('9402124', '9402', 'HUBIKIAK'),
('9402180', '9402', 'ASOLOGAIMA'),
('9402181', '9402', 'MUSATFAK'),
('9402182', '9402', '<NAME>'),
('9402183', '9402', 'PYRAMID'),
('9402184', '9402', 'MULIAMA'),
('9402185', '9402', 'WAME'),
('9402190', '9402', 'KURULU'),
('9402191', '9402', 'USILIMO'),
('9402192', '9402', 'WITA WAYA'),
('9402193', '9402', 'LIBAREK'),
('9402194', '9402', 'WADANGKU'),
('9402195', '9402', 'PISUGI'),
('9402220', '9402', 'BOLAKME'),
('9402221', '9402', 'WOLLO'),
('9402222', '9402', 'YALENGGA'),
('9402223', '9402', 'TAGIME'),
('9402224', '9402', 'MOLAGALOME'),
('9402225', '9402', 'TAGINERI'),
('9402226', '9402', 'BUGI'),
('9402227', '9402', 'BPIRI'),
('9402228', '9402', 'KORAGI'),
('9402611', '9402', 'ITLAY HASIGE'),
('9402612', '9402', 'SIEPKOSI'),
('9402614', '9402', 'POPUGOBA'),
('9403080', '9403', 'KAUREH'),
('9403081', '9403', 'AIRU'),
('9403082', '9403', 'YAPSI'),
('9403140', '9403', 'KEMTUK'),
('9403150', '9403', 'KEMTUK GRESI'),
('9403151', '9403', 'GRESI SELATAN'),
('9403160', '9403', 'NIMBORAN'),
('9403161', '9403', 'NIMBORAN TIMUR / NAMBLONG'),
('9403170', '9403', 'NIMBOKRANG'),
('9403180', '9403', 'UNURUM GUAY'),
('9403200', '9403', 'DEMTA'),
('9403201', '9403', 'YOKARI'),
('9403210', '9403', 'DEPAPRE'),
('9403211', '9403', 'RAVENIRARA'),
('9403220', '9403', 'SENTANI BARAT'),
('9403221', '9403', 'WAIBU'),
('9403230', '9403', 'SENTANI'),
('9403231', '9403', 'EBUNGFAU'),
('9403240', '9403', '<NAME>');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9404050', '9404', 'UWAPA'),
('9404051', '9404', 'MENOU'),
('9404052', '9404', 'DIPA'),
('9404060', '9404', 'YAUR'),
('9404061', '9404', 'TELUK UMAR'),
('9404070', '9404', 'WANGGAR'),
('9404071', '9404', '<NAME>'),
('9404080', '9404', 'NABIRE'),
('9404081', '9404', 'TELUK KIMI'),
('9404090', '9404', 'NAPAN'),
('9404091', '9404', 'MAKIMI'),
('9404092', '9404', 'WAPOGA'),
('9404093', '9404', 'KEPULAUAN MOORA'),
('9404100', '9404', 'SIRIWO'),
('9404110', '9404', 'YARO'),
('9408040', '9408', 'YAPEN TIMUR'),
('9408041', '9408', 'PANTURA YAPEN'),
('9408042', '9408', 'TELUK AMPIMOI'),
('9408043', '9408', 'RAIMBAWI'),
('9408044', '9408', 'PULAU KURUDU'),
('9408050', '9408', 'ANGKAISERA'),
('9408051', '9408', 'KEP. AMBAI'),
('9408052', '9408', 'YAWAKUKAT'),
('9408060', '9408', 'YAPEN SELATAN'),
('9408061', '9408', 'KOSIWO'),
('9408062', '9408', 'ANATAUREI'),
('9408070', '9408', 'YAPEN BARAT'),
('9408071', '9408', 'WONAWA'),
('9408072', '9408', 'PULAU YERUI'),
('9408080', '9408', 'POOM'),
('9408081', '9408', 'WINDESI'),
('9409010', '9409', 'NUMFOR BARAT'),
('9409011', '9409', 'ORKERI'),
('9409020', '9409', 'NUMFOR TIMUR'),
('9409021', '9409', 'BRUYADORI'),
('9409022', '9409', 'POIRU'),
('9409030', '9409', 'PADAIDO'),
('9409031', '9409', '<NAME>'),
('9409040', '9409', 'BIAK TIMUR'),
('9409041', '9409', 'ORIDEK'),
('9409050', '9409', 'BIAK KOTA'),
('9409060', '9409', 'SAMOFA'),
('9409070', '9409', 'YENDIDORI'),
('9409080', '9409', 'BIAK UTARA'),
('9409081', '9409', 'ANDEY'),
('9409090', '9409', 'WARSA'),
('9409091', '9409', 'YAWOSI'),
('9409092', '9409', 'BONDIFUAR'),
('9409100', '9409', 'BIAK BARAT'),
('9409101', '9409', 'SWANDIWE');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9410030', '9410', 'PANIAI TIMUR'),
('9410031', '9410', 'YATAMO'),
('9410032', '9410', 'KEBO'),
('9410040', '9410', 'BIBIDA'),
('9410041', '9410', 'DUMADAMA'),
('9410070', '9410', 'ARADIDE'),
('9410071', '9410', 'EKADIDE'),
('9410080', '9410', 'PANIAI BARAT'),
('9410081', '9410', 'SIRIWO'),
('9410090', '9410', 'BOGOBAIDA'),
('9411040', '9411', 'FAWI'),
('9411041', '9411', 'DAGAI'),
('9411042', '9411', 'KIYAGE'),
('9411050', '9411', 'MULIA'),
('9411053', '9411', 'YAMBI'),
('9411054', '9411', 'ILAMBURAWI'),
('9411055', '9411', 'MUARA'),
('9411056', '9411', 'PAGALEME'),
('9411057', '9411', 'GURAGE'),
('9411058', '9411', 'IRIMULI'),
('9411060', '9411', 'ILU'),
('9411061', '9411', 'TORERE'),
('9411063', '9411', 'YAMONERI'),
('9411064', '9411', 'WAEGI'),
('9411065', '9411', 'NUME'),
('9411066', '9411', 'NIOGA'),
('9411067', '9411', 'GUBUME'),
('9411068', '9411', 'TAGANOMBAK'),
('9411070', '9411', 'TINGGINAMBUT'),
('9411071', '9411', 'KALOME'),
('9411072', '9411', 'WANWI'),
('9411080', '9411', 'MEWOLUK'),
('9411081', '9411', 'LUMO'),
('9411082', '9411', 'MOLANIKIME'),
('9411090', '9411', 'YAMO'),
('9411091', '9411', 'DOKOME'),
('9412010', '9412', 'MIMIKA BARAT'),
('9412011', '9412', 'MIMIKA BARAT JAUH'),
('9412012', '9412', 'MIMIKA BARAT TENGAH'),
('9412013', '9412', 'AMAR'),
('9412020', '9412', 'MIMIKA TIMUR'),
('9412021', '9412', 'MIMIKA TENGAH'),
('9412022', '9412', 'MIMIKA TIMUR JAUH'),
('9412030', '9412', 'MIMIKA BARU'),
('9412031', '9412', 'KUALA KENCANA'),
('9412032', '9412', 'TEMBAGAPURA'),
('9412033', '9412', 'WANIA'),
('9412034', '9412', 'IWAKA'),
('9412035', '9412', 'KWAMKI NARAMA'),
('9412040', '9412', 'AGIMUGA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9412041', '9412', 'JILA'),
('9412042', '9412', 'JITA'),
('9412043', '9412', 'ALAMA'),
('9412044', '9412', 'HOYA'),
('9413010', '9413', 'JAIR'),
('9413011', '9413', 'SUBUR'),
('9413013', '9413', 'KIA'),
('9413020', '9413', 'MINDIPTANA'),
('9413021', '9413', 'INIYANDIT'),
('9413022', '9413', 'KOMBUT'),
('9413023', '9413', 'SESNUK'),
('9413030', '9413', 'MANDOBO'),
('9413031', '9413', 'FOFI'),
('9413032', '9413', 'ARIMOP'),
('9413040', '9413', 'KOUH'),
('9413041', '9413', 'BOMAKIA'),
('9413042', '9413', 'FIRIWAGE'),
('9413043', '9413', 'MANGGELUM'),
('9413044', '9413', 'YANIRUMA'),
('9413045', '9413', 'KAWAGIT'),
('9413046', '9413', 'KOMBAY'),
('9413050', '9413', 'WAROPKO'),
('9413051', '9413', 'AMBATKWI'),
('9413052', '9413', 'NINATI'),
('9414010', '9414', '<NAME>'),
('9414011', '9414', 'MINYAMUR'),
('9414020', '9414', 'EDERA'),
('9414021', '9414', 'VENAHA'),
('9414022', '9414', 'SYAHCAME'),
('9414023', '9414', 'BAMGI'),
('9414024', '9414', 'YAKOMI'),
('9414030', '9414', 'OBAA'),
('9414031', '9414', 'PASSUE'),
('9414040', '9414', 'HAJU'),
('9414050', '9414', 'ASSUE'),
('9414060', '9414', 'CITAKMITAK'),
('9414061', '9414', 'KAIBAR'),
('9414062', '9414', '<NAME>'),
('9414063', '9414', 'TI-ZAIN'),
('9415010', '9415', '<NAME>'),
('9415011', '9415', 'KOPAY'),
('9415012', '9415', '<NAME>OUMUR'),
('9415013', '9415', 'SAFAN'),
('9415020', '9415', 'FAYIT'),
('9415030', '9415', 'ATSY'),
('9415031', '9415', 'SIRETS'),
('9415032', '9415', 'AYIP'),
('9415033', '9415', 'BECTBAMU'),
('9415040', '9415', 'SUATOR'),
('9415041', '9415', 'KOLF BRAZA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9415050', '9415', 'AKAT'),
('9415051', '9415', 'JETSY'),
('9415060', '9415', 'AGATS'),
('9415070', '9415', 'SAWA ERMA'),
('9415071', '9415', 'SURU-SURU'),
('9415072', '9415', 'UNIR SIRAU'),
('9415073', '9415', 'JOERAT'),
('9415074', '9415', 'PULAU TIGA'),
('9416010', '9416', 'KURIMA'),
('9416011', '9416', 'MUSAIK'),
('9416013', '9416', 'DEKAI'),
('9416014', '9416', 'OBIO'),
('9416015', '9416', 'PASEMA'),
('9416016', '9416', 'AMUMA'),
('9416017', '9416', 'SURU-SURU'),
('9416018', '9416', 'WUSAMA'),
('9416019', '9416', 'SILIMO'),
('9416020', '9416', 'NINIA'),
('9416021', '9416', 'HOLUWON'),
('9416022', '9416', 'LOLAT'),
('9416023', '9416', 'LANGDA'),
('9416024', '9416', 'BOMELA'),
('9416025', '9416', 'SUNTAMON'),
('9416026', '9416', 'SOBAHAM'),
('9416027', '9416', 'KORUPUN'),
('9416028', '9416', 'SELA'),
('9416029', '9416', 'KWELAMDUA'),
('9416030', '9416', 'ANGGRUK'),
('9416031', '9416', 'PANGGEMA'),
('9416032', '9416', 'WALMA'),
('9416033', '9416', 'KOSAREK'),
('9416034', '9416', 'UBAHAK'),
('9416035', '9416', 'NALCA'),
('9416036', '9416', 'PULDAMA'),
('9416037', '9416', 'NIPSAN'),
('9416041', '9416', 'SAMENAGE'),
('9416042', '9416', 'TANGMA'),
('9416043', '9416', 'SOBA'),
('9416044', '9416', 'MUGI'),
('9416045', '9416', 'YOGOSEM'),
('9416046', '9416', 'KAYO'),
('9416047', '9416', 'SUMO'),
('9416048', '9416', 'HOGIO'),
('9416049', '9416', 'UKHA'),
('9416051', '9416', 'WERIMA'),
('9416052', '9416', 'SOLOIKMA'),
('9416053', '9416', 'SERADALA'),
('9416054', '9416', 'KABIANGGAMA'),
('9416055', '9416', 'KWIKMA'),
('9416056', '9416', 'HILIPUK');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9416057', '9416', 'YAHULIAMBUT'),
('9416058', '9416', 'HEREAPINI'),
('9416059', '9416', 'UBALIHI'),
('9416061', '9416', 'TALAMBO'),
('9416062', '9416', 'PRONGGOLI'),
('9416063', '9416', 'ENDOMEN'),
('9416065', '9416', 'KONA'),
('9416066', '9416', 'DURAM'),
('9416067', '9416', 'DIRWEMNA'),
('9417010', '9417', 'IWUR'),
('9417011', '9417', 'KAWOR'),
('9417012', '9417', 'TARUP'),
('9417013', '9417', 'AWINBON'),
('9417020', '9417', 'OKSIBIL'),
('9417021', '9417', 'PEPERA'),
('9417022', '9417', 'ALEMSOM'),
('9417023', '9417', 'SERAMBAKON'),
('9417024', '9417', 'KOLOMDOL'),
('9417025', '9417', 'OKSOP'),
('9417026', '9417', 'OK BAPE'),
('9417027', '9417', 'OK AON'),
('9417030', '9417', 'BORME'),
('9417031', '9417', 'BIME'),
('9417032', '9417', 'EPUMEK'),
('9417033', '9417', 'WEIME'),
('9417034', '9417', 'PAMEK'),
('9417035', '9417', 'NONGME'),
('9417036', '9417', 'BATANI'),
('9417040', '9417', 'OKBI'),
('9417041', '9417', 'ABOY'),
('9417042', '9417', 'OKBAB'),
('9417043', '9417', 'TEIRAPLU'),
('9417044', '9417', 'YEFTA'),
('9417050', '9417', 'KIWIROK'),
('9417051', '9417', 'KIWIROK TIMUR'),
('9417052', '9417', 'OKSEBANG'),
('9417053', '9417', 'OKHIKA'),
('9417054', '9417', 'OKLIP'),
('9417055', '9417', 'OKSAMOL'),
('9417056', '9417', 'OKBEMTA'),
('9417060', '9417', 'BATOM'),
('9417061', '9417', 'MURKIM'),
('9417062', '9417', 'MOFINOP'),
('9418010', '9418', 'KANGGIME'),
('9418011', '9418', 'WONIKI'),
('9418012', '9418', 'NABUNAGE'),
('9418013', '9418', 'GILUBANDU'),
('9418014', '9418', 'WAKUO'),
('9418015', '9418', 'AWEKU'),
('9418016', '9418', 'BOGONUK');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9418020', '9418', 'KARUBAGA'),
('9418021', '9418', 'GOYAGE'),
('9418022', '9418', 'WUNIN'),
('9418023', '9418', 'KONDAGA'),
('9418024', '9418', 'NELAWI'),
('9418025', '9418', 'KUARI'),
('9418026', '9418', 'LIANOGOMA'),
('9418027', '9418', 'BIUK'),
('9418030', '9418', 'BOKONDINI'),
('9418031', '9418', 'BOKONERI'),
('9418032', '9418', 'BEWANI'),
('9418040', '9418', 'KEMBU'),
('9418041', '9418', 'WINA'),
('9418042', '9418', 'UMAGI'),
('9418043', '9418', 'PANAGA'),
('9418044', '9418', 'POGANERI'),
('9418045', '9418', 'KAMBONERI'),
('9418046', '9418', 'AIR GARAM'),
('9418047', '9418', 'DOW'),
('9418048', '9418', 'WARI / TAIYEVE'),
('9418049', '9418', 'EGIAM'),
('9418051', '9418', 'NUNGGAWI'),
('9418060', '9418', 'KUBU'),
('9418061', '9418', 'ANAWI'),
('9418062', '9418', 'WUGI'),
('9418070', '9418', 'GEYA'),
('9418071', '9418', 'WENAM'),
('9418080', '9418', 'NUMBA'),
('9418081', '9418', 'KAI'),
('9418090', '9418', 'DUNDU'),
('9418100', '9418', 'GUNDAGI'),
('9418110', '9418', 'TIMORI'),
('9418121', '9418', 'YUNERI'),
('9418125', '9418', 'TAGIME'),
('9418126', '9418', 'DANIME'),
('9418127', '9418', 'YUKO'),
('9418541', '9418', 'TELENGGEME'),
('9418542', '9418', 'GIKA'),
('9418543', '9418', 'TAGINERI'),
('9419021', '9419', 'PANTAI TIMUR BAGIAN BARAT'),
('9419022', '9419', 'PANTAI TIMUR'),
('9419024', '9419', 'SUNGAI BIRI'),
('9419031', '9419', 'BONGGO'),
('9419032', '9419', 'BONGGO TIMUR'),
('9419033', '9419', 'BONGGO BARAT'),
('9419040', '9419', 'TOR ATAS'),
('9419041', '9419', 'ISMARI'),
('9419050', '9419', 'SARMI'),
('9419051', '9419', 'SARMI TIMUR'),
('9419052', '9419', 'SARMI SELATAN');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9419053', '9419', 'SOBEY'),
('9419054', '9419', 'MUARA TOR'),
('9419055', '9419', 'VERKAM'),
('9419060', '9419', '<NAME>'),
('9419061', '9419', 'AP<NAME>U'),
('9419062', '9419', 'APAWER HILIR'),
('9419063', '9419', 'APAWER TENGAH'),
('9420010', '9420', 'WEB'),
('9420011', '9420', 'TOWE'),
('9420020', '9420', 'SENGGI'),
('9420030', '9420', 'WARIS'),
('9420040', '9420', 'ARSO'),
('9420041', '9420', '<NAME>'),
('9420050', '9420', 'SKANTO'),
('9426010', '9426', 'WAROPEN BAWAH'),
('9426011', '9426', 'INGGERUS'),
('9426012', '9426', '<NAME>'),
('9426013', '9426', 'OUDATE'),
('9426014', '9426', 'WAPOGA'),
('9426020', '9426', 'MASIREI'),
('9426021', '9426', '<NAME>'),
('9426022', '9426', 'DEMBA'),
('9426030', '9426', 'WALANI'),
('9426040', '9426', 'KIRIHI'),
('9427010', '9427', 'SU<NAME>'),
('9427011', '9427', '<NAME>'),
('9427020', '9427', '<NAME>'),
('9427021', '9427', '<NAME>'),
('9427030', '9427', '<NAME>'),
('9428030', '9428', 'WAR<NAME>'),
('9428031', '9428', 'BENUKI'),
('9428032', '9428', 'SAWAI'),
('9428040', '9428', '<NAME>'),
('9428050', '9428', '<NAME>'),
('9428051', '9428', 'IWASO'),
('9428060', '9428', '<NAME>'),
('9428070', '9428', 'ROFAER'),
('9428080', '9428', '<NAME>'),
('9429010', '9429', 'WOSAK'),
('9429020', '9429', 'KENYAM'),
('9429030', '9429', 'GESELMA'),
('9429040', '9429', 'MAPENDUMA'),
('9429050', '9429', 'MUGI'),
('9429060', '9429', 'YIGI'),
('9429070', '9429', 'MBUWA'),
('9429080', '9429', 'GEAREK'),
('9430010', '9430', 'MAKKI'),
('9430011', '9430', 'GUPURA'),
('9430012', '9430', 'KOLAWA'),
('9430013', '9430', 'GELOK BEAM');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9430020', '9430', 'PIRIME'),
('9430021', '9430', 'BUGUK GONA'),
('9430022', '9430', 'MILIMBO'),
('9430023', '9430', 'GOLLO'),
('9430024', '9430', 'WIRINGGABUT'),
('9430030', '9430', 'TIOM'),
('9430031', '9430', 'NOGI'),
('9430032', '9430', 'MOKONI'),
('9430033', '9430', 'NINAME'),
('9430034', '9430', 'YIGINUA'),
('9430040', '9430', 'BALINGGA'),
('9430041', '9430', '<NAME>AT'),
('9430042', '9430', 'BRUWA'),
('9430050', '9430', 'KUYAWAGE'),
('9430051', '9430', 'WANO BARAT'),
('9430060', '9430', 'MALAGAINERI'),
('9430061', '9430', 'MELAGAI'),
('9430070', '9430', 'TIOMNERI'),
('9430071', '9430', 'WEREKA'),
('9430080', '9430', 'DIMBA'),
('9430081', '9430', 'KELULOME'),
('9430090', '9430', 'GAMELIA'),
('9430091', '9430', 'KARU'),
('9430092', '9430', 'YILUK'),
('9430093', '9430', 'GUNA'),
('9430100', '9430', 'POGA'),
('9430101', '9430', 'MUARA'),
('9431010', '9431', 'KOBAKMA'),
('9431020', '9431', 'ILUGWA'),
('9431030', '9431', 'KELILA'),
('9431040', '9431', 'ERAGAYAM'),
('9431050', '9431', 'MEGAMBILIS'),
('9432010', '9432', 'WELAREK'),
('9432020', '9432', 'APALAPSILI'),
('9432030', '9432', 'ABENAHO'),
('9432040', '9432', 'ELELIM'),
('9432050', '9432', 'BENAWA'),
('9433010', '9433', 'AGADUGUME'),
('9433020', '9433', 'GOME'),
('9433030', '9433', 'ILAGA'),
('9433040', '9433', 'SINAK'),
('9433050', '9433', 'POGOMA'),
('9433060', '9433', 'WANGBE'),
('9433070', '9433', 'BEOGA'),
('9433080', '9433', 'DOUFO'),
('9434010', '9434', 'SUKIKAI SELATAN'),
('9434020', '9434', 'PIYAIYE'),
('9434030', '9434', 'MAPIA BARAT'),
('9434040', '9434', 'MAPIA TENGAH'),
('9434050', '9434', 'MAPIA');
INSERT INTO `districts` (`id`, `city_id`, `description`) VALUES
('9434060', '9434', 'DOGIYAI'),
('9434070', '9434', 'KAMU SELATAN'),
('9434080', '9434', 'KAMU'),
('9434090', '9434', 'KAMU TIMUR'),
('9434100', '9434', 'KAMU UTARA'),
('9435010', '9435', 'HOMEYO'),
('9435020', '9435', 'SUGAPA'),
('9435030', '9435', 'HITADIPA'),
('9435040', '9435', 'AGISIGA'),
('9435050', '9435', 'BIANDOGA'),
('9435060', '9435', 'WANDAI'),
('9436010', '9436', 'KAPIRAYA'),
('9436020', '9436', 'TIGI BARAT'),
('9436030', '9436', 'TIGI'),
('9436040', '9436', 'TIGI TIMUR'),
('9436050', '9436', 'BOWOBADO'),
('9471010', '9471', 'MUARA TAMI'),
('9471020', '9471', 'ABEPURA'),
('9471021', '9471', 'HERAM'),
('9471030', '9471', 'JAYAPURA SELATAN'),
('9471040', '9471', 'JAYAPURA UTARA');
|
<gh_stars>0
CREATE SCHEMA IF NOT EXISTS users;
SET search_path TO users;
GRANT usage ON SCHEMA users to user;
create table if not exists user_cohorts (
user_id varchar(64) not null,
shard int4 NOT NULL,
ups_id varchar(64) null,
cohort_id varchar(64) not null,
cohort_name varchar(128) null,
cohort_value varchar(128) null,
pending_deletion boolean not null default false,
pending_export boolean not null default true,
created_at timestamp not null default NOW()
);
create index user_cohorts_users on user_cohorts(user_id);
create index user_cohorts_shards on user_cohorts(shard);
create index user_cohorts_cohorts on user_cohorts(cohort_id);
create index user_cohorts_created on user_cohorts(created_at);
CREATE TABLE users (
id varchar(64) NOT NULL,
shard int4 NOT NULL,
premium bool NULL,
application varchar(32) NOT NULL,
app_version varchar(32),
premium_expiration timestamp NULL,
experiment varchar(128) NULL,
sessions_30d int4 NULL,
in_app_message_displayed_30d int4 NULL,
last_session timestamp NOT NULL,
device_model varchar(256) NULL,
CONSTRAINT users_pkey PRIMARY KEY (id)
);
CREATE TABLE users_pi (
id varchar(64) NOT NULL,
ups_id varchar(64) NULL,
CONSTRAINT users_pi_pkey PRIMARY KEY (id)
);
CREATE TABLE users.user_features (
user_id varchar(64) NOT NULL,
shard int4 NOT NULL,
test_feature_number int4 NULL,
test_feature_list varchar(2)[] NULL,
test_feature_json jsonb NULL,
created_at timestamp not null default NOW(),
CONSTRAINT user_features_pkey PRIMARY KEY (user_id)
);
create index users_pi_upsid on users_pi(ups_id);
create index users_application on users(application);
|
<gh_stars>0
CREATE TABLE process_definitions_actions
(
id int(11) NOT NULL AUTO_INCREMENT primary key,
name varchar(255),
hashcode varchar(255),
pdn_id int(11),
active int(1) NOT NULL DEFAULT 1,
created_at datetime,
created_by varchar(45),
updated_at datetime,
updated_by varchar(45)
); |
<gh_stars>0
CREATE PROCEDURE [procfwkHelpers].[SetDefaultSubscription]
AS
BEGIN
DECLARE @Subscriptions TABLE
(
[SubscriptionId] UNIQUEIDENTIFIER NOT NULL,
[Name] NVARCHAR(200) NOT NULL,
[Description] NVARCHAR(MAX) NULL,
[TenantId] UNIQUEIDENTIFIER NOT NULL
)
INSERT INTO @Subscriptions
(
[SubscriptionId],
[Name],
[Description],
[TenantId]
)
VALUES
('12345678-1234-1234-1234-012345678910', 'Default', 'Example value for development environment.', '12345678-1234-1234-1234-012345678910');
MERGE INTO [procfwk].[Subscriptions] AS tgt
USING
@Subscriptions AS src
ON tgt.[SubscriptionId] = src.[SubscriptionId]
WHEN MATCHED THEN
UPDATE
SET
tgt.[Name] = src.[Name],
tgt.[Description] = src.[Description],
tgt.[TenantId] = src.[TenantId]
WHEN NOT MATCHED BY TARGET THEN
INSERT
(
[SubscriptionId],
[Name],
[Description],
[TenantId]
)
VALUES
(
src.[SubscriptionId],
src.[Name],
src.[Description],
src.[TenantId]
)
WHEN NOT MATCHED BY SOURCE THEN
DELETE;
END; |
<filename>07.IntroToSQLHomework/15.OrderEmployeesBySalaryDescending.sql
use TelerikAcademy;
select FirstName, LastName, Salary from Employees
where Salary > 50000
order by -Salary; |
create database T_Peoples
use T_Peoples
create table Funcionarios
(
IdFuncionario int primary key identity
,Nome varchar(255) not null
,Sobrenome varchar(255) not null
); |
<filename>sql/tms_company_service_20200313.sql
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 13, 2020 at 11:20 AM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `tms_company_service`
--
-- --------------------------------------------------------
--
-- Table structure for table `application`
--
CREATE TABLE `application` (
`id` int(10) UNSIGNED NOT NULL,
`application_id` varchar(16) NOT NULL,
`course_id` tinyint(3) UNSIGNED NOT NULL,
`learner_id` varchar(64) NOT NULL,
`company_id` varchar(64) NOT NULL,
`ct_ms_expiry` date DEFAULT NULL,
`photocopy_id` varchar(64) NOT NULL,
`cet_acknowledgment` varchar(64) NOT NULL,
`full_payment` tinyint(3) UNSIGNED DEFAULT NULL COMMENT '0:no,1:yes',
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `application_doc`
--
CREATE TABLE `application_doc` (
`application_doc_id` varchar(64) NOT NULL,
`application_doc_type` tinyint(3) UNSIGNED NOT NULL COMMENT '0:id photocopy, 1:CET Acknowledgement',
`filepath` int(11) NOT NULL,
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `company`
--
CREATE TABLE `company` (
`id` int(10) UNSIGNED NOT NULL,
`company_id` text NOT NULL COMMENT 'hash of UEN',
`company_name` varchar(128) NOT NULL,
`uen` varchar(10) NOT NULL,
`contact_person` varchar(128) NOT NULL,
`contact_number` varchar(16) NOT NULL,
`fax` varchar(16) NOT NULL,
`postal_code` int(6) UNSIGNED NOT NULL,
`street` varchar(256) NOT NULL,
`unit` varchar(8) NOT NULL,
`payment_terms` tinyint(3) UNSIGNED NOT NULL COMMENT '0:COD,1:30 Days',
`sales_person` varchar(256) NOT NULL COMMENT 'an array of sales person user_id',
`status` tinyint(3) UNSIGNED NOT NULL COMMENT '0:inactive,1:active',
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `company`
--
INSERT INTO `company` (`id`, `company_id`, `company_name`, `uen`, `contact_person`, `contact_number`, `fax`, `postal_code`, `street`, `unit`, `payment_terms`, `sales_person`, `status`, `datetime_created`, `datetime_updated`) VALUES
(1, 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'DEFH Pte Co.Ltd', 'avcdserew', 'DPEH Admin', '097965423', ' 212-555-1234', 11071, 'orchad ', '11', 1, 'e313640c6e25ec148d4c563bd7d02add1a41bc212665006f9c7e54e47596ce9b', 1, '2020-03-05 08:57:01', '2020-03-05 08:57:01'),
(2, 'b3a8e0e1f9ab1bfe3a36f231f676f78bb30a519d2b21e6c530c0eee8ebb4a5d0', 'SUNLIFE', 'sfssds34', 'SUNLIFE Admin', '097861354', '212-555-1234', 11056, 'Abingdon Road Singapore', '222', 2, '9c86356ef997944e886953f1b814e52ddb5948384d2a6b6e08c60aac137dc71e', 1, '2020-03-05 09:02:17', '2020-03-05 09:02:55');
-- --------------------------------------------------------
--
-- Table structure for table `countries`
--
CREATE TABLE `countries` (
`id` int(11) NOT NULL,
`country_code` varchar(2) NOT NULL DEFAULT '',
`country_name` varchar(100) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `countries`
--
INSERT INTO `countries` (`id`, `country_code`, `country_name`) VALUES
(1, 'AF', 'Afghanistan'),
(2, 'AL', 'Albania'),
(3, 'DZ', 'Algeria'),
(4, 'DS', 'American Samoa'),
(5, 'AD', 'Andorra'),
(6, 'AO', 'Angola'),
(7, 'AI', 'Anguilla'),
(8, 'AQ', 'Antarctica'),
(9, 'AG', 'Antigua and Barbuda'),
(10, 'AR', 'Argentina'),
(11, 'AM', 'Armenia'),
(12, 'AW', 'Aruba'),
(13, 'AU', 'Australia'),
(14, 'AT', 'Austria'),
(15, 'AZ', 'Azerbaijan'),
(16, 'BS', 'Bahamas'),
(17, 'BH', 'Bahrain'),
(18, 'BD', 'Bangladesh'),
(19, 'BB', 'Barbados'),
(20, 'BY', 'Belarus'),
(21, 'BE', 'Belgium'),
(22, 'BZ', 'Belize'),
(23, 'BJ', 'Benin'),
(24, 'BM', 'Bermuda'),
(25, 'BT', 'Bhutan'),
(26, 'BO', 'Bolivia'),
(27, 'BA', 'Bosnia and Herzegovina'),
(28, 'BW', 'Botswana'),
(29, 'BV', 'Bouvet Island'),
(30, 'BR', 'Brazil'),
(31, 'IO', 'British Indian Ocean Territory'),
(32, 'BN', 'Brunei Darussalam'),
(33, 'BG', 'Bulgaria'),
(34, 'BF', 'Burkina Faso'),
(35, 'BI', 'Burundi'),
(36, 'KH', 'Cambodia'),
(37, 'CM', 'Cameroon'),
(38, 'CA', 'Canada'),
(39, 'CV', 'Cape Verde'),
(40, 'KY', 'Cayman Islands'),
(41, 'CF', 'Central African Republic'),
(42, 'TD', 'Chad'),
(43, 'CL', 'Chile'),
(44, 'CN', 'China'),
(45, 'CX', 'Christmas Island'),
(46, 'CC', 'Cocos (Keeling) Islands'),
(47, 'CO', 'Colombia'),
(48, 'KM', 'Comoros'),
(49, 'CD', 'Democratic Republic of the Congo'),
(50, 'CG', 'Republic of Congo'),
(51, 'CK', 'Cook Islands'),
(52, 'CR', 'Costa Rica'),
(53, 'HR', 'Croatia (Hrvatska)'),
(54, 'CU', 'Cuba'),
(55, 'CY', 'Cyprus'),
(56, 'CZ', 'Czech Republic'),
(57, 'DK', 'Denmark'),
(58, 'DJ', 'Djibouti'),
(59, 'DM', 'Dominica'),
(60, 'DO', 'Dominican Republic'),
(61, 'TP', 'East Timor'),
(62, 'EC', 'Ecuador'),
(63, 'EG', 'Egypt'),
(64, 'SV', 'El Salvador'),
(65, 'GQ', 'Equatorial Guinea'),
(66, 'ER', 'Eritrea'),
(67, 'EE', 'Estonia'),
(68, 'ET', 'Ethiopia'),
(69, 'FK', 'Falkland Islands (Malvinas)'),
(70, 'FO', 'Faroe Islands'),
(71, 'FJ', 'Fiji'),
(72, 'FI', 'Finland'),
(73, 'FR', 'France'),
(74, 'FX', 'France, Metropolitan'),
(75, 'GF', 'French Guiana'),
(76, 'PF', 'French Polynesia'),
(77, 'TF', 'French Southern Territories'),
(78, 'GA', 'Gabon'),
(79, 'GM', 'Gambia'),
(80, 'GE', 'Georgia'),
(81, 'DE', 'Germany'),
(82, 'GH', 'Ghana'),
(83, 'GI', 'Gibraltar'),
(84, 'GK', 'Guernsey'),
(85, 'GR', 'Greece'),
(86, 'GL', 'Greenland'),
(87, 'GD', 'Grenada'),
(88, 'GP', 'Guadeloupe'),
(89, 'GU', 'Guam'),
(90, 'GT', 'Guatemala'),
(91, 'GN', 'Guinea'),
(92, 'GW', 'Guinea-Bissau'),
(93, 'GY', 'Guyana'),
(94, 'HT', 'Haiti'),
(95, 'HM', 'Heard and Mc Donald Islands'),
(96, 'HN', 'Honduras'),
(97, 'HK', 'Hong Kong'),
(98, 'HU', 'Hungary'),
(99, 'IS', 'Iceland'),
(100, 'IN', 'India'),
(101, 'IM', 'Isle of Man'),
(102, 'ID', 'Indonesia'),
(103, 'IR', 'Iran (Islamic Republic of)'),
(104, 'IQ', 'Iraq'),
(105, 'IE', 'Ireland'),
(106, 'IL', 'Israel'),
(107, 'IT', 'Italy'),
(108, 'CI', 'Ivory Coast'),
(109, 'JE', 'Jersey'),
(110, 'JM', 'Jamaica'),
(111, 'JP', 'Japan'),
(112, 'JO', 'Jordan'),
(113, 'KZ', 'Kazakhstan'),
(114, 'KE', 'Kenya'),
(115, 'KI', 'Kiribati'),
(116, 'KP', 'Korea, Democratic People\'s Republic of'),
(117, 'KR', 'Korea, Republic of'),
(118, 'XK', 'Kosovo'),
(119, 'KW', 'Kuwait'),
(120, 'KG', 'Kyrgyzstan'),
(121, 'LA', 'Lao People\'s Democratic Republic'),
(122, 'LV', 'Latvia'),
(123, 'LB', 'Lebanon'),
(124, 'LS', 'Lesotho'),
(125, 'LR', 'Liberia'),
(126, 'LY', 'Libyan Arab Jamahiriya'),
(127, 'LI', 'Liechtenstein'),
(128, 'LT', 'Lithuania'),
(129, 'LU', 'Luxembourg'),
(130, 'MO', 'Macau'),
(131, 'MK', 'North Macedonia'),
(132, 'MG', 'Madagascar'),
(133, 'MW', 'Malawi'),
(134, 'MY', 'Malaysia'),
(135, 'MV', 'Maldives'),
(136, 'ML', 'Mali'),
(137, 'MT', 'Malta'),
(138, 'MH', 'Marshall Islands'),
(139, 'MQ', 'Martinique'),
(140, 'MR', 'Mauritania'),
(141, 'MU', 'Mauritius'),
(142, 'TY', 'Mayotte'),
(143, 'MX', 'Mexico'),
(144, 'FM', 'Micronesia, Federated States of'),
(145, 'MD', 'Moldova, Republic of'),
(146, 'MC', 'Monaco'),
(147, 'MN', 'Mongolia'),
(148, 'ME', 'Montenegro'),
(149, 'MS', 'Montserrat'),
(150, 'MA', 'Morocco'),
(151, 'MZ', 'Mozambique'),
(152, 'MM', 'Myanmar'),
(153, 'NA', 'Namibia'),
(154, 'NR', 'Nauru'),
(155, 'NP', 'Nepal'),
(156, 'NL', 'Netherlands'),
(157, 'AN', 'Netherlands Antilles'),
(158, 'NC', 'New Caledonia'),
(159, 'NZ', 'New Zealand'),
(160, 'NI', 'Nicaragua'),
(161, 'NE', 'Niger'),
(162, 'NG', 'Nigeria'),
(163, 'NU', 'Niue'),
(164, 'NF', 'Norfolk Island'),
(165, 'MP', 'Northern Mariana Islands'),
(166, 'NO', 'Norway'),
(167, 'OM', 'Oman'),
(168, 'PK', 'Pakistan'),
(169, 'PW', 'Palau'),
(170, 'PS', 'Palestine'),
(171, 'PA', 'Panama'),
(172, 'PG', 'Papua New Guinea'),
(173, 'PY', 'Paraguay'),
(174, 'PE', 'Peru'),
(175, 'PH', 'Philippines'),
(176, 'PN', 'Pitcairn'),
(177, 'PL', 'Poland'),
(178, 'PT', 'Portugal'),
(179, 'PR', 'Puerto Rico'),
(180, 'QA', 'Qatar'),
(181, 'RE', 'Reunion'),
(182, 'RO', 'Romania'),
(183, 'RU', 'Russian Federation'),
(184, 'RW', 'Rwanda'),
(185, 'KN', 'Saint Kitts and Nevis'),
(186, 'LC', 'Saint Lucia'),
(187, 'VC', 'Saint Vincent and the Grenadines'),
(188, 'WS', 'Samoa'),
(189, 'SM', 'San Marino'),
(190, 'ST', 'Sao Tome and Principe'),
(191, 'SA', 'Saudi Arabia'),
(192, 'SN', 'Senegal'),
(193, 'RS', 'Serbia'),
(194, 'SC', 'Seychelles'),
(195, 'SL', 'Sierra Leone'),
(196, 'SG', 'Singapore'),
(197, 'SK', 'Slovakia'),
(198, 'SI', 'Slovenia'),
(199, 'SB', 'Solomon Islands'),
(200, 'SO', 'Somalia'),
(201, 'ZA', 'South Africa'),
(202, 'GS', 'South Georgia South Sandwich Islands'),
(203, 'SS', 'South Sudan'),
(204, 'ES', 'Spain'),
(205, 'LK', 'Sri Lanka'),
(206, 'SH', 'St. Helena'),
(207, 'PM', 'St. Pierre and Miquelon'),
(208, 'SD', 'Sudan'),
(209, 'SR', 'Suriname'),
(210, 'SJ', 'Svalbard and Jan Mayen Islands'),
(211, 'SZ', 'Swaziland'),
(212, 'SE', 'Sweden'),
(213, 'CH', 'Switzerland'),
(214, 'SY', 'Syrian Arab Republic'),
(215, 'TW', 'Taiwan'),
(216, 'TJ', 'Tajikistan'),
(217, 'TZ', 'Tanzania, United Republic of'),
(218, 'TH', 'Thailand'),
(219, 'TG', 'Togo'),
(220, 'TK', 'Tokelau'),
(221, 'TO', 'Tonga'),
(222, 'TT', 'Trinidad and Tobago'),
(223, 'TN', 'Tunisia'),
(224, 'TR', 'Turkey'),
(225, 'TM', 'Turkmenistan'),
(226, 'TC', 'Turks and Caicos Islands'),
(227, 'TV', 'Tuvalu'),
(228, 'UG', 'Uganda'),
(229, 'UA', 'Ukraine'),
(230, 'AE', 'United Arab Emirates'),
(231, 'GB', 'United Kingdom'),
(232, 'US', 'United States'),
(233, 'UM', 'United States minor outlying islands'),
(234, 'UY', 'Uruguay'),
(235, 'UZ', 'Uzbekistan'),
(236, 'VU', 'Vanuatu'),
(237, 'VA', 'Vatican City State'),
(238, 'VE', 'Venezuela'),
(239, 'VN', 'Vietnam'),
(240, 'VG', 'Virgin Islands (British)'),
(241, 'VI', 'Virgin Islands (U.S.)'),
(242, 'WF', 'Wallis and Futuna Islands'),
(243, 'EH', 'Western Sahara'),
(244, 'YE', 'Yemen'),
(245, 'ZM', 'Zambia'),
(246, 'ZW', 'Zimbabwe'),
(247, 'AF', 'Afghanistan'),
(248, 'AL', 'Albania'),
(249, 'DZ', 'Algeria'),
(250, 'DS', 'American Samoa'),
(251, 'AD', 'Andorra'),
(252, 'AO', 'Angola'),
(253, 'AI', 'Anguilla'),
(254, 'AQ', 'Antarctica'),
(255, 'AG', 'Antigua and Barbuda'),
(256, 'AR', 'Argentina'),
(257, 'AM', 'Armenia'),
(258, 'AW', 'Aruba'),
(259, 'AU', 'Australia'),
(260, 'AT', 'Austria'),
(261, 'AZ', 'Azerbaijan'),
(262, 'BS', 'Bahamas'),
(263, 'BH', 'Bahrain'),
(264, 'BD', 'Bangladesh'),
(265, 'BB', 'Barbados'),
(266, 'BY', 'Belarus'),
(267, 'BE', 'Belgium'),
(268, 'BZ', 'Belize'),
(269, 'BJ', 'Benin'),
(270, 'BM', 'Bermuda'),
(271, 'BT', 'Bhutan'),
(272, 'BO', 'Bolivia'),
(273, 'BA', 'Bosnia and Herzegovina'),
(274, 'BW', 'Botswana'),
(275, 'BV', 'Bouvet Island'),
(276, 'BR', 'Brazil'),
(277, 'IO', 'British Indian Ocean Territory'),
(278, 'BN', 'Brunei Darussalam'),
(279, 'BG', 'Bulgaria'),
(280, 'BF', 'Burkina Faso'),
(281, 'BI', 'Burundi'),
(282, 'KH', 'Cambodia'),
(283, 'CM', 'Cameroon'),
(284, 'CA', 'Canada'),
(285, 'CV', 'Cape Verde'),
(286, 'KY', 'Cayman Islands'),
(287, 'CF', 'Central African Republic'),
(288, 'TD', 'Chad'),
(289, 'CL', 'Chile'),
(290, 'CN', 'China'),
(291, 'CX', 'Christmas Island'),
(292, 'CC', 'Cocos (Keeling) Islands'),
(293, 'CO', 'Colombia'),
(294, 'KM', 'Comoros'),
(295, 'CD', 'Democratic Republic of the Congo'),
(296, 'CG', 'Republic of Congo'),
(297, 'CK', 'Cook Islands'),
(298, 'CR', 'Costa Rica'),
(299, 'HR', 'Croatia (Hrvatska)'),
(300, 'CU', 'Cuba'),
(301, 'CY', 'Cyprus'),
(302, 'CZ', 'Czech Republic'),
(303, 'DK', 'Denmark'),
(304, 'DJ', 'Djibouti'),
(305, 'DM', 'Dominica'),
(306, 'DO', 'Dominican Republic'),
(307, 'TP', 'East Timor'),
(308, 'EC', 'Ecuador'),
(309, 'EG', 'Egypt'),
(310, 'SV', 'El Salvador'),
(311, 'GQ', 'Equatorial Guinea'),
(312, 'ER', 'Eritrea'),
(313, 'EE', 'Estonia'),
(314, 'ET', 'Ethiopia'),
(315, 'FK', 'Falkland Islands (Malvinas)'),
(316, 'FO', 'Faroe Islands'),
(317, 'FJ', 'Fiji'),
(318, 'FI', 'Finland'),
(319, 'FR', 'France'),
(320, 'FX', 'France, Metropolitan'),
(321, 'GF', 'French Guiana'),
(322, 'PF', 'French Polynesia'),
(323, 'TF', 'French Southern Territories'),
(324, 'GA', 'Gabon'),
(325, 'GM', 'Gambia'),
(326, 'GE', 'Georgia'),
(327, 'DE', 'Germany'),
(328, 'GH', 'Ghana'),
(329, 'GI', 'Gibraltar'),
(330, 'GK', 'Guernsey'),
(331, 'GR', 'Greece'),
(332, 'GL', 'Greenland'),
(333, 'GD', 'Grenada'),
(334, 'GP', 'Guadeloupe'),
(335, 'GU', 'Guam'),
(336, 'GT', 'Guatemala'),
(337, 'GN', 'Guinea'),
(338, 'GW', 'Guinea-Bissau'),
(339, 'GY', 'Guyana'),
(340, 'HT', 'Haiti'),
(341, 'HM', 'Heard and Mc Donald Islands'),
(342, 'HN', 'Honduras'),
(343, 'HK', 'Hong Kong'),
(344, 'HU', 'Hungary'),
(345, 'IS', 'Iceland'),
(346, 'IN', 'India'),
(347, 'IM', 'Isle of Man'),
(348, 'ID', 'Indonesia'),
(349, 'IR', 'Iran (Islamic Republic of)'),
(350, 'IQ', 'Iraq'),
(351, 'IE', 'Ireland'),
(352, 'IL', 'Israel'),
(353, 'IT', 'Italy'),
(354, 'CI', 'Ivory Coast'),
(355, 'JE', 'Jersey'),
(356, 'JM', 'Jamaica'),
(357, 'JP', 'Japan'),
(358, 'JO', 'Jordan'),
(359, 'KZ', 'Kazakhstan'),
(360, 'KE', 'Kenya'),
(361, 'KI', 'Kiribati'),
(362, 'KP', 'Korea, Democratic People\'s Republic of'),
(363, 'KR', 'Korea, Republic of'),
(364, 'XK', 'Kosovo'),
(365, 'KW', 'Kuwait'),
(366, 'KG', 'Kyrgyzstan'),
(367, 'LA', 'Lao People\'s Democratic Republic'),
(368, 'LV', 'Latvia'),
(369, 'LB', 'Lebanon'),
(370, 'LS', 'Lesotho'),
(371, 'LR', 'Liberia'),
(372, 'LY', 'Libyan Arab Jamahiriya'),
(373, 'LI', 'Liechtenstein'),
(374, 'LT', 'Lithuania'),
(375, 'LU', 'Luxembourg'),
(376, 'MO', 'Macau'),
(377, 'MK', 'North Macedonia'),
(378, 'MG', 'Madagascar'),
(379, 'MW', 'Malawi'),
(380, 'MY', 'Malaysia'),
(381, 'MV', 'Maldives'),
(382, 'ML', 'Mali'),
(383, 'MT', 'Malta'),
(384, 'MH', 'Marshall Islands'),
(385, 'MQ', 'Martinique'),
(386, 'MR', 'Mauritania'),
(387, 'MU', 'Mauritius'),
(388, 'TY', 'Mayotte'),
(389, 'MX', 'Mexico'),
(390, 'FM', 'Micronesia, Federated States of'),
(391, 'MD', 'Moldova, Republic of'),
(392, 'MC', 'Monaco'),
(393, 'MN', 'Mongolia'),
(394, 'ME', 'Montenegro'),
(395, 'MS', 'Montserrat'),
(396, 'MA', 'Morocco'),
(397, 'MZ', 'Mozambique'),
(398, 'MM', 'Myanmar'),
(399, 'NA', 'Namibia'),
(400, 'NR', 'Nauru'),
(401, 'NP', 'Nepal'),
(402, 'NL', 'Netherlands'),
(403, 'AN', 'Netherlands Antilles'),
(404, 'NC', 'New Caledonia'),
(405, 'NZ', 'New Zealand'),
(406, 'NI', 'Nicaragua'),
(407, 'NE', 'Niger'),
(408, 'NG', 'Nigeria'),
(409, 'NU', 'Niue'),
(410, 'NF', 'Norfolk Island'),
(411, 'MP', 'Northern Mariana Islands'),
(412, 'NO', 'Norway'),
(413, 'OM', 'Oman'),
(414, 'PK', 'Pakistan'),
(415, 'PW', 'Palau'),
(416, 'PS', 'Palestine'),
(417, 'PA', 'Panama'),
(418, 'PG', 'Papua New Guinea'),
(419, 'PY', 'Paraguay'),
(420, 'PE', 'Peru'),
(421, 'PH', 'Philippines'),
(422, 'PN', 'Pitcairn'),
(423, 'PL', 'Poland'),
(424, 'PT', 'Portugal'),
(425, 'PR', 'Puerto Rico'),
(426, 'QA', 'Qatar'),
(427, 'RE', 'Reunion'),
(428, 'RO', 'Romania'),
(429, 'RU', 'Russian Federation'),
(430, 'RW', 'Rwanda'),
(431, 'KN', 'Saint Kitts and Nevis'),
(432, 'LC', 'Saint Lucia'),
(433, 'VC', 'Saint Vincent and the Grenadines'),
(434, 'WS', 'Samoa'),
(435, 'SM', 'San Marino'),
(436, 'ST', 'Sao Tome and Principe'),
(437, 'SA', 'Saudi Arabia'),
(438, 'SN', 'Senegal'),
(439, 'RS', 'Serbia'),
(440, 'SC', 'Seychelles'),
(441, 'SL', 'Sierra Leone'),
(442, 'SG', 'Singapore'),
(443, 'SK', 'Slovakia'),
(444, 'SI', 'Slovenia'),
(445, 'SB', 'Solomon Islands'),
(446, 'SO', 'Somalia'),
(447, 'ZA', 'South Africa'),
(448, 'GS', 'South Georgia South Sandwich Islands'),
(449, 'SS', 'South Sudan'),
(450, 'ES', 'Spain'),
(451, 'LK', 'Sri Lanka'),
(452, 'SH', 'St. Helena'),
(453, 'PM', 'St. Pierre and Miquelon'),
(454, 'SD', 'Sudan'),
(455, 'SR', 'Suriname'),
(456, 'SJ', 'Svalbard and Jan Mayen Islands'),
(457, 'SZ', 'Swaziland'),
(458, 'SE', 'Sweden'),
(459, 'CH', 'Switzerland'),
(460, 'SY', 'Syrian Arab Republic'),
(461, 'TW', 'Taiwan'),
(462, 'TJ', 'Tajikistan'),
(463, 'TZ', 'Tanzania, United Republic of'),
(464, 'TH', 'Thailand'),
(465, 'TG', 'Togo'),
(466, 'TK', 'Tokelau'),
(467, 'TO', 'Tonga'),
(468, 'TT', 'Trinidad and Tobago'),
(469, 'TN', 'Tunisia'),
(470, 'TR', 'Turkey'),
(471, 'TM', 'Turkmenistan'),
(472, 'TC', 'Turks and Caicos Islands'),
(473, 'TV', 'Tuvalu'),
(474, 'UG', 'Uganda'),
(475, 'UA', 'Ukraine'),
(476, 'AE', 'United Arab Emirates'),
(477, 'GB', 'United Kingdom'),
(478, 'US', 'United States'),
(479, 'UM', 'United States minor outlying islands'),
(480, 'UY', 'Uruguay'),
(481, 'UZ', 'Uzbekistan'),
(482, 'VU', 'Vanuatu'),
(483, 'VA', 'Vatican City State'),
(484, 'VE', 'Venezuela'),
(485, 'VN', 'Vietnam'),
(486, 'VG', 'Virgin Islands (British)'),
(487, 'VI', 'Virgin Islands (U.S.)'),
(488, 'WF', 'Wallis and Futuna Islands'),
(489, 'EH', 'Western Sahara'),
(490, 'YE', 'Yemen'),
(491, 'ZM', 'Zambia'),
(492, 'ZW', 'Zimbabwe');
-- --------------------------------------------------------
--
-- Table structure for table `learner`
--
CREATE TABLE `learner` (
`id` int(11) NOT NULL,
`learner_id` varchar(64) NOT NULL COMMENT 'hash of nric/pp no.',
`name` varchar(128) NOT NULL,
`nric` varchar(16) NOT NULL,
`work_permit` varchar(10) NOT NULL,
`nationality` tinyint(3) UNSIGNED NOT NULL,
`dob` date NOT NULL,
`sex` tinyint(1) UNSIGNED NOT NULL COMMENT '0:female,1:male',
`contact_no` varchar(10) NOT NULL,
`learner_manager` varchar(64) NOT NULL COMMENT 'learner_manager_id',
`coretrade_expiry` date DEFAULT NULL,
`account_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '0:inactive,1:active',
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `learner`
--
INSERT INTO `learner` (`id`, `learner_id`, `name`, `nric`, `work_permit`, `nationality`, `dob`, `sex`, `contact_no`, `learner_manager`, `coretrade_expiry`, `account_status`, `datetime_created`, `datetime_updated`) VALUES
(1, '4943b2917a57ed619473afcf7d45e028c1837d8db2451dae85c2e57ba57f3e5f', 'SSM', 'MB1234567', 'AB123456', 2, '1994-11-22', 1, '097856123', 'SUSU', '2023-10-06', 0, '2020-03-05 10:16:23', '2020-03-13 07:38:43'),
(2, '4943b2917a57ed619473afcf7d45e028c1837d8db2451dae85c2e57ba57f3e5f', 'SSK', 'MB1234567', 'AB123456', 2, '1994-11-22', 1, '097856123', 'SUSU', '2023-10-06', 1, '2020-03-05 10:19:37', '2020-03-05 10:19:37');
-- --------------------------------------------------------
--
-- Table structure for table `learners_results`
--
CREATE TABLE `learners_results` (
`id` int(11) NOT NULL,
`learner_id` varchar(64) NOT NULL,
`event_id` int(11) NOT NULL COMMENT 'fk events.id',
`result` tinyint(1) NOT NULL COMMENT '1:pass,2:Not Competent,3:Retest',
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `learners_results`
--
INSERT INTO `learners_results` (`id`, `learner_id`, `event_id`, `result`, `datetime_created`, `datetime_updated`) VALUES
(1, '4943b2917a57ed619473afcf7d45e028c1837d8db2451dae85c2e57ba57f3e5f', 1, 3, '2020-03-13 08:36:26', '2020-03-13 08:10:39');
-- --------------------------------------------------------
--
-- Table structure for table `learner_manager`
--
CREATE TABLE `learner_manager` (
`id` int(11) NOT NULL,
`learner_manager_id` varchar(64) NOT NULL COMMENT 'hash of nric field',
`name` varchar(128) NOT NULL,
`nric` varchar(16) NOT NULL,
`work_permit` varchar(10) NOT NULL,
`nationality` tinyint(4) NOT NULL,
`dob` date NOT NULL,
`sex` tinyint(1) NOT NULL COMMENT '0:femaile,1:male',
`contact_no` varchar(10) NOT NULL,
`email` varchar(64) NOT NULL,
`company_id` varchar(64) NOT NULL,
`account_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '0:inactive,1:active',
`datetime_created` timestamp NOT NULL DEFAULT current_timestamp(),
`datetime_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `learner_manager`
--
INSERT INTO `learner_manager` (`id`, `learner_manager_id`, `name`, `nric`, `work_permit`, `nationality`, `dob`, `sex`, `contact_no`, `email`, `company_id`, `account_status`, `datetime_created`, `datetime_updated`) VALUES
(1, '253c800da3ad217318707a11a455dc8f8d7036b6673b0109dd3b6895b7cc407f', 'LM', 'AB123456', 'WP1234', 1, '1991-03-04', 1, '', '<EMAIL>', 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 0, '2020-03-13 07:56:55', '2020-03-13 07:57:07');
-- --------------------------------------------------------
--
-- Table structure for table `trainer_certifications`
--
CREATE TABLE `trainer_certifications` (
`id` int(11) NOT NULL,
`account_id` int(10) DEFAULT NULL,
`name` varchar(256) NOT NULL,
`filepath` varchar(64) NOT NULL,
`status` tinyint(4) NOT NULL COMMENT '0:inactive, 1:active',
`hash` text NOT NULL,
`date_created` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `application`
--
ALTER TABLE `application`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `application_doc`
--
ALTER TABLE `application_doc`
ADD PRIMARY KEY (`application_doc_id`);
--
-- Indexes for table `company`
--
ALTER TABLE `company`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `learner`
--
ALTER TABLE `learner`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `learners_results`
--
ALTER TABLE `learners_results`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `learner_manager`
--
ALTER TABLE `learner_manager`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `trainer_certifications`
--
ALTER TABLE `trainer_certifications`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `application`
--
ALTER TABLE `application`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `company`
--
ALTER TABLE `company`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=493;
--
-- AUTO_INCREMENT for table `learner`
--
ALTER TABLE `learner`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `learners_results`
--
ALTER TABLE `learners_results`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `learner_manager`
--
ALTER TABLE `learner_manager`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `trainer_certifications`
--
ALTER TABLE `trainer_certifications`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
<gh_stars>0
-- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 25, 2020 at 04:10 PM
-- Server version: 10.4.11-MariaDB
-- PHP Version: 7.4.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `kantin_db`
--
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_100000_create_password_resets_table', 1),
(2, '2020_12_12_103348_create_table_user', 1),
(3, '2020_12_12_125453_create_table_tenant', 1),
(4, '2020_12_12_125529_create_table_stan_active', 1),
(5, '2020_12_12_125601_create_table_open_hours', 1),
(6, '2020_12_12_125709_create_table_withdraw_stand', 1),
(7, '2020_12_12_125754_create_table_help', 1),
(8, '2020_12_12_125818_create_table_suggestion', 1),
(9, '2020_12_12_125835_create_table_stand', 1),
(10, '2020_12_12_125908_create_table_history_rent', 1),
(11, '2020_12_12_125936_create_table_photo_stand', 1),
(12, '2020_12_12_125959_create_table_transaction', 1),
(13, '2020_12_12_130016_create_table_rating', 1),
(14, '2020_12_12_130048_create_table_admin', 1),
(15, '2020_12_12_130108_create_table_articles', 1),
(16, '2020_12_12_130133_create_table_products', 1),
(17, '2020_12_12_130210_create_table_topup_request', 1),
(18, '2020_12_12_130238_create_table_topup_confirmation', 1),
(19, '2020_12_12_130337_create_table_broadcast', 1),
(20, '2020_12_12_130358_create_table_report', 1);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_admin`
--
CREATE TABLE `table_admin` (
`admin_id` bigint(20) UNSIGNED NOT NULL,
`admin_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`username_admin` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_admin`
--
INSERT INTO `table_admin` (`admin_id`, `admin_name`, `username_admin`, `password`, `email`, `created_at`, `updated_at`) VALUES
(1, 'Indra Rahdian', '<PASSWORD>', '<PASSWORD>', '<EMAIL>', '2020-12-24 15:27:22', '2020-12-24 15:27:22');
-- --------------------------------------------------------
--
-- Table structure for table `table_articles`
--
CREATE TABLE `table_articles` (
`article_id` bigint(20) UNSIGNED NOT NULL,
`article_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`photo_article` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`article_status` tinyint(4) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_articles`
--
INSERT INTO `table_articles` (`article_id`, `article_title`, `description`, `photo_article`, `article_status`, `created_at`, `updated_at`) VALUES
(1, 'test', '<p>test</p>', '5fe19d5b259d3.png', 1, '2020-12-22 07:16:43', '2020-12-22 07:16:43'),
(2, 'test', '<p>test</p>', NULL, 1, '2020-12-22 07:19:20', '2020-12-22 07:19:20'),
(3, 'test', '<p>tese</p>', NULL, 1, '2020-12-22 07:19:28', '2020-12-22 07:19:28'),
(4, 'test', '<p>testse</p>', NULL, 1, '2020-12-22 07:19:35', '2020-12-22 07:19:35'),
(5, 'test', '<p>test</p>', NULL, 1, '2020-12-22 07:19:42', '2020-12-22 07:19:42');
-- --------------------------------------------------------
--
-- Table structure for table `table_broadcast`
--
CREATE TABLE `table_broadcast` (
`broadcast_id` bigint(20) UNSIGNED NOT NULL,
`product_id` int(11) DEFAULT NULL,
`stand_id_active` int(11) DEFAULT NULL,
`broadcast_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`broadcast_description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`broadcast_deeplink` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`broadcast_status` tinyint(4) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_broadcast`
--
INSERT INTO `table_broadcast` (`broadcast_id`, `product_id`, `stand_id_active`, `broadcast_title`, `broadcast_description`, `broadcast_deeplink`, `broadcast_status`, `created_at`, `updated_at`) VALUES
(1, NULL, NULL, 'test', '<p>test</p>', '5fe19e8db7bdb.png', 1, '2020-12-22 07:16:22', '2020-12-22 07:16:22');
-- --------------------------------------------------------
--
-- Table structure for table `table_help`
--
CREATE TABLE `table_help` (
`help_id` bigint(20) UNSIGNED NOT NULL,
`help_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`help_desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_history_rent`
--
CREATE TABLE `table_history_rent` (
`history_id` bigint(20) UNSIGNED NOT NULL,
`tenant_id` int(11) NOT NULL,
`stand_id_active` int(11) NOT NULL,
`phone` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`number_stand` smallint(6) NOT NULL,
`rent_id` int(11) NOT NULL,
`photo_stand` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`stand_category` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_profile` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`tenant_date` datetime NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_inboxs`
--
CREATE TABLE `table_inboxs` (
`inbox_id` bigint(20) UNSIGNED NOT NULL,
`inbox_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`inbox_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_inboxs`
--
INSERT INTO `table_inboxs` (`inbox_id`, `inbox_title`, `description`, `inbox_name`, `created_at`, `updated_at`) VALUES
(1, 'Kipas Angin terlalu sedikit', 'Kipas Angin terlalu sedikit', 'indra rahdian', '2020-12-22 07:16:43', '2020-12-22 07:16:43'),
(2, 'test', '<p>test</p>', 'aragon ', '2020-12-22 07:19:20', '2020-12-22 07:19:20'),
(3, 'test', '<p>tese</p>', 'arwen the elf', '2020-12-22 07:19:28', '2020-12-22 07:19:28'),
(4, 'test', '<p>testse</p>', 'boromir from gondor', '2020-12-22 07:19:35', '2020-12-22 07:19:35');
-- --------------------------------------------------------
--
-- Table structure for table `table_open_hours_stand`
--
CREATE TABLE `table_open_hours_stand` (
`open_time_id` bigint(20) UNSIGNED NOT NULL,
`stand_id_active` int(11) NOT NULL,
`open_time` time NOT NULL,
`close_time` time NOT NULL,
`status_open` smallint(6) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_open_hours_stand`
--
INSERT INTO `table_open_hours_stand` (`open_time_id`, `stand_id_active`, `open_time`, `close_time`, `status_open`, `created_at`, `updated_at`) VALUES
(4, 4, '08:00:00', '09:00:00', 1, '2020-12-20 23:09:29', '2020-12-20 23:09:29');
-- --------------------------------------------------------
--
-- Table structure for table `table_order_detail`
--
CREATE TABLE `table_order_detail` (
`id` int(11) NOT NULL,
`transaction_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`product_name` varchar(255) NOT NULL,
`qty` int(11) NOT NULL,
`harga` double NOT NULL,
`discount` double NOT NULL,
`total` double NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `table_order_detail`
--
INSERT INTO `table_order_detail` (`id`, `transaction_id`, `product_id`, `product_name`, `qty`, `harga`, `discount`, `total`, `created_at`) VALUES
(1, 1, 1, '<NAME> ', 2, 15000, 0, 30000, '2020-12-21 07:35:32'),
(2, 1, 2, '<NAME>', 2, 100000, 0, 200000, '2020-12-21 07:35:17');
-- --------------------------------------------------------
--
-- Table structure for table `table_photo_stand`
--
CREATE TABLE `table_photo_stand` (
`photo_id` bigint(20) UNSIGNED NOT NULL,
`stand_id_active` int(11) NOT NULL,
`photo_stand` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_photo_stand`
--
INSERT INTO `table_photo_stand` (`photo_id`, `stand_id_active`, `photo_stand`, `created_at`, `updated_at`) VALUES
(4, 4, '5fdfdc26cd9c4.png', '2020-12-20 23:09:58', '2020-12-20 23:09:58');
-- --------------------------------------------------------
--
-- Table structure for table `table_products`
--
CREATE TABLE `table_products` (
`product_id` int(11) NOT NULL,
`stand_id_active` int(11) NOT NULL,
`stand_category` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_price` double NOT NULL,
`product_discount` double NOT NULL,
`product_image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`product_status` tinyint(4) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_products`
--
INSERT INTO `table_products` (`product_id`, `stand_id_active`, `stand_category`, `product_name`, `product_price`, `product_discount`, `product_image`, `product_description`, `product_status`, `created_at`, `updated_at`) VALUES
(1, 4, 'Food', 'Nasi Goreng', 17800, 0, '', 'Nasi Goreng Spesial Bumbu India', 1, '2020-12-20 23:13:49', '2020-12-20 23:13:49'),
(2, 4, 'Drink', 'Jus Pokat Spesial', 50000, 0, '', 'Jus Pokat Spesial Madu', 1, '2020-12-20 23:14:49', '2020-12-20 23:14:49');
-- --------------------------------------------------------
--
-- Table structure for table `table_rating`
--
CREATE TABLE `table_rating` (
`raing_id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL,
`transaction_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`stand_id_active` int(11) NOT NULL,
`rating_stars_product` int(11) NOT NULL,
`rating_stars_stand` int(11) NOT NULL,
`comment_for_rating` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_report`
--
CREATE TABLE `table_report` (
`report_id` bigint(20) UNSIGNED NOT NULL,
`product_id` int(11) NOT NULL,
`stand_id_active` int(11) NOT NULL,
`transaction_id` int(11) NOT NULL,
`total_transaction` double NOT NULL,
`product_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`order_time` datetime NOT NULL,
`number_stand` smallint(6) NOT NULL,
`total_sales` int(11) NOT NULL,
`report_start_date` datetime NOT NULL,
`report_end_date` datetime NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_stand`
--
CREATE TABLE `table_stand` (
`stand_id` bigint(20) UNSIGNED NOT NULL,
`number_stand` smallint(6) NOT NULL,
`category` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`status_stand_avail` tinyint(4) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_stand`
--
INSERT INTO `table_stand` (`stand_id`, `number_stand`, `category`, `status_stand_avail`, `created_at`, `updated_at`) VALUES
(3, 12, 'Food', 0, '2020-12-18 11:12:30', '2020-12-18 11:12:30'),
(4, 13, 'Food', 0, '2020-12-18 13:19:49', '2020-12-18 13:19:49'),
(5, 14, 'Drink', 0, '2020-12-18 13:20:22', '2020-12-18 13:20:22'),
(6, 15, 'Drink', 0, '2020-12-18 13:21:08', '2020-12-18 13:21:08'),
(7, 20, 'Drink', 0, '2020-12-18 13:22:07', '2020-12-18 13:22:07'),
(8, 78, 'Food', 0, '2020-12-20 07:32:16', '2020-12-20 07:32:16'),
(9, 123, 'Food', 0, '2020-12-22 02:46:33', '2020-12-22 02:46:33');
-- --------------------------------------------------------
--
-- Table structure for table `table_stand_active`
--
CREATE TABLE `table_stand_active` (
`stan_id_active` int(11) NOT NULL,
`tenant_id` int(11) NOT NULL,
`stand_id` int(11) NOT NULL,
`number_stan` int(11) NOT NULL,
`name_profile` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`money_stan` double NOT NULL,
`stan_category` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`status_open` int(11) NOT NULL,
`status_active` int(11) NOT NULL,
`tenant_date` datetime NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_stand_active`
--
INSERT INTO `table_stand_active` (`stan_id_active`, `tenant_id`, `stand_id`, `number_stan`, `name_profile`, `money_stan`, `stan_category`, `status_open`, `status_active`, `tenant_date`, `created_at`, `updated_at`) VALUES
(4, 2, 1, 103, '', 0, 'Food', 1, 1, '2020-12-21 00:00:00', '2020-12-20 23:08:33', '2020-12-20 23:08:33'),
(5, 1, 1, 105, '-', 0, 'Food', 1, 1, '2020-12-25 21:46:27', '2020-12-25 14:46:27', '2020-12-25 14:46:27');
-- --------------------------------------------------------
--
-- Table structure for table `table_suggestion`
--
CREATE TABLE `table_suggestion` (
`suggest_id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `table_tenant`
--
CREATE TABLE `table_tenant` (
`tenant_id` int(11) NOT NULL,
`password` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar_tenant` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`rent_id` int(11) NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_profile` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`photo_ktp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`photo_npwp` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`photo_payment_confirm` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`stan_category` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`rent_status` int(11) NOT NULL,
`rental_date_start` datetime NOT NULL,
`rental_date_end` datetime NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_tenant`
--
INSERT INTO `table_tenant` (`tenant_id`, `password`, `phone`, `avatar_tenant`, `rent_id`, `email`, `name_profile`, `photo_ktp`, `address`, `photo_npwp`, `photo_payment_confirm`, `stan_category`, `rent_status`, `rental_date_start`, `rental_date_end`, `created_at`, `updated_at`) VALUES
(1, '1234', '081190908765', '', 1, '<EMAIL>', 'Mul<NAME>amila', '5fe16c4fda49e.png', 'Jl. Pandu No 46 Medan', '5fe16c4fda49e.png', '5fdfdc26cd9c4.png', 'food', 0, '2020-12-18 17:39:59', '2020-12-31 17:39:59', '2020-12-18 10:39:59', '2020-12-18 10:39:59'),
(2, '1234', '081190908765', '', 2, '<EMAIL>', '<NAME>', '5fe16c6f0b344.png', 'Jl. Surabaya No.13 Medan', '5fe16c6f0b344.png', '5fdfdc26cd9c4.png', 'Drink', 1, '2020-12-04 00:00:00', '2020-12-31 00:00:00', '2020-12-18 11:21:57', '2020-12-18 11:21:57');
-- --------------------------------------------------------
--
-- Table structure for table `table_topup_confirmation`
--
CREATE TABLE `table_topup_confirmation` (
`topup_id` bigint(20) UNSIGNED NOT NULL,
`submit_date` datetime NOT NULL,
`bank_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`account_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`account_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`confirmation_topup_photo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint(4) NOT NULL,
`update_note` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_topup_confirmation`
--
INSERT INTO `table_topup_confirmation` (`topup_id`, `submit_date`, `bank_name`, `account_name`, `account_number`, `confirmation_topup_photo`, `status`, `update_note`, `created_at`, `updated_at`) VALUES
(1, '2020-12-24 08:42:08', 'BRI', 'Indra Rahdian', '93193913918800', '5fdfdc26cd9c4.png', 0, 'Top Up', '2020-12-24 01:41:18', '2020-12-24 01:41:18'),
(2, '2020-12-24 13:16:43', 'CIMB NIAGA', 'Sofyan Ardian', '1039191310103', '-', 1, 'Topup Berhasil', '2020-12-24 06:16:43', '2020-12-24 06:16:43'),
(3, '2020-12-25 13:48:34', 'CIMB NIAGA', 'Sofyan Ardian', '102129991291921', '', 1, 'test', '2020-12-25 06:48:34', '2020-12-24 06:48:34');
-- --------------------------------------------------------
--
-- Table structure for table `table_topup_request`
--
CREATE TABLE `table_topup_request` (
`topup_id` bigint(20) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL,
`total_amount` double NOT NULL,
`status_topup` tinyint(4) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_topup_request`
--
INSERT INTO `table_topup_request` (`topup_id`, `user_id`, `total_amount`, `status_topup`, `created_at`, `updated_at`) VALUES
(1, 12322347, 75000, 1, '2020-12-24 01:40:39', '2020-12-23 17:00:00'),
(2, 111, 45000, 0, '2020-12-24 06:16:18', '2020-12-24 06:16:18'),
(3, 111, 54000, 1, '2020-12-25 06:48:02', '2020-12-25 06:48:02');
-- --------------------------------------------------------
--
-- Table structure for table `table_transaction`
--
CREATE TABLE `table_transaction` (
`transaction_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`stand_id_active` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`customer_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`table_number` smallint(6) NOT NULL,
`total_transaction` double NOT NULL,
`discount` double NOT NULL,
`order_notes` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`order_time` datetime NOT NULL,
`payment_method` tinyint(4) NOT NULL,
`order_status` tinyint(4) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_transaction`
--
INSERT INTO `table_transaction` (`transaction_id`, `user_id`, `stand_id_active`, `product_id`, `customer_name`, `table_number`, `total_transaction`, `discount`, `order_notes`, `order_time`, `payment_method`, `order_status`, `created_at`, `updated_at`) VALUES
(1, 12322347, 4, 1, '<NAME>', 1, 230000, 0, 'Tidak Pedas', '2020-12-21 13:29:12', 1, 1, '2020-12-21 06:29:12', '2020-12-21 06:29:12'),
(2, 111, 5, 1, 'Robi ', 3, 0, 0, 'tidak pakai saos', '2020-12-25 21:47:14', 2, 1, '2020-12-25 14:47:14', '2020-12-25 14:47:14');
-- --------------------------------------------------------
--
-- Table structure for table `table_user`
--
CREATE TABLE `table_user` (
`user_id` bigint(20) UNSIGNED NOT NULL,
`first_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`avatar_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`emoney` double NOT NULL DEFAULT 0,
`status` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `table_user`
--
INSERT INTO `table_user` (`user_id`, `first_name`, `last_name`, `email`, `password`, `phone`, `avatar_user`, `emoney`, `status`, `created_at`, `updated_at`) VALUES
(111, 'Sofyan', 'Andrian', '<EMAIL>', '<PASSWORD>0', '081234344321', '-', 0, 0, '2020-12-24 06:15:16', '2020-12-24 06:15:16'),
(12322347, 'Indra', 'Rahdian', '<EMAIL>', '7c4a8d09ca3762af61e59520943dc26494f8941b', '082165174835', NULL, 0, 1, '2020-12-17 22:48:58', '2020-12-18 13:20:50');
-- --------------------------------------------------------
--
-- Table structure for table `table_withdraw_stand`
--
CREATE TABLE `table_withdraw_stand` (
`withdrawal_id` bigint(20) UNSIGNED NOT NULL,
`stand_id_active` int(11) NOT NULL,
`tenant_id` int(11) NOT NULL,
`money_stand` double NOT NULL,
`account_number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`account_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`nominal_withdrawal` double NOT NULL,
`withdrawal_date` datetime NOT NULL,
`withdrawal_status` smallint(6) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indexes for table `table_admin`
--
ALTER TABLE `table_admin`
ADD PRIMARY KEY (`admin_id`);
--
-- Indexes for table `table_articles`
--
ALTER TABLE `table_articles`
ADD PRIMARY KEY (`article_id`);
--
-- Indexes for table `table_broadcast`
--
ALTER TABLE `table_broadcast`
ADD PRIMARY KEY (`broadcast_id`);
--
-- Indexes for table `table_help`
--
ALTER TABLE `table_help`
ADD PRIMARY KEY (`help_id`);
--
-- Indexes for table `table_history_rent`
--
ALTER TABLE `table_history_rent`
ADD PRIMARY KEY (`history_id`);
--
-- Indexes for table `table_inboxs`
--
ALTER TABLE `table_inboxs`
ADD PRIMARY KEY (`inbox_id`);
--
-- Indexes for table `table_open_hours_stand`
--
ALTER TABLE `table_open_hours_stand`
ADD PRIMARY KEY (`open_time_id`),
ADD KEY `stand_id_active` (`stand_id_active`);
--
-- Indexes for table `table_order_detail`
--
ALTER TABLE `table_order_detail`
ADD PRIMARY KEY (`id`),
ADD KEY `transaction_id` (`transaction_id`),
ADD KEY `product_id` (`product_id`);
--
-- Indexes for table `table_photo_stand`
--
ALTER TABLE `table_photo_stand`
ADD PRIMARY KEY (`photo_id`),
ADD KEY `stand_id_active` (`stand_id_active`);
--
-- Indexes for table `table_products`
--
ALTER TABLE `table_products`
ADD PRIMARY KEY (`product_id`),
ADD KEY `stand_id_active` (`stand_id_active`);
--
-- Indexes for table `table_rating`
--
ALTER TABLE `table_rating`
ADD PRIMARY KEY (`raing_id`);
--
-- Indexes for table `table_report`
--
ALTER TABLE `table_report`
ADD PRIMARY KEY (`report_id`);
--
-- Indexes for table `table_stand`
--
ALTER TABLE `table_stand`
ADD PRIMARY KEY (`stand_id`);
--
-- Indexes for table `table_stand_active`
--
ALTER TABLE `table_stand_active`
ADD PRIMARY KEY (`stan_id_active`),
ADD KEY `tenant_id` (`tenant_id`);
--
-- Indexes for table `table_suggestion`
--
ALTER TABLE `table_suggestion`
ADD PRIMARY KEY (`suggest_id`);
--
-- Indexes for table `table_tenant`
--
ALTER TABLE `table_tenant`
ADD PRIMARY KEY (`tenant_id`);
--
-- Indexes for table `table_topup_confirmation`
--
ALTER TABLE `table_topup_confirmation`
ADD PRIMARY KEY (`topup_id`);
--
-- Indexes for table `table_topup_request`
--
ALTER TABLE `table_topup_request`
ADD PRIMARY KEY (`topup_id`);
--
-- Indexes for table `table_transaction`
--
ALTER TABLE `table_transaction`
ADD PRIMARY KEY (`transaction_id`),
ADD KEY `stand_id_active` (`stand_id_active`),
ADD KEY `product_id` (`product_id`);
--
-- Indexes for table `table_user`
--
ALTER TABLE `table_user`
ADD PRIMARY KEY (`user_id`);
--
-- Indexes for table `table_withdraw_stand`
--
ALTER TABLE `table_withdraw_stand`
ADD PRIMARY KEY (`withdrawal_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT for table `table_admin`
--
ALTER TABLE `table_admin`
MODIFY `admin_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `table_articles`
--
ALTER TABLE `table_articles`
MODIFY `article_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `table_broadcast`
--
ALTER TABLE `table_broadcast`
MODIFY `broadcast_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `table_help`
--
ALTER TABLE `table_help`
MODIFY `help_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `table_history_rent`
--
ALTER TABLE `table_history_rent`
MODIFY `history_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `table_inboxs`
--
ALTER TABLE `table_inboxs`
MODIFY `inbox_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `table_open_hours_stand`
--
ALTER TABLE `table_open_hours_stand`
MODIFY `open_time_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `table_order_detail`
--
ALTER TABLE `table_order_detail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `table_photo_stand`
--
ALTER TABLE `table_photo_stand`
MODIFY `photo_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `table_products`
--
ALTER TABLE `table_products`
MODIFY `product_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `table_rating`
--
ALTER TABLE `table_rating`
MODIFY `raing_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `table_report`
--
ALTER TABLE `table_report`
MODIFY `report_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `table_stand`
--
ALTER TABLE `table_stand`
MODIFY `stand_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `table_stand_active`
--
ALTER TABLE `table_stand_active`
MODIFY `stan_id_active` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `table_suggestion`
--
ALTER TABLE `table_suggestion`
MODIFY `suggest_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `table_tenant`
--
ALTER TABLE `table_tenant`
MODIFY `tenant_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `table_topup_confirmation`
--
ALTER TABLE `table_topup_confirmation`
MODIFY `topup_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `table_topup_request`
--
ALTER TABLE `table_topup_request`
MODIFY `topup_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `table_transaction`
--
ALTER TABLE `table_transaction`
MODIFY `transaction_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `table_user`
--
ALTER TABLE `table_user`
MODIFY `user_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12322348;
--
-- AUTO_INCREMENT for table `table_withdraw_stand`
--
ALTER TABLE `table_withdraw_stand`
MODIFY `withdrawal_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `table_open_hours_stand`
--
ALTER TABLE `table_open_hours_stand`
ADD CONSTRAINT `table_open_hours_stand_ibfk_1` FOREIGN KEY (`stand_id_active`) REFERENCES `table_stand_active` (`stan_id_active`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `table_order_detail`
--
ALTER TABLE `table_order_detail`
ADD CONSTRAINT `table_order_detail_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `table_transaction` (`transaction_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `table_order_detail_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `table_products` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `table_photo_stand`
--
ALTER TABLE `table_photo_stand`
ADD CONSTRAINT `table_photo_stand_ibfk_1` FOREIGN KEY (`stand_id_active`) REFERENCES `table_stand_active` (`stan_id_active`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `table_products`
--
ALTER TABLE `table_products`
ADD CONSTRAINT `table_products_ibfk_1` FOREIGN KEY (`stand_id_active`) REFERENCES `table_stand_active` (`stan_id_active`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `table_stand_active`
--
ALTER TABLE `table_stand_active`
ADD CONSTRAINT `table_stand_active_ibfk_1` FOREIGN KEY (`tenant_id`) REFERENCES `table_tenant` (`tenant_id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `table_transaction`
--
ALTER TABLE `table_transaction`
ADD CONSTRAINT `table_transaction_ibfk_1` FOREIGN KEY (`stand_id_active`) REFERENCES `table_stand_active` (`stan_id_active`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `table_transaction_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `table_products` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE IF NOT EXISTS sequence (
seq BIGINT PRIMARY KEY,
name VARCHAR,
rev VARCHAR,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE TABLE IF NOT EXISTS packages (
name VARCHAR PRIMARY KEY,
rev VARCHAR,
description TEXT,
readme TEXT,
timeModified TIMESTAMP WITH TIME ZONE,
timeCreated TIMESTAMP WITH TIME ZONE,
repositoryType VARCHAR,
repositoryURL VARCHAR,
repositoryGithubOrg VARCHAR,
repositoryGithubRepo VARCHAR,
readmeFileName VARCHAR,
homepage VARCHAR,
bugsURL VARCHAR,
bugsEmail VARCHAR,
licenceType VARCHAR,
licenseURL VARCHAR,
users BIGINT,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE TABLE IF NOT EXISTS versions (
id VARCHAR PRIMARY KEY, -- npm@1.1.25
name VARCHAR, -- npm
version VARCHAR, -- 1.1.25
description TEXT,
homepage VARCHAR,
repositoryType VARCHAR,
repositoryURL VARCHAR,
repositoryGithubOrg VARCHAR,
repositoryGithubRepo VARCHAR,
bugsURL VARCHAR,
bugsEmail VARCHAR,
licenceType VARCHAR,
licenseURL VARCHAR,
committerName VARCHAR,
committerEmail VARCHAR,
npmVersion VARCHAR,
nodeVersion VARCHAR,
distShasum VARCHAR,
distTarball VARCHAR,
deprecated VARCHAR,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS versions_name_version_idx ON versions(name, version);
CREATE TABLE IF NOT EXISTS tags ( -- distribution-tags
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name VARCHAR,
tag VARCHAR,
version VARCHAR,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS tags_name_tag_idx ON tags (name, tag);
CREATE TABLE IF NOT EXISTS people (
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name VARCHAR,
version VARCHAR,
email VARCHAR,
fullname VARCHAR,
url VARCHAR,
type VARCHAR, -- author / maintainers / contributors
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS people_name_version_fullname_email_url_type_idx ON people(name, version, fullname, email, url, type);
CREATE TABLE IF NOT EXISTS times (
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name VARCHAR,
version VARCHAR,
time TIMESTAMP WITH TIME ZONE,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS times_name_version_idx ON times(name, version);
CREATE TABLE IF NOT EXISTS keywords (
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name VARCHAR,
version VARCHAR,
keyword VARCHAR,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS keywords_name_version_keyword_idx ON keywords(name, version, keyword);
CREATE TABLE IF NOT EXISTS dependencies (
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
name VARCHAR,
version VARCHAR,
dependency VARCHAR,
semver VARCHAR,
url VARCHAR,
type VARCHAR, -- dep / bundle / dev / optional
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS dependencies_name_version_dependency_type_idx ON dependencies(name, version, dependency, type); |
<filename>ADHDatabaseProject/dbo/Stored Procedures/spAssignedMedicines_FindAllByPatientId.sql
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[spAssignedMedicines_FindAllByPatientId]
@PatientId nvarchar(128)
AS
BEGIN
SET NOCOUNT ON;
SELECT Assigned.Id
,patient.Id AS PatientId
,patient.FirstName AS PatientFirstName
,patient.LastName AS PatientLastName
,Med.Id AS MedicineId
,Med.[Name] AS MedicineName
,Med.[Description] AS MedicineDescription
,Doctor.Id AS DoctoreID
,Doctor.FirstName AS DoctoreFirstName
,Doctor.LastName AS DoctoreLastNameName
FROM [dbo].[AssignedMedicines] AS Assigned
JOIN Users patient ON patient.Id = Assigned.PatientId
JOIN Users Doctor ON Doctor.Id = Assigned.AddedBy
JOIN Medicines Med ON Med.Id =Assigned.MedicineId
WHERE Assigned.PatientId = @PatientId
END
|
-- AlterTable
ALTER TABLE "lti_consumer" ADD COLUMN "platform_id" TEXT,
ALTER COLUMN "secret" SET DEFAULT E'';
-- CreateTable
CREATE TABLE "lti_platform" (
"issuer" TEXT NOT NULL,
"metadata" JSONB NOT NULL,
PRIMARY KEY ("issuer")
);
-- AddForeignKey
ALTER TABLE "lti_consumer" ADD FOREIGN KEY ("platform_id") REFERENCES "lti_platform"("issuer") ON DELETE SET NULL ON UPDATE CASCADE;
|
CREATE TABLE subdivision_NI (id VARCHAR(6) NOT NULL, name VARCHAR(255) NOT NULL, level VARCHAR(64) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-AN', 'Atlántico Norte', 'autonomous region');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-AS', 'Atlántico Sur', 'autonomous region');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-BO', 'Boaco', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-CA', 'Carazo', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-CI', 'Chinandega', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-CO', 'Chontales', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-ES', 'Estelí', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-GR', 'Granada', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-JI', 'Jinotega', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-LE', 'Leon', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-MD', 'Madriz', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-MN', 'Managua', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-MS', 'Masaya', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-MT', 'Matagalpa', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-NS', 'Nueva Segovia', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-RI', 'Rivas', 'department');
INSERT INTO `subdivision_NI` (`id`, `name`, `level`) VALUES ('NI-SJ', 'Río San Juan', 'department');
|
CREATE TYPE [dbo].[ud_Price] FROM money NOT NULL
GO
|
<reponame>jeanrvos/postgresql-udemyCourse
SELECT ppoints AS "one", CAST(ppoints AS NUMERIC) AS "two" FROM people; |
<filename>query/3.3.sql<gh_stars>0
select c_city, s_city, d_year, sum(lo_revenue) as revenue
from customer, lineorder, supplier, date
where lo_custkey = c_custkey
and lo_suppkey = s_suppkey
and lo_orderdate = d_datekey
and c_nation = 'UNITED KINGDOM'
and (c_city='UNITED KI1' or c_city='UNITED KI5')
and (s_city='UNITED KI1' or s_city='UNITED KI5')
and s_nation = 'UNITED KINGDOM'
and d_year >= 1992 and d_year <= 1997
group by c_city, s_city, d_year
order by d_year asc, revenue desc;
|
<filename>bloc4/BDD_Introduction/sandbox/TP-Etudiant/correction/sql-murder-mystery.sql
SELECT description FROM crime_scene_report
where date = 20180115 and type = 'murder' and city = 'SQL City';
-- Security footage shows that there were 2 witnesses.
-- The first witness lives at the last house on "Northwestern Dr".
-- The second witness, named Annabel, lives somewhere on "Franklin Ave".
-- 1st witness <NAME> --------------------------------------------------------
SELECT *
FROM Person
WHERE address_street_name = 'Northwestern Dr'
ORDER BY address_number DESC
LIMIT 1;
-- "14887" "<NAME>" "118009" "4919" "Northwestern Dr" "111564949"
SELECT transcript
FROM interview
WHERE person_id = 14887;
-- I heard a gunshot and then saw a man run out.
-- He had a "Get Fit Now Gym" bag.
-- The membership number on the bag started with "48Z".
-- Only gold members have those bags.
-- The man got into a car with a plate that included "H42W".
SELECT p.id, p.name
FROM get_fit_now_member g JOIN person p
ON g.person_id = p.id
JOIN drivers_license l
ON p.license_id = l.id
WHERE membership_status = 'gold'
AND g.id LIKE '48Z%'
AND l.plate_number LIKE '%H42W%';
-- "67318" "<NAME>"
-- "48Z55" "67318" "<NAME>" "20160101" "gold" "67318" "<NAME>" "423327" "530" "Washington Pl, Apt 3A" "871539279" "423327" "30" "70" "brown" "brown" "male" "0H42W2" "Chevrolet" "Spark LS"
-- 2nd witness <NAME> --------------------------------------------------------
SELECT *
FROM Person
WHERE address_street_name = '<NAME>'
AND name LIKE '%Annabel%';
-- "16371" "<NAME>" "490173" "103" "<NAME>" "318771143"
SELECT transcript
FROM interview
WHERE person_id = 16371;
-- I saw the murder happen, and I recognized the killer from my gym when I was working out last week on January the 9th.
SELECT *
FROM get_fit_now_check_in c
JOIN get_fit_now_member m
ON c.membership_id = m.id
JOIN person p
ON m.person_id = p.id
WHERE check_in_date = 20180109
AND c.membership_id <> '90081'
AND check_out_time IN
(SELECT check_out_time
FROM get_fit_now_check_in c2
WHERE c2.membership_id = '90081' -- <NAME>
) ;
"48Z55" "20180109" "1530" "1700" "48Z55" "67318" "<NAME>" "20160101" "gold" "67318" "<NAME>" "423327" "530" "Washington Pl, Apt 3A" "871539279"
-- Killer <NAME> --------------------------------------------------------
SELECT transcript
FROM interview
WHERE person_id = 67318;
-- I was hired by a woman with a lot of money.
-- I don't know her name but I know she's around 5'5" (65") or 5'7" (67").
-- She has red hair and she drives a Tesla Model S.
-- I know that she attended the SQL Symphony Concert 3 times in December 2017.
INSERT INTO solution VALUES (1, '<NAME>');
SELECT * from solution;
-- Congrats, you found the murderer! But wait, there's more...
-- If you think you're up for a challenge, try querying the interview transcript of the murderer to find the real villian behind this crime.
-- If you feel especially confident in your SQL skills, try to complete this final step with no more than 2 queries.
-- Use this same INSERT statement with your new suspect to check your answer.
-- Real villian --------------------------------------------------------
SELECT *
FROM drivers_license l JOIN person p
ON l.id = p.license_id
WHERE height BETWEEN 65 AND 67
AND gender = 'female'
AND hair_color = 'red'
AND car_make = 'Tesla'
AND car_model = 'Model S';
-- "78881" "<NAME>"
-- "90700" "<NAME>"
-- "99716" "<NAME>"
SELECT person_id, event_id, count (*)
FROM facebook_event_checkin
WHERE event_name = 'SQL Symphony Concert'
AND DATE BETWEEN 20171201 AND 20171231
GROUP BY person_id, event_id
HAVING count(*) = 3;
-- "24556" "1143" "3"
-- "99716" "1143" "3"
SELECT *
FROM income
WHERE ssn = '987756388';
-- "987756388" "310000"
SELECT p.id, p.name
FROM drivers_license l
JOIN person p ON l.id = p.license_id
JOIN income i ON i.ssn = p.ssn
WHERE height BETWEEN 65 AND 67
AND gender = 'female'
AND hair_color = 'red'
AND car_make = 'Tesla'
AND car_model = 'Model S'
AND annual_income > 100000
AND p.id IN (
SELECT person_id
FROM facebook_event_checkin
WHERE event_name = 'SQL Symphony Concert'
AND DATE BETWEEN 20171201 AND 20171231
GROUP BY person_id, event_id
HAVING count(*) = 3
);
--- "202298" "68" "66" "green" "red" "female" "500123" "Tesla" "Model S" "99716" "<NAME>" "202298" "1883" "Golden Ave" "987756388"
INSERT INTO solution VALUES (1, '<NAME>');
SELECT * from solution;
|
<filename>src/relstorage/adapters/postgresql/procs/hf/lock_and_choose_tid.sql
CREATE OR REPLACE FUNCTION lock_and_choose_tid()
RETURNS BIGINT
-- We're in the commit phase of two-phase commit.
-- It's very important not to error out here.
-- So we need a very long wait to get the commit lock.
-- Recall PostgreSQL uses milliseconds (it can also parse
-- strings like '10min').
SET lock_timeout = 600000
AS
$$
DECLARE
scratch BIGINT;
current_tid_64 BIGINT;
next_tid_64 BIGINT;
BEGIN
-- In a history-free database, if we don't have a lock for the TID,
-- we could potentially end up with multiple processes choosing the
-- same TID (because there's no unique index on tids). As long as they were
-- working with different objects, there would be no database error
-- to indicate that the TIDs were the same, and a later view of the
-- transaction would be incorrect (containing multiple distinct
-- transactions).
SELECT tid
INTO scratch
FROM commit_row_lock
FOR UPDATE;
SELECT COALESCE(MAX(tid), 0)
INTO current_tid_64
FROM object_state;
next_tid_64 := make_current_tid();
IF next_tid_64 <= current_tid_64 THEN
next_tid_64 := current_tid_64 + 1;
END IF;
RETURN next_tid_64;
END;
$$
LANGUAGE PLPGSQL;
|
<gh_stars>0
INSERT INTO `companies` (`id`, `created`, `date`, `updated`, `business_key`, `domain`, `email`, `name`, `version`) VALUES
(1, '2014-12-18 00:00:00', '2014-12-18 00:00:00', '2014-12-18 00:00:00', 'reimbursementRequest', 'www1.rushucloud.com', '<EMAIL>', 'dc=www', 0),
(2, '2015-01-01 00:00:00', '2015-01-01 00:00:00', '2015-01-01 00:00:00', 'reimbursementRequest', 'www2.rushucloud.com', '<EMAIL>', 'dc=123,dc=57,dc=78,dc=65', 0);
INSERT INTO `items` (`id`, `created`, `date`, `updated`, `owner`, `amount`, `category`,`place`, `invoices`, `name`, `notes`, `participant_ids`, `type`, `vendors`, `used`) VALUES
(1, '2014-12-19 16:24:28', '2014-12-19 08:00:00', '2014-12-19 16:24:28', 'employee1', 99, '1', '北京','1', '测试条目000', '说明。。。', NULL, 'CostConsumed', '1', b'0');
INSERT INTO `categories` (`id`, `created`, `date`, `updated`, `icon`, `label`,`name`, `parent_id`) VALUES
(1, '2014-12-26 12:23:32', NULL, '2014-12-26 12:23:32', '00', '总分类','总分类', NULL),
(2, '2014-12-26 12:25:36', NULL, '2014-12-26 12:25:36', '01', '礼品','礼品', 1),
(3, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '交通','交通', 1),
(4, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '公共交通','公共交通', 3),
(5, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '打车','打车', 3),
(6, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '飞机','飞机', 3),
(7, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '火车','火车', 3),
(8, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '话费','话费', 1),
(9, '2014-12-26 13:55:39', NULL, '2014-12-26 13:55:39', '02', '餐饮','美食', 1);
INSERT INTO user(id, name, login, password) values (1,'API_test_user','<PASSWORD>','<PASSWORD>'); |
<reponame>wvanheemstra/core<filename>apps/programmes/models/views/structures/sql/programme.sql
/*
Navicat MySQL Data Transfer
Source Server : wvanheem_core_local
Source Server Version : 50509
Source Host : 127.0.0.1
Source Database : core
Target Server Version : 50509
File Encoding : utf-8
*/
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- View structure for `programme`
-- ----------------------------
DROP VIEW IF EXISTS `programme`;
CREATE VIEW `programme` AS
SELECT `kp_ProgrammeID`,
`ProgrammeName`,
`kf_KindOfProgrammeID`,
`kf_WhereaboutsID`,
`kf_EventID`,
`ts_Created`,
`ts_Updated`
FROM tbl_programme;
SET FOREIGN_KEY_CHECKS = 1; |
<gh_stars>0
-- SENAYAN 3.0 stable 5
-- Senayan SQL Database upgrade script
ALTER TABLE `mst_member_type` ADD `grace_periode` INT(2) NULL DEFAULT '0' AFTER `fine_each_day`;
ALTER TABLE `mst_loan_rules` ADD `grace_periode` INT(2) NULL DEFAULT '0' AFTER `fine_each_day`;
ALTER TABLE `stock_take_item` ADD `gmd_name` VARCHAR(30) NULL AFTER `title`;
ALTER TABLE `stock_take_item` ADD `coll_type_name` VARCHAR(30) NULL AFTER `classification`;
ALTER TABLE `stock_take_item` ADD `call_number` VARCHAR(50) NULL AFTER `coll_type_name`;
ALTER TABLE `stock_take_item` ADD `location` VARCHAR(100) NULL AFTER `call_number`;
ALTER TABLE `stock_take_item` ADD INDEX `item_properties_idx` (`gmd_name`, `classification`, `coll_type_name`, `location`);
|
ALTER TABLE `sys_menu` ADD COLUMN `antdv_uid_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用于非菜单显示页面的重定向url设置' AFTER `antdv_link_url`;
|
<gh_stars>0
DROP KEYSPACE dcim_journal;
DROP KEYSPACE dcim_snapshot;
CREATE KEYSPACE dcim_journal WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;
CREATE KEYSPACE dcim_snapshot WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;
|
<reponame>bcgov/cas-ciip-portal<gh_stars>1-10
-- Verify ggircs-portal:function_search_ciip_user_organisation on pg
begin;
select pg_get_functiondef('ggircs_portal.search_ciip_user_organisation(text,text,text,text)'::regprocedure);
rollback;
|
/*
Navicat Premium Data Transfer
Source Server : 本地连接
Source Server Type : MySQL
Source Server Version : 50542
Source Host : localhost:3306
Source Schema : daimengshi_cms
Target Server Type : MySQL
Target Server Version : 50542
File Encoding : 65001
Date: 19/12/2017 13:39:16
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for dms_article
-- ----------------------------
DROP TABLE IF EXISTS `dms_article`;
CREATE TABLE `dms_article` (
`id` int(36) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`article_title` varchar(255) DEFAULT NULL COMMENT '文章标题',
`article_content` varchar(255) DEFAULT NULL COMMENT '文章内容',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`uid` varchar(36) DEFAULT NULL COMMENT '用户id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='文章表';
-- ----------------------------
-- Records of dms_article
-- ----------------------------
BEGIN;
INSERT INTO `dms_article` VALUES (1, '22', '22', NULL, NULL);
COMMIT;
-- ----------------------------
-- Table structure for dms_config
-- ----------------------------
DROP TABLE IF EXISTS `dms_config`;
CREATE TABLE `dms_config` (
`id` int(36) NOT NULL AUTO_INCREMENT,
`key` varchar(255) DEFAULT '' COMMENT '配置名称',
`value` varchar(255) DEFAULT NULL COMMENT '值',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`desc` varchar(1000) DEFAULT NULL COMMENT '备注说明',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT=' 配置表';
-- ----------------------------
-- Records of dms_config
-- ----------------------------
BEGIN;
INSERT INTO `dms_config` VALUES (1, 'webAppName', '呆萌狮', '2017-12-13 10:35:48', '站点名称');
INSERT INTO `dms_config` VALUES (2, 'webAppUrl', 'http://127.0.0.1', '2017-12-13 10:35:46', '站点链接地址');
COMMIT;
-- ----------------------------
-- Table structure for dms_menu
-- ----------------------------
DROP TABLE IF EXISTS `dms_menu`;
CREATE TABLE `dms_menu` (
`id` int(36) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) DEFAULT NULL COMMENT '菜单名称',
`url` varchar(255) DEFAULT NULL COMMENT '菜单url',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`super_id` int(36) DEFAULT '0' COMMENT '父级菜单 ID',
`type_id` varchar(36) DEFAULT NULL COMMENT '菜单类型ID',
`is_open` varchar(4) DEFAULT NULL COMMENT '是否开启(on:开启,off关闭) 默认on开启',
`desc` varchar(1000) DEFAULT NULL COMMENT '备注说明',
`serial_num` int(20) DEFAULT '0' COMMENT '序号,用于排序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT=' 菜单表';
-- ----------------------------
-- Records of dms_menu
-- ----------------------------
BEGIN;
INSERT INTO `dms_menu` VALUES (1, '菜单管理', '/admin/menu', '2017-12-09 01:48:50', 2, '1', 'on', '', 0);
INSERT INTO `dms_menu` VALUES (2, '系统管理', NULL, '2017-12-09 03:52:33', 0, '1', 'on', '', 2);
INSERT INTO `dms_menu` VALUES (3, '用户管理', '/admin/user', '2017-12-09 04:02:46', 2, '1', 'on', '用户管理', 0);
INSERT INTO `dms_menu` VALUES (6, '仪表盘', '/admin/main', '2017-12-11 16:03:04', 2, '1', 'on', '后台初始化页面', 0);
INSERT INTO `dms_menu` VALUES (7, '管理员管理', NULL, '2017-12-14 10:20:31', 0, '1', 'on', '', 0);
INSERT INTO `dms_menu` VALUES (8, '管理员', '/admin/master', '2017-12-14 10:21:08', 7, '1', 'on', '', 0);
INSERT INTO `dms_menu` VALUES (9, '角色管理', '/admin/role', '2017-12-14 10:22:05', 7, '1', 'on', '', 0);
INSERT INTO `dms_menu` VALUES (16, '权限管理', '/admin/permission', '2017-12-16 00:01:41', 7, '1', 'on', '', 0);
COMMIT;
-- ----------------------------
-- Table structure for dms_menu_type
-- ----------------------------
DROP TABLE IF EXISTS `dms_menu_type`;
CREATE TABLE `dms_menu_type` (
`id` int(36) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) DEFAULT NULL COMMENT '菜单类型名称',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT=' 菜单类型表';
-- ----------------------------
-- Records of dms_menu_type
-- ----------------------------
BEGIN;
INSERT INTO `dms_menu_type` VALUES (1, '左边菜单', '2017-12-06 18:06:32');
INSERT INTO `dms_menu_type` VALUES (2, '顶部菜单', '2017-12-09 01:08:55');
COMMIT;
-- ----------------------------
-- Table structure for dms_permission
-- ----------------------------
DROP TABLE IF EXISTS `dms_permission`;
CREATE TABLE `dms_permission` (
`id` int(36) NOT NULL AUTO_INCREMENT,
`key` varchar(36) DEFAULT NULL COMMENT '权限标识',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`name` varchar(36) DEFAULT NULL COMMENT '权限名称',
`desc` varchar(255) DEFAULT NULL COMMENT '备注说明',
`is_open` varchar(4) DEFAULT 'on' COMMENT '是否开启(on:开启,off关闭) 默认on开启',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='权限表';
-- ----------------------------
-- Records of dms_permission
-- ----------------------------
BEGIN;
INSERT INTO `dms_permission` VALUES (1, 'admin:update', '2017-12-14 23:23:12', '管理员-更新', '', 'on');
INSERT INTO `dms_permission` VALUES (2, 'admin:create', '2017-12-06 17:21:38', '管理员-创建', '', 'on');
INSERT INTO `dms_permission` VALUES (3, 'admin:delete', '2017-12-14 23:23:32', '管理员-删除', '', 'on');
INSERT INTO `dms_permission` VALUES (4, 'admin:view', '2017-12-14 23:23:42', '管理员-查询', '', 'on');
INSERT INTO `dms_permission` VALUES (5, 'user:view', '2017-12-14 23:31:39', '用户-查询', '', 'on');
INSERT INTO `dms_permission` VALUES (11, 'user:update', '2017-12-19 11:07:09', '用户-更新', '', 'on');
INSERT INTO `dms_permission` VALUES (12, 'user:delete', '2017-12-19 11:07:50', '用户-删除', '', 'on');
INSERT INTO `dms_permission` VALUES (13, 'user:create', '2017-12-19 11:08:14', '用户-创建', '', 'on');
COMMIT;
-- ----------------------------
-- Table structure for dms_role
-- ----------------------------
DROP TABLE IF EXISTS `dms_role`;
CREATE TABLE `dms_role` (
`id` int(36) NOT NULL AUTO_INCREMENT,
`name` varchar(36) DEFAULT NULL COMMENT '角色名称',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`desc` varchar(255) DEFAULT NULL COMMENT '描述',
`key` varchar(36) DEFAULT NULL COMMENT '角色标识',
`is_open` varchar(4) DEFAULT 'on' COMMENT '是否开启(on:开启,off关闭) 默认on开启',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='角色表';
-- ----------------------------
-- Records of dms_role
-- ----------------------------
BEGIN;
INSERT INTO `dms_role` VALUES (1, '超级管理员', '2017-12-06 17:15:48', '最高权限的管理员22333', 'admin', 'on');
INSERT INTO `dms_role` VALUES (2, '普通用户', '2017-12-15 23:14:16', '普通会员1', 'user', 'on');
COMMIT;
-- ----------------------------
-- Table structure for dms_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `dms_role_permission`;
CREATE TABLE `dms_role_permission` (
`id` int(36) NOT NULL AUTO_INCREMENT COMMENT '主键',
`rid` int(36) DEFAULT NULL COMMENT '角色ID',
`pid` int(36) DEFAULT NULL COMMENT '权限ID',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`is_open` varchar(4) DEFAULT 'on' COMMENT '是否开启(on:开启,off关闭) 默认on开启',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COMMENT='角色权限表';
-- ----------------------------
-- Records of dms_role_permission
-- ----------------------------
BEGIN;
INSERT INTO `dms_role_permission` VALUES (19, 5, 1, '2017-12-19 11:03:04', 'on');
INSERT INTO `dms_role_permission` VALUES (20, 5, 2, '2017-12-19 11:03:04', 'on');
INSERT INTO `dms_role_permission` VALUES (21, 5, 3, '2017-12-19 11:03:04', 'on');
INSERT INTO `dms_role_permission` VALUES (22, 5, 4, '2017-12-19 11:03:04', 'on');
INSERT INTO `dms_role_permission` VALUES (23, 5, 5, '2017-12-19 11:03:04', 'on');
INSERT INTO `dms_role_permission` VALUES (24, 6, 5, '2017-12-19 11:05:29', 'on');
INSERT INTO `dms_role_permission` VALUES (25, 2, 5, '2017-12-19 11:08:33', 'on');
INSERT INTO `dms_role_permission` VALUES (26, 2, 11, '2017-12-19 11:08:33', 'on');
INSERT INTO `dms_role_permission` VALUES (27, 2, 12, '2017-12-19 11:08:33', 'on');
INSERT INTO `dms_role_permission` VALUES (28, 2, 13, '2017-12-19 11:08:33', 'on');
INSERT INTO `dms_role_permission` VALUES (29, 1, 1, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (30, 1, 2, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (31, 1, 3, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (32, 1, 4, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (33, 1, 5, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (34, 1, 11, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (35, 1, 12, '2017-12-19 11:08:41', 'on');
INSERT INTO `dms_role_permission` VALUES (36, 1, 13, '2017-12-19 11:08:41', 'on');
COMMIT;
-- ----------------------------
-- Table structure for dms_user
-- ----------------------------
DROP TABLE IF EXISTS `dms_user`;
CREATE TABLE `dms_user` (
`id` varchar(36) NOT NULL COMMENT '主键ID',
`name` varchar(36) DEFAULT NULL COMMENT '名称',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`phone` varchar(20) DEFAULT NULL COMMENT '手机号码',
`password` varchar(16) DEFAULT NULL COMMENT '密码',
`nike_name` varchar(36) DEFAULT NULL COMMENT '昵称',
`point` int(36) unsigned DEFAULT '0' COMMENT '积分',
`email` varchar(36) DEFAULT NULL COMMENT '邮箱',
`is_open` varchar(4) DEFAULT 'on' COMMENT '是否启用',
`desc` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';
-- ----------------------------
-- Records of dms_user
-- ----------------------------
BEGIN;
INSERT INTO `dms_user` VALUES ('5ff5b3f5d94c44b3a2366b6e21cfcbfe', 'admin', '2017-12-16 17:08:58', '123123123123', 'admin', '周洛熙', 0, '<EMAIL>', 'on', '超级管理员');
INSERT INTO `dms_user` VALUES ('9ba98abd6bbf4f3f8776257cf369af6c', 'DDDDD', '2017-12-19 00:05:12', '123', 'DDD', 'DDD', 111, 'DDD', 'on', '');
INSERT INTO `dms_user` VALUES ('c2abb2efa8d24c28b91b392b1dabd6b5', 'SSSS', '2017-12-19 00:05:36', '12', 'SSS', 'SS', 12, 'SS', 'on', '');
INSERT INTO `dms_user` VALUES ('f569091266db4240ab0b28bbb5dba291', 'aaaa', '2017-12-16 18:21:01', '321321', 'ssa', 'aaaa', 123, 'asdas', 'off', '');
COMMIT;
-- ----------------------------
-- Table structure for dms_user_role
-- ----------------------------
DROP TABLE IF EXISTS `dms_user_role`;
CREATE TABLE `dms_user_role` (
`id` int(36) NOT NULL AUTO_INCREMENT COMMENT '主键',
`rid` int(36) DEFAULT NULL COMMENT '角色ID',
`uid` varchar(100) DEFAULT NULL COMMENT '用户ID',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='用户角色表';
-- ----------------------------
-- Records of dms_user_role
-- ----------------------------
BEGIN;
INSERT INTO `dms_user_role` VALUES (4, 1, '5ff5b3f5d94c44b3a2366b6e21cfcbfe', '2017-12-19 00:00:39');
INSERT INTO `dms_user_role` VALUES (7, 1, '5ff5b3f5d94c44b3a2366b6e21cfcbfe', '2017-12-19 13:37:01');
INSERT INTO `dms_user_role` VALUES (8, 1, '5ff5b3f5d94c44b3a2366b6e21cfcbfe', '2017-12-19 13:38:32');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
|
-- // CB-5245 add account telemetry
-- Migration SQL that makes the change goes here.
CREATE TABLE IF NOT EXISTS accounttelemetry (
id bigserial NOT NULL,
features text,
rules text,
archived bool DEFAULT false,
accountid varchar(255) NOT NULL,
resourcecrn varchar(255) NOT NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX IF NOT EXISTS accounttelemetry_id_idx ON accounttelemetry USING btree (id);
CREATE INDEX IF NOT EXISTS accounttelemetry_accountid_idx ON accounttelemetry USING btree (accountid);
CREATE INDEX IF NOT EXISTS accounttelemetry_id_accountid_idx ON accounttelemetry USING btree (id, accountid);
-- //@UNDO
-- SQL to undo the change goes here.
DROP INDEX IF EXISTS accounttelemetry_id_idx;
DROP INDEX IF EXISTS accounttelemetry_accountid_idx;
DROP INDEX IF EXISTS accounttelemetry_id_accountid_idx;
DROP TABLE IF EXISTS accounttelemetry; |
BEGIN;
DELETE FROM seguridad_rol_credenciales WHERE credencial_id IN
(SELECT c.id FROM seguridad_credencial c WHERE c.nombre = 'reg_df_consulta' AND
EXISTS (
SELECT 1 FROM seguridad_credencial c2 WHERE c2.nombre = c.nombre
AND c2.id < c.id
));
DELETE FROM seguridad_credencial c WHERE c.nombre = 'reg_df_consulta' AND
EXISTS (
SELECT 1 FROM seguridad_credencial c2 WHERE c2.nombre = c.nombre
AND c2.id < c.id
);
CREATE TABLE "seguridad_credencial_credenciales_hijas" (
"id" serial NOT NULL PRIMARY KEY,
"from_credencial_id" integer NOT NULL,
"to_credencial_id" integer NOT NULL,
UNIQUE ("from_credencial_id", "to_credencial_id")
)
;
ALTER TABLE "seguridad_credencial_credenciales_hijas" ADD CONSTRAINT "from_credencial_id_refs_id_3045f4d9" FOREIGN KEY ("from_credencial_id") REFERENCES "seguridad_credencial" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "seguridad_credencial_credenciales_hijas" ADD CONSTRAINT "to_credencial_id_refs_id_3045f4d9" FOREIGN KEY ("to_credencial_id") REFERENCES "seguridad_credencial" ("id") DEFERRABLE INITIALLY DEFERRED;
INSERT INTO seguridad_credencial_credenciales_hijas (from_credencial_id, to_credencial_id)
VALUES
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_alta'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_consulta')
),
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_alta'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_modificar')
),
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_alta'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_baja')
),
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_modificar'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_consulta')
),
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_baja'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_consulta')
),
(
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_baja'),
(SELECT id FROM seguridad_credencial WHERE nombre = 'reg_df_modificar')
);
INSERT INTO deltas_sql (numero, app, comentario) VALUES ('033', 'Seguridad', 'Ticket #160');
COMMIT;
|
--test operators seteq, setneq with list(char) and list(varchar)
create class tb1 ( a list(char(2)));
create class tb2 ( b list(varchar(2)));
insert into tb1 values({'a1'});
insert into tb1 values({'a2'});
insert into tb1 values({'a3'});
insert into tb2 values({'a1'});
insert into tb2 values({'a2'});
insert into tb2 values({'a3'});
insert into tb2 values({'a4'});
insert into tb2 values({'a5'});
select a,b from tb1, tb2 where a seteq b order by 1,2;
select a,b from tb1, tb2 where a setneq b order by 1,2;
drop class tb1;
drop class tb2;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.