KEY关键字是什么意思? [英] What does the KEY keyword mean?

查看:42
本文介绍了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关键字是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆