Skip to content

Instantly share code, notes, and snippets.

@chiyoyo
Created August 6, 2023 06:37
Show Gist options
  • Save chiyoyo/26b9e3cdd6e2a69fb59ccc5bbf6374c7 to your computer and use it in GitHub Desktop.
Save chiyoyo/26b9e3cdd6e2a69fb59ccc5bbf6374c7 to your computer and use it in GitHub Desktop.
Create japanese prefecture table and insert data (BigQuery)
WITH `prefecture` AS (
SELECT
*
FROM
UNNEST([
STRUCT(1 AS id,'北海道' AS name,'ホッカイドウ' AS name_kana),
STRUCT(2,'青森県','アオモリケン'),
STRUCT(3,'岩手県','イワテケン'),
STRUCT(4,'宮城県','ミヤギケン'),
STRUCT(5,'秋田県','アキタケン'),
STRUCT(6,'山形県','ヤマガタケン'),
STRUCT(7,'福島県','フクシマケン'),
STRUCT(8,'茨城県','イバラキケン'),
STRUCT(9,'栃木県','トチギケン'),
STRUCT(10,'群馬県','グンマケン'),
STRUCT(11,'埼玉県','サイタマケン'),
STRUCT(12,'千葉県','チバケン'),
STRUCT(13,'東京都','トウキョウト'),
STRUCT(14,'神奈川県','カナガワケン'),
STRUCT(15,'新潟県','ニイガタケン'),
STRUCT(16,'富山県','トヤマケン'),
STRUCT(17,'石川県','イシカワケン'),
STRUCT(18,'福井県','フクイケン'),
STRUCT(19,'山梨県','ヤマナシケン'),
STRUCT(20,'長野県','ナガノケン'),
STRUCT(21,'岐阜県','ギフケン'),
STRUCT(22,'静岡県','シズオカケン'),
STRUCT(23,'愛知県','アイチケン'),
STRUCT(24,'三重県','ミエケン'),
STRUCT(25,'滋賀県','シガケン'),
STRUCT(26,'京都府','キョウトフ'),
STRUCT(27,'大阪府','オオサカフ'),
STRUCT(28,'兵庫県','ヒョウゴケン'),
STRUCT(29,'奈良県','ナラケン'),
STRUCT(30,'和歌山県','ワカヤマケン'),
STRUCT(31,'鳥取県','トットリケン'),
STRUCT(32,'島根県','シマネケン'),
STRUCT(33,'岡山県','オカヤマケン'),
STRUCT(34,'広島県','ヒロシマケン'),
STRUCT(35,'山口県','ヤマグチケン'),
STRUCT(36,'徳島県','トクシマケン'),
STRUCT(37,'香川県','カガワケン'),
STRUCT(38,'愛媛県','エヒメケン'),
STRUCT(39,'高知県','コウチケン'),
STRUCT(40,'福岡県','フクオカケン'),
STRUCT(41,'佐賀県','サガケン'),
STRUCT(42,'長崎県','ナガサキケン'),
STRUCT(43,'熊本県','クマモトケン'),
STRUCT(44,'大分県','オオイタケン'),
STRUCT(45,'宮崎県','ミヤザキケン'),
STRUCT(46,'鹿児島県','カゴシマケン'),
STRUCT(47,'沖縄県','オキナワケン')
])
)
SELECT
id, name, name_kana
FROM
prefecture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment