zoukankan      html  css  js  c++  java
  • SQL Server 中几种索引的简单理解

    主键(Primary Key):主键在一个表中可以有多个,但是主键的内容不能为空。

    create table 表名 (    字段名1 int not null,    …………,
       [constraint 约束名] primary key (字段名1, …)
     )
    
    alter table 表名 [add constraint 约束名] primary key(字段名1 ,… )
    
    ALTER TABLE 表名DROP CONSTRAINT 约束名
    

    聚焦索引:表的物理存储顺序与指针(即逻辑)顺序相同,一张表存在的聚焦索引不能超过1个。形如:按字典的字母排序查找生字;

    create clustered index index_name on table_name(column asc,)
    
    create unique clustered index index_name on table_name(column asc,) //唯一聚集索引
    
    drop  index index_name on table_name with (online=off)
    

    非聚集索引:物理与逻辑顺序不同,一张表可以存在多个非聚集索引。形如:字典按部首查找生字。

     

    create nonclustered index index_name on table_name(column asc,)
    
    
    drop  index index_name on table_name with (online=off)
    

     

     

  • 相关阅读:
    easypoi添加下拉预选值
    java启动项目字符编码和配置文件的字符编码问题
    leetcode
    leetcode
    leetcode
    leetcode
    事务的隔离级别- 极客时间()
    数据库的事务
    SQL中的视图(极客时间)
    SQL中的连接(极客时间)
  • 原文地址:https://www.cnblogs.com/Janzen/p/5985261.html
Copyright © 2011-2022 走看看