
Answer-first summary for fast verification
Answer: The ALTER TABLE command returns an error, allowing new NULL values to be added to the location column.
When attempting to add a NOT NULL constraint to a column that already contains NULL values, the ALTER TABLE command will fail, resulting in an error. This means the NOT NULL constraint is not applied to the column, and NULL values can still be inserted. It's important to note that constraints can only be added to existing tables if the current data complies with the constraint. If the existing data violates the constraint, the constraint cannot be added. For more details, refer to the documentation on adding a NOT NULL constraint.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
What happens when a data engineer attempts to add a NOT NULL constraint to a Delta table's column that already contains null values, and then tries to insert another null value into that column?
A
The ALTER TABLE command fails, but new NULL values cannot be added to the location column.
B
The ALTER TABLE command returns an error, allowing new NULL values to be added to the location column.
C
The ALTER TABLE command executes successfully, yet new NULL values can still be added to the location column.
D
The ALTER TABLE command is successful, and no new NULL values will be accepted in the location column.
E
The ALTER TABLE command succeeds, and all previous and new NULL values are dropped.