Mysql復(fù)合主鍵和聯(lián)合主鍵的區(qū)別解析
復(fù)合主鍵:
create table index_test
(
a int not null,
b int not null,
c int not null,
d int null,
primary key (c, a, b)
);即一個(gè)表的主鍵同時(shí)由多個(gè)字段共同組成,復(fù)合主鍵索引見【Mysql】復(fù)合主鍵的索引。
聯(lián)合主鍵:
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的聯(lián)合主鍵,就是個(gè)邏輯概念
到此這篇關(guān)于Mysql復(fù)合主鍵和聯(lián)合主鍵的區(qū)別的文章就介紹到這了,更多相關(guān)mysql復(fù)合主鍵和聯(lián)合主鍵內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
詳解MySQL數(shù)據(jù)庫(kù)insert和update語(yǔ)句
用于操作數(shù)據(jù)庫(kù)的SQL一般分為兩種,一種是查詢語(yǔ)句,也就是我們所說的SELECT語(yǔ)句,另外一種就是更新語(yǔ)句,也叫做數(shù)據(jù)操作語(yǔ)句。接下來通過本文給大家介紹MySQL數(shù)據(jù)庫(kù)insert和update語(yǔ)句,需要的朋友一起學(xué)習(xí)吧2016-04-04
MySQL數(shù)據(jù)庫(kù)備份和還原的常用命令小結(jié)
MySQL數(shù)據(jù)庫(kù)備份和還原的常用命令小結(jié),學(xué)習(xí)mysql的朋友可以參考下2012-03-03
mysql動(dòng)態(tài)游標(biāo)學(xué)習(xí)(mysql存儲(chǔ)過程游標(biāo))
mysql動(dòng)態(tài)游標(biāo)示例,通過準(zhǔn)備語(yǔ)句、視圖和靜態(tài)游標(biāo)實(shí)現(xiàn),大家參考使用吧2013-12-12

