index example in sql

Example 1: sql create index

CREATE INDEX index_name
ON tableName (tableColumn);

Example 2: sql indexes

CREATE INDEX
Creates an index named ‘idx_test’ on the first_name and surname columns of
the users table. In this instance, duplicate values are allowed.
CREATE INDEX idx_test
ON users (first_name, surname);
CREATE UNIQUE INDEX
Creates an index named ‘idx_test’ on the first_name and surname columns of
the users table. In this instance, duplicate values are allowed.
CREATE UNIQUE INDEX idx_test
ON users (first_name, surname);
DROP INDEX
Creates an index named ‘idx_test’ on the first_name and surname columns of
the users table. In this instance, duplicate values are allowed.
ALTER TABLE users
DROP INDEX idx_test;

Tags:

Sql Example