Bird
0
0

Why might a CHECK constraint not prevent invalid data if added after data already exists in the table?

hard📝 Conceptual Q10 of 15
SQL - Table Constraints
Why 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.
Step-by-Step Solution
Solution:
  1. Step 1: Understand behavior of adding CHECK constraints to existing tables

    When adding a CHECK constraint, some databases do not validate existing data by default.
  2. Step 2: Consequence of no validation on existing data

    Invalid data already in the table remains unless explicitly checked or cleaned.
  3. Final Answer:

    Because CHECK constraints do not validate existing rows when added. -> Option B
  4. Quick Check:

    CHECK added later may skip existing data [OK]
Quick Trick: CHECK constraints may skip existing data when added [OK]
Common Mistakes:
MISTAKES
  • Thinking CHECK always validates all data immediately
  • Believing CHECK only works on new tables
  • Assuming triggers are needed for CHECK

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes