What Are Constraints?

Constraints are rules applied to table columns to enforce data integrity. Types include:

  • PRIMARY KEY
  • UNIQUE
  • FOREIGN KEY
  • CHECK
  • DEFAULT
  • NOT NULL

You can define constraints inline or at the table level.