Study smarter with Fiveable
Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.
Data integrity rules are the backbone of every reliable database system—and they're exactly the kind of foundational concept that shows up repeatedly on exams. You're being tested on your understanding of how databases prevent bad data from corrupting entire systems, from duplicate records to orphaned rows to values that violate business logic. These rules work together to ensure that your data remains accurate, consistent, and meaningful across tables and relationships.
Don't just memorize a list of rule names. Know what problem each rule solves, how it's enforced (constraints, keys, triggers), and when you'd apply one rule versus another. Exam questions love to present scenarios where data integrity has been violated—your job is to identify which rule was broken and how to fix it. Master the underlying mechanisms, and you'll handle any FRQ or multiple-choice question thrown your way.
These rules ensure every record can be uniquely identified and retrieved. Without unique identification, databases become unsearchable chaos—imagine a library where every book has the same call number.
Compare: Entity Integrity vs. Unique Constraint—both prevent duplicates, but entity integrity applies only to primary keys and forbids nulls, while unique constraints apply to any column and permit nulls. If an FRQ asks about enforcing uniqueness on a non-key field, unique constraint is your answer.
These rules maintain consistency between tables. When tables reference each other through keys, these rules prevent "dangling pointers" that reference data that doesn't exist.
Compare: Referential Integrity vs. Cardinality Integrity—referential integrity ensures foreign keys point to valid records, while cardinality integrity ensures the number of related records matches the real-world relationship model. Both govern relationships, but one is about validity, the other about structure.
These rules control what values can be stored in specific columns. Think of them as gatekeepers that reject invalid data before it enters the database.
Compare: Domain Integrity vs. Check Constraint—domain integrity uses built-in data types to restrict values, while check constraints allow custom logical conditions. Use domain integrity for type-based restrictions, check constraints for business logic like "salary must be positive."
These rules ensure data accurately represents real-world meaning and organizational requirements. They bridge the gap between raw storage and meaningful information.
Compare: Semantic Integrity vs. Business Rule Integrity—semantic integrity ensures data makes logical sense (dates in order, quantities positive), while business rule integrity enforces organizational policies (managers approve orders over $10,000). Both add meaning, but one is about logic, the other about policy.
| Concept | Best Examples |
|---|---|
| Unique Identification | Entity Integrity, Key Integrity, Unique Constraint |
| Relationship Consistency | Referential Integrity, Cardinality Integrity |
| Data Type Restrictions | Domain Integrity |
| Custom Value Conditions | Check Constraint, Null Integrity |
| Real-World Accuracy | Semantic Integrity |
| Organizational Policy | Business Rule Integrity |
| Prevents Orphaned Records | Referential Integrity |
| Non-Key Uniqueness | Unique Constraint |
Which two integrity rules both enforce uniqueness, and what distinguishes how they handle null values?
A database allows a foreign key to reference a primary key that was just deleted, creating an orphaned record. Which integrity rule has been violated, and what action would prevent this?
Compare and contrast domain integrity and check constraints—when would you use each, and can they work together on the same column?
An FRQ presents a scenario where a "quantity" field contains negative values and a "ship date" occurs before the "order date." Which integrity rules address each problem?
Explain how entity integrity, referential integrity, and cardinality integrity work together to maintain a properly structured one-to-many relationship between and tables.