🗄️ Database Design / Normalization
Beginner
What is data integrity?
Answer
Data integrity ensures the accuracy, consistency, and reliability of data throughout its lifecycle. Types: Entity integrity — every table row is uniquely identified (primary key constraint). Referential integrity — foreign key values must match existing primary keys. Domain integrity — column values must be within valid ranges/types (data type, NOT NULL, CHECK constraints). User-defined integrity — business rules enforced via triggers, stored procedures, or application logic. Maintaining data integrity prevents corrupted or inconsistent data from entering the database, which can cause incorrect results and hard-to-debug bugs.
Previous
What is a surrogate key vs natural key?
Next
What is the difference between a table and a view?