The CREATE INDEX statement is used to create indexes in tables.
Indexes are used in the database application to find data fast; .
Indexes
We Create index in a table to find data more quickly
indexes are not visible to the user, they are just used to speed up searches/queries.Note: The disadvantage of the index is , it takes more time at the in Updating a table with indexes updating a table without (because the indexes also need an update). So you should only create indexes on columns (and tables) that will be frequently searched against.
SQL CREATE INDEX Syntax
Creates an index on a table. Duplicate values are allowed:
CREATE INDEX index_name
ON table_name (column_name)
ON table_name (column_name)
SQL CREATE UNIQUE INDEX Syntax
Creates a unique index on a table. Duplicate values are not allowed:
CREATE UNIQUE INDEX index_name
ON table_name (column_name)
ON table_name (column_name)
CREATE INDEX Example
The SQL statement below creates an index named "PIndex" on the "LastName" column in the "Persons" table:
CREATE INDEX PIndex
ON Persons (LastName)
ON Persons (LastName)
CREATE INDEX PIndex
ON Persons (LastName, FirstName)
ON Persons (LastName, FirstName)

0 comments:
Post a Comment