
Answer-first summary for fast verification
Answer: Modify `ADD CHECK` to `ADD CONSTRAINT constraint_name CHECK`.
To successfully add a `CHECK` constraint on a Delta table, it's necessary to specify a constraint name. Therefore, the command should be adjusted from `ADD CHECK` to `ADD CONSTRAINT constraint_name CHECK`. For example, the corrected command would look like: `ALTER TABLE routes ADD CONSTRAINT negative_distance CHECK (distance > 0);`. This ensures the constraint is properly named and the command executes without errors.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
To ensure the successful execution of the command intended to add a check constraint on the routes table, which of the following modifications would you recommend? The original command is: ALTER TABLE routes ADD CHECK (distance > 0).
A
Replace the CHECK keyword with CONSTRAINT.
B
Remove the TABLE keyword from the command.
C
Change ADD CHECK to ADD CONSTRAINT CHECK.
D
Eliminate the brackets around the condition, changing (distance > 0) to distance > 0.
E
Modify ADD CHECK to ADD CONSTRAINT constraint_name CHECK.
No comments yet.