Simple Create index in MS SQL
Simple Create index in MS SQL
CREATE INDEX - creates an index (search key)
Syntax
CREATE [UNIQUE] [CLUSTERED | NONCLUSTERED]
? ? ? INDEX index_name ON table (column [,…n])
[WITH
? ? ? ? ? ? ? [PAD_INDEX]
? ? ? ? ? ? ? [[,] FILLFACTOR = fillfactor]
? ? ? ? ? ? ? [[,] IGNORE_DUP_KEY]
? ? ? ? ? ? ? [[,] DROP_EXISTING]
? ? ? ? ? ? ? [[,] STATISTICS_NORECOMPUTE]
]
[ON filegroup]
Examples
A. Use a simple index
USE pubs
CREATE INDEX au_id_ind
? ? ? ON authors (au_id)
Database: Pubs
Table: Authors
Index Column: au_id
Index Name: au_id_ind