What does the KEY keyword mean?(KEY关键字是什么意思?)
问题描述
在这个 MySQL 表定义中:
In this MySQL table definition:
CREATE TABLE groups (
ug_main_grp_id smallint NOT NULL default '0',
ug_uid smallint default NULL,
ug_grp_id smallint default NULL,
KEY (ug_main_grp_id)
);
KEY
关键字是什么意思?它不是主键,也不是外键,那么它只是一个索引吗?如果是这样,使用 KEY
创建的这种类型的索引有什么特别之处?
What does the KEY
keyword mean? It's not a primary key, it's not a foreign key, so is it just an index? If so, what is so special about this type of index created with KEY
?
推荐答案
引用自 create-table - 索引和键
{INDEX|KEY}
所以 KEY
通常是一个 INDEX
KEY 通常是 INDEX 的同义词.键属性 PRIMARY KEY 可以在列定义中给出时,也可以仅指定为 KEY.这个实施是为了与其他数据库系统兼容.
KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems.
这篇关于KEY关键字是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:KEY关键字是什么意思?


基础教程推荐
- 在多列上分布任意行 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01