SQL keys, MUL vs PRI vs UNI(SQL 键,MUL 与 PRI 与 UNI)
问题描述
MySQL中MUL
、PRI
和UNI
有什么区别?
What is the difference between MUL
, PRI
and UNI
in MySQL?
我正在使用以下命令处理 MySQL 查询:
I'm working on a MySQL query, using the command:
desc mytable;
其中一个字段显示为 MUL
键,其他字段显示为 UNI
或 PRI
.
One of the fields is shown as being a MUL
key, others show up as UNI
or PRI
.
我知道如果一个键是 PRI
,那么每个表只能有一条记录与该键相关联.如果一个键是 MUL
,那是否意味着可能有多个关联记录?
I know that if a key is PRI
, only one record per table can be associated with that key. If a key is MUL
, does that mean that there could be more than one associated record?
这是mytable
的响应.
+-----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+-------+
| courseid | int(11) | YES | MUL | NULL | |
| dept | char(3) | YES | | NULL | |
| coursenum | char(4) | YES | | NULL | |
+-----------+---------+------+-----+---------+-------+
推荐答案
表示该字段是(部分)非唯一索引.你可以发出
It means that the field is (part of) a non-unique index. You can issue
show create table <table>;
查看有关表结构的更多信息.
To see more information about the table structure.
这篇关于SQL 键,MUL 与 PRI 与 UNI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL 键,MUL 与 PRI 与 UNI


- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01