The CREATE INDEX statement is used to create indexes in tables.
Indexes allow the database application to find data fast; without reading the whole table.
An index can be created in a table to find data more quickly and efficiently.
The users cannot see the indexes, they are just used to speed up searches/queries.
Note: Updating a table with indexes takes more time than 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.
Creates an index on a table. Duplicate values are allowed:
Creates a unique index on a table. Duplicate values are not allowed:
Note: The syntax for creating indexes varies amongst different databases. Therefore: Check
the syntax for creating indexes in your database.
The SQL statement below creates an index named "PIndex" on the "LastName"
column in the "Persons" table:
If you want to create an index on a combination of columns, you can list the column names within
the parentheses, separated by commas:
Your Query was successfully sent!