Which command should you run to add a primary key on CustomerKey in dimCustomer, including NOT ENFORCED?

Prepare for the DP-600 Fabric Analytics Engineer Exam. Study with flashcards and multiple choice questions, each offering hints and detailed explanations. Enhance your chances of success on the exam!

Multiple Choice

Which command should you run to add a primary key on CustomerKey in dimCustomer, including NOT ENFORCED?

Explanation:
The idea is to create a primary key constraint with NOT ENFORCED, and the syntax requires explicitly adding a named constraint, choosing the index type, listing the column, and then attaching NOT ENFORCED. The best choice uses ALTER TABLE to add a named constraint, specifies PRIMARY KEY with NONCLUSTERED, includes the CustomerKey column, and ends with NOT ENFORCED. This matches the proper syntax for creating a not-enforced primary key constraint backed by a nonclustered index. Why the others aren’t correct: one option omits the NONCLUSTERED specification, which leaves the index type unspecified (and defaults may not align with the intent). Another option uses ADD PRIMARY KEY without the constraint name and without NOT ENFORCED. A choice creates a unique index rather than a primary key constraint, which changes the semantics from a constrained key to just an index. The chosen statement combines a named constraint, the PRIMARY KEY clause, the desired NONCLUSTERED index, the column, and the NOT ENFORCED option, making it valid for creating a not-enforced primary key constraint.

The idea is to create a primary key constraint with NOT ENFORCED, and the syntax requires explicitly adding a named constraint, choosing the index type, listing the column, and then attaching NOT ENFORCED.

The best choice uses ALTER TABLE to add a named constraint, specifies PRIMARY KEY with NONCLUSTERED, includes the CustomerKey column, and ends with NOT ENFORCED. This matches the proper syntax for creating a not-enforced primary key constraint backed by a nonclustered index.

Why the others aren’t correct: one option omits the NONCLUSTERED specification, which leaves the index type unspecified (and defaults may not align with the intent). Another option uses ADD PRIMARY KEY without the constraint name and without NOT ENFORCED. A choice creates a unique index rather than a primary key constraint, which changes the semantics from a constrained key to just an index. The chosen statement combines a named constraint, the PRIMARY KEY clause, the desired NONCLUSTERED index, the column, and the NOT ENFORCED option, making it valid for creating a not-enforced primary key constraint.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy