Database Constraints, Transactions, and Procedural Extensions
1. Database Constraints
1.1 Importance of Constraints
Constraints are crucial for maintaining data consistency in a database. They ensure that identifiers are unique and that column values belong to an acceptable range or set of values. Constraints are defined in the database and are active for any data - changing operation. If a change violates a constraint, it fails, and in a transaction, a rollback statement can be issued.
1.2 Referential Constraints
Referential constraints have a dual purpose:
- Prevent inserting a value into a table if it is absent from the referenced table. Error messages often mention “no parent row”.
- Prevent deleting rows from a re