Querying Microsoft SQL Server 2012/2014 — Question 4

You develop a database application. You create four tables. Each table stores different categories of products.
You create a Primary Key field on each table.
You need to ensure that the following requirements are met:
✑ The fields must use the minimum amount of space.
✑ The fields must be an incrementing series of values.
✑ The values must be unique among the four tables.
What should you do?

Answer options

Correct answer: D

Explanation

The correct answer is D because using a UNIQUEIDENTIFIER data type with NEWSEQUENTIALID() ensures that the values are unique across all tables and are generated in a sequential manner, which also helps minimize fragmentation. Options A, B, and C do not guarantee uniqueness across multiple tables, while option E does not provide an appropriate solution for primary keys.