Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context: CHECK constraints are declarative integrity rules enforced by the DBMS to restrict allowed values in a column or tuple. They are a key tool for maintaining data quality at the database level rather than relying solely on application code.
Given Data / Assumptions:
Concept / Approach: A CHECK constraint evaluates a Boolean expression per row. Typical constraints include ranges (e.g., salary between 0 and 1e7), set membership (e.g., status in ('NEW','SHIPPED','CLOSED')), simple relational expressions (start_date <= end_date), and pattern checks (LIKE, basic functions). These are classic, widely used patterns for enforcing domain integrity.
Step-by-Step Solution:
Range example: CHECK (age >= 0 AND age <= 130)Domain example: CHECK (state IN ('CA','NY','TX'))Relational example: CHECK (start_date <= end_date)DBMS ensures any INSERT/UPDATE violating the expression is rejected.Verification / Alternative check: Inspect system catalogs to confirm constraints are stored and enforced; test with sample inserts to see violations blocked.
Why Other Options Are Wrong:
Common Pitfalls: Overusing triggers for validations that belong in CHECK; writing constraints that rely on subqueries (often disallowed in some DBMSs) instead of simpler per-row expressions.
Final Answer: Correct
Discussion & Comments