酷代码 AI
菜单
服务商

SQL 修正:创建带唯一索引的 py_plan_opportunity_point 表

It looks like your table creation statement was cut off or had a typo. You were defining an index but the syntax is incomplete. Below is the corrected version assuming you want a unique index on `location_code` and `point_type`. ```sql CREATE TABLE `py_plan_opportunity_point` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id', `location_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规划点/机会点编码', `location_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '规划点名称', `point_type` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '点类型(1:规划点/2:机会点)', PRIMARY KEY (`id`), UNIQUE KEY `py_plan_opportunity_point_uniq` (`location_code`, `point_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; ``` This SQL statement creates a table called `py_plan_opportunity_point` with fields `id`, `location_code`, `location_name`, and `point_type`. It also includes a primary key on `id` and a unique constraint on the combination of `location_code` and `point_type`. This ensures that each combination of location code and point type is unique within the table. ######[AI写代码神器 | 328点数解答 | 2024-09-04 16:07:48]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]