---------添加索引方法--------- 1.添加PRIMARY KEY(主鍵索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) 2.添加UNIQUE(惟一索引) mysql>ALTER TABLE `table_name` ADD UNIQUE ( `column` ) 3.添加INDEX(普通索引) mysql>ALTER TABLE `table_name` ADD INDEX index_name ( `column` ) 4.添加FULLTEXT(全文索引) mysql>ALTER TABLE `table_name` ADD FULLTEXT ( `column` ) 5.添加多列索引 mysql>ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )
http://www.javashuo.com/article/p-ktnahidm-dv.htmlhtml
查看錶的索引: show index from table_name(表名) https://blog.csdn.net/superdangbo/article/details/79283752
SQL Server索引mysql
--刪除索引 if exists(select name from sysindexes where name = 'suoyin') drop index temp.suoyin ---若是存在這個名字的索引,則刪除這個索引 create nonclustered index suoyin_name on temp(Name) --主鍵,加彙集索引 ALTER TABLE [dbo].[FcyOrder] ADD CONSTRAINT [PK_FcuencyOrder] PRIMARY KEY CLUSTERED ( [FreqOrderId] ASC ) go CREATE NONCLUSTERED INDEX [IX_Code] ON [dbo].[Fct_Product] ([ProductCode]) ON [PRIMARY] GO CREATE INDEX [IX_OrderId] ON [dbo].[FncyOrder] ([OrderId] ASC) GO CREATE INDEX [IDX_Disabled_ChanyCodeAndName] ON [dbo].[Fcommodity] ([Disabled] ASC) INCLUDE ([ChadityCode], [ChaodityName]) GO CREATE UNIQUE INDEX [IDX_SiteWarehouseAndSerialNumber] ON [dbo].[FcquestInfo] ([SerialNumber] ASC, [SiouseId] ASC) WITH (IGNORE_DUP_KEY = ON) GO CREATE UNIQUE INDEX [IX_tockFove_FoveNo] ON [dbo].[TockFove] ([FveNo] ASC) WITH (IGNORE_DUP_KEY = ON) GO