SQL Index


Prev Tutorial Next Tutorial

SQL Index

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

Syntax

	
CREATE INDEX index_name
ON table_name (column_name)

Note: Index syntax is vary from database to database.

Example

CREATE INDEX PIndex
ON Employee (name)

You can also create index for multiple column at a time

Example

CREATE INDEX PIndex
ON Employee (name, salary)

Prev Tutorial Next Tutorial

Advertisements




Facebook Likes

Advertisements