Index statement is used create indexes in table. By using index you can retrieve data without reading whole date, it means by using index you can retrieve data fastly.
Note: Updating a table with indexes takes more time than updating a table without index, because the indexes also need an update.
Advantage of Index
- Find data fast
- Find data more quickly and efficiently
CREATE INDEX index_name ON table_name (column_name)
Note: Index syntax is vary from database to database.
CREATE INDEX PIndex ON Employee (name)
You can also create index for multiple column at a time
CREATE INDEX PIndex ON Employee (name, salary)