SQL - Table ConstraintsWhy might a CHECK constraint not prevent invalid data if added after data already exists in the table?ABecause CHECK constraints only work on new tables.BBecause CHECK constraints do not validate existing rows when added.CBecause CHECK constraints require triggers to enforce.DBecause CHECK constraints are ignored if data is NULL.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand behavior of adding CHECK constraints to existing tablesWhen adding a CHECK constraint, some databases do not validate existing data by default.Step 2: Consequence of no validation on existing dataInvalid data already in the table remains unless explicitly checked or cleaned.Final Answer:Because CHECK constraints do not validate existing rows when added. -> Option BQuick Check:CHECK added later may skip existing data [OK]Quick Trick: CHECK constraints may skip existing data when added [OK]Common Mistakes:MISTAKESThinking CHECK always validates all data immediatelyBelieving CHECK only works on new tablesAssuming triggers are needed for CHECK
Master "Table Constraints" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes GROUP BY and HAVING - GROUP BY single column - Quiz 9hard GROUP BY and HAVING - WHERE vs HAVING mental model - Quiz 12easy INNER JOIN - INNER JOIN with ON condition - Quiz 13medium LEFT and RIGHT JOIN - LEFT JOIN execution behavior - Quiz 1easy LEFT and RIGHT JOIN - RIGHT JOIN execution behavior - Quiz 6medium Set Operations - Set operations with ORDER BY - Quiz 8hard Table Constraints - Foreign key ON DELETE behavior - Quiz 6medium Table Constraints - Foreign key ON UPDATE behavior - Quiz 6medium Table Relationships - ER diagram to table mapping - Quiz 8hard Views - CREATE VIEW syntax - Quiz 2easy