索引類型介紹:

創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),柳州企業(yè)網(wǎng)站建設(shè),柳州品牌網(wǎng)站建設(shè),網(wǎng)站定制,柳州網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,柳州網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
主鍵索引
primary key() 要求關(guān)鍵字不能重復(fù),也不能為null,同時(shí)增加主鍵約束 主鍵索引定義時(shí),不能命名
唯一索引
unique index() 要求關(guān)鍵字不能重復(fù),同時(shí)增加唯一約束
普通索引
index() 對(duì)關(guān)鍵字沒(méi)有要求
全文索引
fulltext key() 關(guān)鍵字的來(lái)源不是所有字段的數(shù)據(jù),而是字段中提取的特別關(guān)鍵字
關(guān)鍵字:可以是某個(gè)字段或多個(gè)字段,多個(gè)字段稱為復(fù)合索引。
實(shí)例:
建表:
creat table student(
stu_id int unsigned not null auto_increment,
name varchar(32) not null default '',
phone char(11) not null default '',
stu_code varchar(32) not null default '',
stu_desc text,
primary key ('stu_id'), //主鍵索引
unique index 'stu_code' ('stu_code'), //唯一索引
index 'name_phone' ('name','phone'), //普通索引,復(fù)合索引
fulltext index 'stu_desc' ('stu_desc'), //全文索引) engine=myisam charset=utf8;
更新:
alert table student add primary key ('stu_id'), //主鍵索引
add unique index 'stu_code' ('stu_code'), //唯一索引
add index 'name_phone' ('name','phone'), //普通索引,復(fù)合索引
add fulltext index 'stu_desc' ('stu_desc'); //全文索引刪除:
alert table sutdent
drop primary key,
drop index 'stu_code',
drop index 'name_phone',
drop index 'stu_desc';以上就是MySQL索引類型介紹的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注創(chuàng)新互聯(lián)其它相關(guān)文章!
本文標(biāo)題:mysql數(shù)據(jù)庫(kù)的索引類型
分享路徑:http://www.chinadenli.net/article36/iejjsg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、定制網(wǎng)站、軟件開(kāi)發(fā)、移動(dòng)網(wǎng)站建設(shè)、企業(yè)建站、云服務(wù)器
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)