Thursday, 31 March 2011

SQL INDEX

Indexes help us retrieve data from tables quicker

Syntax:
CREATE INDEX "INDEX_NAME" ON "TABLE_NAME" (COLUMN_NAME)

Example:
CREATE INDEX IDX_CUSTOMER_LAST_NAME
on CUSTOMER (Last_Name)


If we want to create an index on both City and Country, we would type in,

CREATE INDEX IDX_CUSTOMER_LOCATION
on CUSTOMER (City, Country)

No comments:

Post a Comment