Integrity Constraints
Integrity Constraints
2. Unique Constraint
Ensures that all values in a column are distinct.
Example: Email addresses in a student database must be unique.
2. Default Constraint
Automatically assigns a default value to a column if no value is specified.
Example: A Status column defaults to “Pending” in an Orders table.
3. Triggers
Execute specific actions when certain database events occur (e.g., updates or
deletions).
Used for enforcing business rules dynamically.
Example:
Automatically log the time of a record update.
Homework
1. Design a database for a student grading system.
o Include static and dynamic constraints (e.g., grades between 0 and 100).
2. Write SQL scripts to enforce the constraints.
This lesson ensures students understand both theoretical and practical aspects of integrity
constraints, aligning with the Cameroon HND program.