DatabasesBeginner
Constraint
قيد
Pronunciationkuhn-STRAYNT
Definition
A rule applied to database columns or tables that restricts the type of data that can be inserted or updated.
Where you hear it
In database design discussions, when defining table schemas, or when an insert fails due to invalid data.
Examples
The email column has a
UNIQUEconstraint to prevent duplicate accounts.The age column includes a
CHECKconstraint to ensure values are greater than zero.
Common mistake
Thinking constraints only slow down performance, ignoring how they protect data integrity and prevent invalid states.