Difficulty: Medium
Correct Answer: An intrarelation constraint
Explanation:
Introduction / Context:
Business rules often compare two columns in the same row, such as start_date before end_date or minimum_value less than maximum_value. Enforcing this rule in the database ensures integrity regardless of application code and prevents bad data from being stored.
Given Data / Assumptions:
Concept / Approach:
An intrarelation constraint (often implemented as a CHECK constraint) enforces relationships among columns within the same table row. For example: CHECK (start_amount < end_amount). In contrast, interrelation constraints involve two tables (such as foreign keys). Domain or range constraints restrict individual columns independently without referencing other columns.
Step-by-Step Solution:
Verification / Alternative check:
Attempt to insert a row with ColumnA >= ColumnB. The DBMS should raise an error, demonstrating that the intrarelation constraint works as intended.
Why Other Options Are Wrong:
Common Pitfalls:
For nullable columns, specify the intended behavior (for example, require NOT NULL or include logic such as CHECK (ColumnA IS NULL OR ColumnB IS NULL OR ColumnA < ColumnB)).
Final Answer:
An intrarelation constraint
Discussion & Comments