SQL Constraints & Data Integrity



Constraints

  • NOT NULL Constraint: Ensures that a column cannot have NULL value.
  • DEFAULT Constraint: Provides a default value for a column when none is specified.
  • UNIQUE Constraint: Ensures that all values in a column are different.
  • PRIMARY Key: Uniquely identified each rows/records in a database table.
  • FOREIGN Key: Uniquely identified a rows/records in any another database table.
  • CHECK Constraint: The CHECK constraint ensures that all values in a column satisfy certain conditions.
  • INDEX: Use to create and retrieve data from the database very quickly

Data Integrity

  • Entity Integrity: There are no duplicate rows in a table.
  • Domain Integrity: Enforces valid entries for a given column by restricting the type, the format, or the range of values.
  • Referential Integrity: Rows cannot be deleted which are used by other records.
  • User-Defined Integrity: Enforces some specific business rules that do not fall into entity, domain, or
    referential integrity.

Комментарии

Популярные сообщения из этого блога

Today's activity report #17