This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14339|Reply: 2

[Source] SQL creates a field unique constraint that can be empty for multiple records

[Copy link]
Posted on 1/5/2016 11:54:53 AM | | |

Primary key, unique constraints, and no constraints
    There are the following minor differences between primary key constraints and unique constraints.

    Primary key constraints do not allow NULL values. The index key of any index is not allowed to contain null values.However, the unique constraint allows the inclusion of NULL values, but the unique constraint treats two NULL values as duplicate values, so each column with the unique constraint on which the unique constraint is applied is allowed to contain only one NULL value.
    A clustered index is automatically created when a primary key is created, unless the current table already contains a clustered index or the NONCLUSTERED keyword is specified when the primary key is created.
    Non-clustered indexes are automatically created when a unique constraint is created, unless you specify the CLUSTERED keyword and there is no clustered index in the current table.
    There can only be one primary key in each table, but it can be constrained by multiple uniques.




Previous:Release the HTTP error encountered in mvc 403.14 - Forbidden workaround
Next:Friends who have opened an online store basically know that Mr. Ma Yun has two cars that are particularly awesome
 Landlord| Posted on 6/29/2016 2:47:54 PM |
The above two sentences can realize the uniqueness of email and mobile phone numbers   

Posted on 7/8/2016 2:30:32 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com