-- Annual master of H2032 above-scale enterprises.
|
-- One row per enterprise per statistical year.
|
CREATE TABLE IF NOT EXISTS h2032_enterprise_year (
|
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
stat_year SMALLINT NOT NULL COMMENT 'Statistical year',
|
enterprise_code VARCHAR(50) NULL COMMENT 'Enterprise code',
|
enterprise_name VARCHAR(200) NOT NULL COMMENT 'Enterprise name',
|
region_code VARCHAR(20) NULL COMMENT 'Administrative region code',
|
city VARCHAR(50) NOT NULL COMMENT 'Prefecture-level city',
|
source_period VARCHAR(20) NOT NULL COMMENT 'Source monthly report period',
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
UNIQUE KEY uk_h2032_enterprise_year_name (stat_year, enterprise_name),
|
UNIQUE KEY uk_h2032_enterprise_year_code (stat_year, enterprise_code),
|
KEY idx_h2032_enterprise_year_city (stat_year, city)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Annual master of H2032 above-scale enterprises';
|
|
-- Seed 2026 from the September monthly report. The annual list is fixed for
|
-- the year, so the source period is retained for audit traceability.
|
INSERT INTO h2032_enterprise_year (
|
stat_year,
|
enterprise_code,
|
enterprise_name,
|
region_code,
|
city,
|
source_period
|
)
|
SELECT
|
2026,
|
TRIM(enterprise_code),
|
TRIM(enterprise_name),
|
TRIM(region_code),
|
CASE LEFT(TRIM(region_code), 4)
|
WHEN '4201' THEN '武汉市'
|
WHEN '4202' THEN '黄石市'
|
WHEN '4203' THEN '十堰市'
|
WHEN '4205' THEN '宜昌市'
|
WHEN '4206' THEN '襄阳市'
|
WHEN '4207' THEN '鄂州市'
|
WHEN '4208' THEN '荆门市'
|
WHEN '4209' THEN '孝感市'
|
WHEN '4210' THEN '荆州市'
|
WHEN '4211' THEN '黄冈市'
|
WHEN '4212' THEN '咸宁市'
|
WHEN '4213' THEN '随州市'
|
WHEN '4228' THEN '恩施州'
|
WHEN '4290' THEN
|
CASE LEFT(TRIM(region_code), 6)
|
WHEN '429004' THEN '仙桃市'
|
WHEN '429005' THEN '潜江市'
|
WHEN '429006' THEN '天门市'
|
WHEN '429021' THEN '神农架林区'
|
ELSE NULL
|
END
|
ELSE NULL
|
END,
|
report_period
|
FROM h2032_enterprise_monthly
|
WHERE report_period = '2026-09'
|
ON DUPLICATE KEY UPDATE
|
enterprise_code = VALUES(enterprise_code),
|
region_code = VALUES(region_code),
|
city = VALUES(city),
|
source_period = VALUES(source_period);
|