-- ----------------------------
-- by AI
-- ----------------------------
CREATE TABLE `iso3166_country` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `alpha_2` char(2) NOT NULL COMMENT 'ISO 3166-1 二位字母代码',
  `alpha_3` char(3) NOT NULL COMMENT 'ISO 3166-1 三位字母代码',
  `numeric` char(3) NOT NULL COMMENT 'ISO 3166-1 三位数字代码',
  `name_zh` varchar(100) NOT NULL COMMENT '中文名称',
  `name_en` varchar(100) NOT NULL COMMENT '英文名称',
  `region` varchar(50) DEFAULT NULL COMMENT '地理区域',
  `sub_region` varchar(50) DEFAULT NULL COMMENT '子区域',
  `is_independent` tinyint(1) DEFAULT '1' COMMENT '是否独立国家：1-是，0-否',
  `is_enabled` tinyint(1) DEFAULT '1' COMMENT '是否启用：1-启用，0-禁用',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_alpha_2` (`alpha_2`),
  UNIQUE KEY `uk_alpha_3` (`alpha_3`),
  UNIQUE KEY `uk_numeric` (`numeric`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='国家信息表 (ISO 3166-1)';


-- 插入 ISO 3166-1 标准国家数据
INSERT INTO `iso3166_country` (`alpha_2`, `alpha_3`, `numeric`, `name_zh`, `name_en`, `region`, `sub_region`, `is_independent`) VALUES
-- 亚洲
('CN', 'CHN', '156', '中国', 'China', 'Asia', 'Eastern Asia', 1),
('JP', 'JPN', '392', '日本', 'Japan', 'Asia', 'Eastern Asia', 1),
('KR', 'KOR', '410', '韩国', 'Korea, Republic of', 'Asia', 'Eastern Asia', 1),
('IN', 'IND', '356', '印度', 'India', 'Asia', 'Southern Asia', 1),
('SG', 'SGP', '702', '新加坡', 'Singapore', 'Asia', 'South-Eastern Asia', 1),
('MY', 'MYS', '458', '马来西亚', 'Malaysia', 'Asia', 'South-Eastern Asia', 1),
('TH', 'THA', '764', '泰国', 'Thailand', 'Asia', 'South-Eastern Asia', 1),
('VN', 'VNM', '704', '越南', 'Viet Nam', 'Asia', 'South-Eastern Asia', 1),
('ID', 'IDN', '360', '印度尼西亚', 'Indonesia', 'Asia', 'South-Eastern Asia', 1),
('PH', 'PHL', '608', '菲律宾', 'Philippines', 'Asia', 'South-Eastern Asia', 1),

-- 欧洲
('GB', 'GBR', '826', '英国', 'United Kingdom', 'Europe', 'Northern Europe', 1),
('DE', 'DEU', '276', '德国', 'Germany', 'Europe', 'Western Europe', 1),
('FR', 'FRA', '250', '法国', 'France', 'Europe', 'Western Europe', 1),
('IT', 'ITA', '380', '意大利', 'Italy', 'Europe', 'Southern Europe', 1),
('ES', 'ESP', '724', '西班牙', 'Spain', 'Europe', 'Southern Europe', 1),
('RU', 'RUS', '643', '俄罗斯', 'Russian Federation', 'Europe', 'Eastern Europe', 1),
('NL', 'NLD', '528', '荷兰', 'Netherlands', 'Europe', 'Western Europe', 1),
('CH', 'CHE', '756', '瑞士', 'Switzerland', 'Europe', 'Western Europe', 1),
('SE', 'SWE', '752', '瑞典', 'Sweden', 'Europe', 'Northern Europe', 1),
('NO', 'NOR', '578', '挪威', 'Norway', 'Europe', 'Northern Europe', 1),

-- 北美洲
('US', 'USA', '840', '美国', 'United States of America', 'Americas', 'Northern America', 1),
('CA', 'CAN', '124', '加拿大', 'Canada', 'Americas', 'Northern America', 1),
('MX', 'MEX', '484', '墨西哥', 'Mexico', 'Americas', 'Central America', 1),

-- 南美洲
('BR', 'BRA', '076', '巴西', 'Brazil', 'Americas', 'South America', 1),
('AR', 'ARG', '032', '阿根廷', 'Argentina', 'Americas', 'South America', 1),
('CL', 'CHL', '152', '智利', 'Chile', 'Americas', 'South America', 1),
('CO', 'COL', '170', '哥伦比亚', 'Colombia', 'Americas', 'South America', 1),

-- 大洋洲
('AU', 'AUS', '036', '澳大利亚', 'Australia', 'Oceania', 'Australia and New Zealand', 1),
('NZ', 'NZL', '554', '新西兰', 'New Zealand', 'Oceania', 'Australia and New Zealand', 1),

-- 非洲
('ZA', 'ZAF', '710', '南非', 'South Africa', 'Africa', 'Southern Africa', 1),
('EG', 'EGY', '818', '埃及', 'Egypt', 'Africa', 'Northern Africa', 1),
('NG', 'NGA', '566', '尼日利亚', 'Nigeria', 'Africa', 'Western Africa', 1),
('KE', 'KEN', '404', '肯尼亚', 'Kenya', 'Africa', 'Eastern Africa', 1),
('MA', 'MAR', '504', '摩洛哥', 'Morocco', 'Africa', 'Northern Africa', 1),

-- 特殊地区
('HK', 'HKG', '344', '香港', 'Hong Kong', 'Asia', 'Eastern Asia', 0),
('MO', 'MAC', '446', '澳门', 'Macao', 'Asia', 'Eastern Asia', 0),
('TW', 'TWN', '158', '台湾', 'Taiwan, Province of China', 'Asia', 'Eastern Asia', 0);