Recall & Review
beginner
What are integrity constraints in a database?
Integrity constraints are rules that ensure the accuracy and consistency of data in a database. They prevent invalid data from being entered.
Click to reveal answer
beginner
Name the four main types of integrity constraints.
The four main types are: 1) Entity Integrity, 2) Referential Integrity, 3) Domain Integrity, and 4) User-Defined Integrity.
Click to reveal answer
beginner
What is Entity Integrity?
Entity Integrity ensures that each row in a table has a unique and non-null primary key, so every record can be uniquely identified.
Click to reveal answer
intermediate
Explain Referential Integrity with a real-life example.
Referential Integrity means that a foreign key in one table must match a primary key in another table or be null. For example, a student's course enrollment must refer to an existing course.
Click to reveal answer
beginner
What is Domain Integrity?
Domain Integrity restricts the type, format, or range of values that can be stored in a column, like allowing only dates or positive numbers.
Click to reveal answer
Which constraint ensures that a primary key cannot be null?
✗ Incorrect
Entity Integrity requires that primary keys are unique and not null.
What does Referential Integrity enforce?
✗ Incorrect
Referential Integrity ensures foreign keys refer to existing primary keys or are null.
Which constraint restricts the allowed values in a column?
✗ Incorrect
Domain Integrity controls the type and range of data allowed in a column.
User-Defined Integrity constraints are:
✗ Incorrect
User-Defined Integrity allows custom rules based on business logic.
What happens if an integrity constraint is violated?
✗ Incorrect
Violating an integrity constraint causes the database to reject the operation to keep data consistent.
Describe the four main types of integrity constraints and their purpose.
Think about how each rule helps keep data accurate and consistent.
You got /4 concepts.
Explain with an example how Referential Integrity works in a database.
Consider how tables relate to each other in real life.
You got /3 concepts.