Mysql复合主键和联合主键的区别解析
作者:maerpao 时间:2024-01-24 04:57:42
复合主键:
create table index_test
(
a int not null,
b int not null,
c int not null,
d int null,
primary key (c, a, b)
);
即一个表的主键同时由多个字段共同组成,复合主键索引见【Mysql】复合主键的索引。
联合主键:
create table index_test_a
(
id int not null,
a int not null
primary key (id)
);
create table index_test_b
(
id int not null,
b int not null
primary key (id)
);
create table index_test_a_b
(
id int not null,
a_id int not null,
b_id int not null,
primary key (id)
);
index_test_a_b表的id为表index_test_a和表index_test_b的联合主键,就是个逻辑概念
来源:https://www.cnblogs.com/maerpao/p/17351513.html
标签:mysql,复合主键,联合主键
0
投稿
猜你喜欢
Matlab常用的输出命令disp与fprintf解读
2022-03-18 17:13:58
IE8网页显示不正常 用”兼容性视图”搞定
2009-03-28 11:13:00
PHP多种序列化/反序列化的方法详解
2024-04-30 08:47:55
详解Laravel服务容器的优势
2023-10-31 03:36:04
下一站:HandlerSocket!
2011-04-11 09:02:00
Python Web框架Tornado运行和部署
2021-04-14 09:17:57
Python函数中参数是传递值还是引用详解
2022-10-13 02:45:18
PyQt5每天必学之布局管理
2022-11-19 08:14:00
Python学习笔记之抓取某只基金历史净值数据实战案例
2021-08-14 20:28:13
js比较日期大小的方法
2024-04-10 10:49:45
阿里云CentOS7搭建Apache+PHP+MySQL环境
2023-11-23 02:44:59
C#操作SQLite数据库之读写数据库的方法
2024-01-27 21:46:33
python timestamp和datetime之间转换详解
2021-02-07 11:17:51
ElementUI嵌套页面及关联增删查改实现示例
2023-07-02 16:54:45
使用Python创建简单的HTTP服务器的方法步骤
2023-07-17 01:33:27
Python使用Beautiful Soup爬取豆瓣音乐排行榜过程解析
2023-10-13 08:08:24
javascript preload&lazy load
2023-09-01 06:15:43
基于Python的身份证验证识别和数据处理详解
2021-04-22 04:43:09
淘宝首页代码调整
2011-04-22 12:44:00
pyinstaller还原python代码过程图解
2022-04-09 10:06:59