SQL Server 2008 编程入门经典第9章练习题

9.7 练习

  1. 请说出至少两种确定在 AdventureWorks2008 数据库的 HumanResources.Employee 表中有何种索引的方法。
    1. 如下:
      USE AdventureWorks2008 ;
      
      EXEC sp_helpindex 'HumanResources.Employee'
    2.  如下:
      USE AdventureWorks2008 ;
      
      SELECT *
      FROM 
      	sys.dm_db_index_physical_stats(DB_ID(N'AdventureWorks'), OBJECT_ID(N'AdventureWorks.HumanResources.Employee'), NULL, NULL, NULL);
  2. 在AdventureWorks2008数据库的Production.ProductModel表的ModifiedDate列上创建一个非群集索引。
    USE AdventureWorks2008;
    
    CREATE NONCLUSTERED INDEX MyIndexOnProductModel ON Production.ProductModel(NAME)
  3. 删除在练习2中创建的索引。
    USE AdventureWorks2008;
    
    DROP INDEX Production.ProductModel.MyIndexOnProductModel;

Add comment

Loading