create index [index_mode] on [cn_name]([car_mode]);
index_mode custom index name
cn_name table name
car_mode column name
1. Create a common index
SQL CREATE INDEX syntax
Create a simple index on the table. Duplicate values are allowed:
CREATE INDEX index_name
ON table_name (column_name);
Note: "column_name" specifies the column that needs to be indexed.
2. Create a unique index
SQL CREATE UNIQUE INDEX syntax
Create a unique index on the table. A unique index means that two rows cannot have the same index value.
CREATE UNIQUE INDEX index_name
ON table_name (column_name);
3. Example
CREATE INDEX Example
This example will create a simple index named "PersonIndex" in the LastName column of the Person table:
CREATE INDEX PersonIndex
ON Person (LastName);
4. Index Add Constraints
If you want to index the values in a column in descending order, you can add the reserved word DESC after the column name:
CREATE INDEX PersonIndex
ON Person (LastName DESC);
5. Combined index
If you want to index more than one column, you can list the names of the columns in parentheses, separated by commas:
CREATE INDEX PersonIndex
ON Person (LastName, FirstName);