当前位置:数据库 > SQLServer >>

sql创建表索引 create index()语句

sql创建表索引 create index()语句

mssql server 方法
语法:
create [索引类型] index 索引名称
on 表名(列名)
with fillfactor = 填充因子值0~100
go


实例

create nonclustered index ix_test_tname --创建一个非聚集索引
on test(tname)  --为test表的tname字段创建索引
with fillfactor = 30 --填充因子为30%
go

select * from test(index = ix_test_tname) where tname = 'a'


mysql教程 方法

mysql创建索引语法

create [unioun|fulltext|spatial] index indexname[using indextype] on

tablename( tablenamecol)

index_col_name:

col_name[ (length)][asc |desc]

更多详细内容请查看:http://www.zzzyk.com/database/110/mysql-crate-

index.htm

实例

create index 实例
本例会创建一个简单的索引,名为 "personindex",在 person 表的 lastname 列

create index personindex
on person (lastname)
如果您希望以降序索引某个列中的值,您可以在列名称之后添加保留字 desc:

create index personindex
on person (lastname desc)
假如您希望索引不止一个列,您可以在括号中列出这些列的名称,用逗号隔开:

create index personindex
on person (lastname, firstname)

补充:数据库,Mssql 
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,