Developing Microsoft SQL Server Databases — Question 27
You plan to create a database that has multiple tables. The tables will contain product information. Each product has a stock-keeping unit (SKU).
You need to recommend a solution to ensure that each SKU starts with the letters "ADV" and is followed by 10 digits.
The solution must minimize the amount of development effort required.
What should you include in the recommendation?
Answer options
- A. A FOREIGN KEY constraint
- B. A trigger
- C. A user-defined data type
- D. A CHECK constraint
Correct answer: C
Explanation
The correct choice is C, a user-defined data type, as it allows you to encapsulate the SKU format requirement directly into the data type definition, ensuring that every SKU adheres to the specified pattern with minimal development effort. Options A and B do not address the format requirement, while D, a CHECK constraint, would require additional validation logic to enforce the SKU format, which may involve more development effort.