SQL Create Index statement is used to create Indexes in database table. Indexes are used to retrieve data from database table more quickly than other ways. The user can not see indexes they just used it to speedup searches/queries.
Updating a table with indexes take more time than update table without indexes because indexes also need to update, so index only created on column that will be searches frequently.
There are also duplicated values are allowed in the index.
Syntax for Create Index-
CREATE INDEX indename
ON table_name(column1, column2,…);
Create Unique Index:
When create unique index on a table it does not allowed duplicate values.
Syntax-
CREATE UNIQUE INDEX indename
ON table_name(column1, column2,….);
Example:
Lets take a database table ‘Student’
Now, create an Syntax on above table like as,
create index indexStudent
ON Student (stuName);
To create index on multiple column in a table the following SQL statement is used. It created on other database table ‘StudentRecord;.
create index indexStudent
ON StudentRecord (stuName, stuCourse);
DELETE Index:
DROP INDEX table_name.indename;
Example:
drop index Student.indexStudent;
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
SQL INDEX:
SQL Create Index statement is used to create Indexes in database table. Indexes are used to retrieve data from database table more quickly than other ways. The user can not see indexes they just used it to speedup searches/queries.
Updating a table with indexes take more time than update table without indexes because indexes also need to update, so index only created on column that will be searches frequently.
There are also duplicated values are allowed in the index.
Syntax for Create Index-
Create Unique Index:
When create unique index on a table it does not allowed duplicate values.
Syntax-
Example:
Lets take a database table ‘Student’
Now, create an Syntax on above table like as,
To create index on multiple column in a table the following SQL statement is used. It created on other database table ‘StudentRecord;.
DELETE Index:
Example: