Create unique index on multiple columns

    how to create unique index in sql
    how to create non unique index in sql server
    how to create unique clustered index in sql server
    how to create unique nonclustered index in sql server
  • How to create unique index in sql
  • Drop index sql server...

    SQL - Unique Indexes



    SQL Unique Indexes

    The SQL Unique Index ensures that no two rows in the indexed columns of a table have the same values (no duplicate values allowed).

    A unique index can be created on one or more columns of a table using the CREATE UNIQUE INDEX statement in SQL.

    Following are the points to be noted before creating a Unique Index on a table −

    • If the unique index is only created on a single column, the rows in that column will be unique.
    • If a single column contains NULL in multiple rows, we cannot create a unique index on that column.
    • If the unique index is created on multiple columns, the combination of rows in these columns will be unique.
    • We cannot create a unique index on multiple columns if the combination of columns contains NULL in more than one row.

    Syntax

    Following is the syntax for creating a UNIQUE INDEX in SQL −

    CREATE UNIQUE INDEX index_name ON table_name (column1, column2, ..., columnN);

    Here,

    • index_name is the name of the index that you want to create.
    • table_name is the name of the table on which you want t

        how to create unique index in oracle sql
        how to create unique index on multiple columns in sql server