Integrity Constraint, Entity Integrity, Referential Integrity, Keys Constraint, Domain Constraint
Integrity constraints are rules that ensure the accuracy and consistency of data in a database. The following are some of the commonly used integrity constraints in a relational database:
Entity integrity constraint: This constraint ensures that each row in a table has a unique identifier or primary key. It ensures that no two rows in a table are identical.
Referential integrity constraint: This constraint ensures that the relationship between two tables is maintained by enforcing the rules for foreign key relationships. It ensures that a value in one table’s foreign key column matches a value in another table’s primary key column.
Key constraint: This constraint ensures that each table has at least one primary key, which is a unique identifier for each row in the table.
Domain constraint: This constraint ensures that the data entered in a column is of the correct data type and format.
Entity integrity and referential integrity are two of the most important types of constraints in a relational database. Entity integrity ensures that each row in a table has a unique identifier, while referential integrity ensures that the relationship between tables is maintained.
Keys constraints are also important in a relational database, as they ensure that each table has at least one primary key. Primary keys are used to uniquely identify each row in a table, and they are often used as foreign keys in other tables to establish relationships between tables.
Domain constraints ensure that the data entered in a column is of the correct data type and format. This helps to ensure the accuracy and consistency of data in the database.