movie_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL
时间: 2023-10-27 19:37:23 浏览: 109
这是一个MySQL的表字段定义语句,该字段名为 `movie_name`,类型为 `varchar`,长度为32个字符,字符集为 `utf8mb4`,排序规则为 `utf8mb4_general_ci`,不允许为空。这意味着在该表中,每条记录都必须包含一个长度不超过32个字符的电影名称。同时,该字段支持存储包括中文在内的任意字符,且对于字符的排序规则采用了一种较为宽松的方式。
相关问题
把这段代码改为doris的建表语句CREATE TABLE `aa_ccd` ( `ID` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `CCDCODE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ICNNAME` varchar(107) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ISDISEASE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ENNAME` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `PARENTID` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `YEAR` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `NOTE` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEFTSPACE` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LIMITED` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL2` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL3` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL4` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE, INDEX `index1`(`CCDCODE`) USING BTREE, INDEX `index2`(`ICNNAME`) USING BTREE, INDEX `index_yes`(`YEAR`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
您好!以下是将代码改为Doris建表语句的结果:
CREATE TABLE aa_ccd (
ID VARCHAR(20),
CCDCODE VARCHAR(20),
ICNNAME VARCHAR(107),
ISDISEASE VARCHAR(20),
ENNAME VARCHAR(20),
PARENTID VARCHAR(20),
YEAR VARCHAR(4),
NOTE VARCHAR(200),
LEFTSPACE VARCHAR(10),
LIMITED VARCHAR(4),
LEVEL1 VARCHAR(4),
LEVEL2 VARCHAR(4),
LEVEL3 VARCHAR(4),
LEVEL4 VARCHAR(4)
) DISTRIBUTE BY HASH(ID) BUCKETS 8 PROPERTIES("replication_num"="1");
DROP TABLE IF EXISTS `aa_ccd`; CREATE TABLE `aa_ccd` ( `ID` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `CCDCODE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ICNNAME` varchar(107) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ISDISEASE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `ENNAME` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `PARENTID` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `YEAR` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `NOTE` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEFTSPACE` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LIMITED` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL1` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL2` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL3` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `LEVEL4` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE, INDEX `index1`(`CCDCODE`) USING BTREE, INDEX `index2`(`ICNNAME`) USING BTREE, INDEX `index_yes`(`YEAR`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; 这个建表sql在doris数据库执行时报错,[SQL] Query doris_2 start [ERR] 1105 - errCode = 2, detailMessage = Syntax error in line 25: `id` varchar(50) CHARACTER SET utf8mb4 COLLAT... ^ Encountered: CHARACTER Expected: COMMA [ERR] 这是为什么
根据报错信息,可以看到是在第25行出现了语法错误,缺少了逗号。具体来说,是因为在第24行的最后缺少了一个逗号,导致第25行的语句被解析为一个新的字段,而不是原本的字段属性。因此,应该在第24行最后加上逗号,即在 `LEVEL4` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL 后面加一个逗号,就可以解决这个问题了。
阅读全文