What is the difference between a unique constraint and a unique index?

Source: Internet
Author: User
A unique constraint can be used to guarantee that one or more column values are unique when one record is added to the base table. If a unique constraint has been given or defined above,
It is not possible for any operation to replace the copied values in these columns. Although unique, system-required indexes are used to enforce unique constraints, define unique constraints
There is a difference between creating a unique index. Even if both of these can enhance uniqueness, a unique index allows NULL values and is generally not used in indicative
Constraints. In other words, a unique constraint does not allow null values and can be used in a foreign key specification ("NULL" means that the column value is ambiguous and differs from other values
, including other null values).

What is the difference between a unique constraint and a unique index?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.