添加PRIMARY KEY索引时对此SQL代码的说明(Explanation of this SQL code in adding PRIMARY KEY index)

编程入门 行业动态 更新时间:2024-10-24 16:32:54
添加PRIMARY KEY索引时对此SQL代码的说明(Explanation of this SQL code in adding PRIMARY KEY index)

我看到了以下SQL代码。 我完全理解它。 但是没有得到的是代码中的66

CREATE TABLE `wordpress`.`campaign_queue` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`(66)) ) ENGINE = InnoDB;

I saw the following SQL code. I perfectly understand it. But what am not getting is what the 66 in the code does.

CREATE TABLE `wordpress`.`campaign_queue` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`(66)) ) ENGINE = InnoDB;

最满意答案

查询说明:它告诉MySQL在id列的前66个字母上创建子部分键* 。 这仅适用于字符串类型,因此除非将字段类型更改为String,否则查询将返回错误

Explanation of the query: it is telling MySQL to create a sub part key* on the first 66 letters of id column. This only works for string types, so that query will return an error unless you change the field type to String

更多推荐

本文发布于:2023-08-05 06:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1430192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:索引   对此   代码   PRIMARY   KEY

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!