What are integrity constraints?
Rules and conditions derived from real-world requirements and specified when defining or creating database schema
Why are integrity constraints necessary?
They help to ensure accuracy, consistency and validity of data in the DB.
They ensure that the stored data is faithful to the real-world meaning it represents
When are integrity constraints checked?
They are checked when modifications (insert, update, delete) are made to the relations in the DB.
This checking ensures that data modifications adhere to the specified constraints.
What happens when DBMS checks the database and sees that integrity constraints are violated?
DBMS may prevent modification or indicate an error
When do we consider a database legal?
When integrity constraints hold true for all data.
What are the 3 types of integrity constraints?
Domain constraints,
Key constraints,
Referential constraints
What are domain constraints? How is this done?
Domain constraints restrict the kind of attributes or values a column can hold in the DB table.
This is done by
1. Specifying data types
2. Specifying range of values: eg. age cannot be less than zero, telephone no cannot contain digit outside 0-9.
What are key constraints?
What are relational integrity constraints? (REFERENTIAL CONSTRAINTS)
We must ensure that the reference from one table to another table must be valid.
How do we preserve Integrity Constraints (ICs) in a relational database and how to ensure that these constraints are maintained.
Can we infer that an IC is true by looking at an instace?
NO. ICs are statements about all possible instances of a database, not just a single instance.
While you can use SQL constraints to enforce ICs, you cannot infer the truth of an IC solely by looking at a single instance of the DB. ICs are constraints that apply to the ENTIRE DATASET.
What do we communicate to DBMS?
How do we communicate with DBMS?