TAILIEUCHUNG - Microsoft SQL Server 2005 Developer’s Guide- Part 7

Microsoft SQL Server 2005 Developer’s Guide- P7:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 2 Developing with T-SQL 39 NONCLUSTERED Indexes A nonclustered index on a table or view is an index where the order of the index does not depend on the physical order of the data rows. In other words the columns do not have to be next to each other to make up the index. You can create up to 249 nonclustered indexes for each table in your database. NONCLUSTERED is the default mode when no keyword is specified in the CREATE INDEX statement. Included Columns in Indexes In some cases you may find that you are frequently querying a column in a table that is not a key column. In previous versions of SQL Server you would generally create an indexed view to handle this situation. However one of the restrictions to using an indexed view is that the index must be unique. SQL Server 2005 resolves this by allowing the inclusion of nonkey columns in a nonclustered index. This allows the query optimizer to locate all the required information from an index scan the table or clustered index need not be accessed. SQL Server 2005 allows up to 1023 columns to be included as nonkey columns. The following shows an example of creating a nonclustered index including nonkey columns CREATE NONCLUSTERED INDEX IdxTerritoryID_Date ON TerritoryID INCLUDE ModifiedDate CLUSTERED Indexes A clustered index has the index order the same as the physical order of the rows and the table data is stored with the index. If you regularly access rows in your table in a particular order a clustered index can significantly improve the speed of your queries. SQL Server allows you to create only one clustered index on each table. The following code shows creating a clustered index on the Sales .SalesPerson table CREATE CLUSTERED INDEX IdxPersonTerr ON SalesPersonID TerritoryID UNIQUE Indexes You can create a unique index on a column to guarantee that the data in the column will not be duplicated on an Insert operation. The database engine checks for duplicate values .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.