You are maintaining a Microsoft SQL Server database that stores order information for an online store website. The database contains a table that is defined by the following Transact-SQL statement:
You need to ensure that purchase order numbers are used only for a single order.
What should you do?
A. Create a new CLUSTERED constraint on thePurchaseOrderNumber column.
B. Create a new UNIQUE constraint on theĀ PurchaseOrderNumber column.
C. Create a new PRIMARY constraint on the PurchaseOrderNumber column.
D. Create a new FOREIGN KEY constraint on the PurchaseOrderNumber column.
Explanation:
You can use UNIQUE constraints to make sure that no duplicate values are entered in specific columns that do not participate in a primary key. Although both a UNIQUE constraint and a PRIMARY KEY constraint enforce uniqueness, use a UNIQUE constraint instead of a PRIMARY KEY constraint when you want to enforce the uniqueness of a column, or combination of columns, that is not the primary key.
Reference: UNIQUE Constraints
https://technet.microsoft.com/en-us/library/ms191166(v=sql.105).aspx