SQL CREATE INDEX Statement
SQL CREATE INDEX Statement
The CREATE INDEX statement is used to create indexes in tables.
Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up searches/queries
CREATE INDEX Syntax
Creates an index on a table. Duplicate values are allowed:
CREATE INDEX index_name
ON table_name (column1, column2, ...);
Example:
CREATE INDEX idx_lastname
ON Persons (LastName);
ON Persons (LastName);
Example:
CREATE INDEX idx_pname
ON Persons (LastName, FirstName);
ON Persons (LastName, FirstName);
Source: https://www.w3schools.com/sql/sql_create_index.asp
Comments
Post a Comment