SQL 学习笔记之索引
2010-01-29 22:28
274 查看
----use pubs-sales
-----创建索引
create index index_name
on authors(au_lname)
--创建索引后表中所有的数据跟之前没有区别
select * from authors
--单独查索引列
select au_lname from authors
--强制使用非簇集索引
select * from authors with(index(index_name))
--多字段非簇集索引
create index index_phoneaddress on authors(phone,address)
select * from authors with(index(index_phoneaddress))
---使用clusterde创建簇集索引
--主键默认是簇集索引,一个表只能有一个簇集索引,所以先去掉auidind
Drop index authors.UPKCL_auidind
create clustered index clusteredindex_name
on authors(au_lname)
--销毁索引
drop index authors.index_name
drop index authors.clusteredindex_name
-----创建索引
create index index_name
on authors(au_lname)
--创建索引后表中所有的数据跟之前没有区别
select * from authors
--单独查索引列
select au_lname from authors
--强制使用非簇集索引
select * from authors with(index(index_name))
--多字段非簇集索引
create index index_phoneaddress on authors(phone,address)
select * from authors with(index(index_phoneaddress))
---使用clusterde创建簇集索引
--主键默认是簇集索引,一个表只能有一个簇集索引,所以先去掉auidind
Drop index authors.UPKCL_auidind
create clustered index clusteredindex_name
on authors(au_lname)
--销毁索引
drop index authors.index_name
drop index authors.clusteredindex_name
相关文章推荐
- SQL基础学习笔记(五)—序列、索引、同义词
- MYSQL学习笔记——sql语句优化之索引
- sql建立索引学习笔记[转]
- MYSQL数据库优化之SQL及索引优化-学习笔记(2)
- PL/SQL学习笔记-索引
- SQL学习笔记八 索引,表连接,子查询,ROW_NUMBER
- Oracle学习笔记之六(DDL:表、索引、视图、同义词、序列操作相关SQL)
- 经典SQL学习笔记 (六)-用户管理、视图、序列、索引、权限
- SQL学习笔记7 游标 约束 索引 触发器
- SQL学习笔记八 索引,表连接,子查询,ROW_NUMBER
- PL/SQL学习笔记-索引
- 个人学习笔记14之--浅谈动态SQL
- 个人学习笔记11之--SQL 中的 图 树 层次结构
- java 从零开始,学习笔记之基础入门<SQL_Server>(二十一)
- 【MongoDB学习笔记23】MongoDB的索引对象和数组
- 【MongoDB学习笔记25】MongoDB的索引类型
- linq to sql 语法 学习笔记 存一下
- mysql数据库 sql语句学习笔记1 建库,建表,改表
- mybatis学习笔记2-SQL的简单应用
- Learning Spark (Python版) 学习笔记(三)----工作原理、调优与Spark SQL