PrepAway - Latest Free Exam Questions & Answers

What should you do to ensure that combination of the DateShipped, ProductID and InvoiceID is unique for each r

You work as the database administrator for an IT training company named Domain.com. All servers on the Domain.com network run Windows Server 2003 and all database servers run SQL Server 2005. The Domain.com network contains a database server named Certkiller -DB01 B01. Certkiller -DB01 hosts a database named CK_Sales that stores sales data for the company. The tables in the CK_Sales database are shown in the following database diagram.

A PRIMARY KEY column has been declared on the ProductID column of the Products table and the InvoiceID column of the Invoices table. You are creating a table named Inventory to track stock levels. You need to ensure that combination of the DateShipped, ProductID and InvoiceID is unique for each row in the Inventory table.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Create a rule.

B.
Create a table-level constraint.

C.
Create a UNIQUE constraint for each of the three columns.

D.
Create a CHECK constraint for each of the three columns.

Explanation:
A table-level constraint allows you to ensure that a combination of columns is unique for each row in the table.
Incorrect Answers:
A, D: A rule and CHECK constraints are used to ensure FOREIGN KEY integrity. The yare not used to ensure that data in a column or combination of columns is unique.
C: UNIQUE constraints do not allow a value to be repeated in the column. This means that every value in the DateShipped column must be unique; each value in the ProductID column must be unique; and each value in the InvoiceID column must be unique.
Reference:
Microsoft SQL Server 2005 Books Online (2007), Index: constraints [SQL Server] Microsoft SQL Server 2005 Books Online (2007), Index: rules [SQL Server]


Leave a Reply