Which constraint allows enforcing rules such as minimum, maximum, or a specific value range?

Prepare for your Database Systems Test. Use flashcards and multiple-choice questions, each question with hints and explanations. Ace your exam!

Multiple Choice

Which constraint allows enforcing rules such as minimum, maximum, or a specific value range?

Explanation:
Enforcing domain rules for data values is done with a check constraint. A check constraint defines a boolean predicate that every row must satisfy, so you can require minimums, maximums, or any specific value range. For example, you can ensure an age column is between 0 and 120, or a salary is within a certain band, or a date range where start_date is not after end_date. The constraint is evaluated on insert and update, and if the condition evaluates to false, the operation is rejected. Other constraints serve different purposes: Not Null ensures a value is present, Unique prevents duplicates, and Primary Key combines uniqueness with not-null to identify rows.

Enforcing domain rules for data values is done with a check constraint. A check constraint defines a boolean predicate that every row must satisfy, so you can require minimums, maximums, or any specific value range. For example, you can ensure an age column is between 0 and 120, or a salary is within a certain band, or a date range where start_date is not after end_date. The constraint is evaluated on insert and update, and if the condition evaluates to false, the operation is rejected. Other constraints serve different purposes: Not Null ensures a value is present, Unique prevents duplicates, and Primary Key combines uniqueness with not-null to identify rows.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy