Notes and Study Materials

Different Integrity Rules in Relational Model:

 

 

Relational database integrity rules are very important to good database design. Many (but by no means all) RDBMSs enforce integrity rules automatically. However, it is much safer to make sure that your application design conforms to the entity and referential integrity rules.

 

Those rules are summarized as follows

Entity Integrity:

Requirement: All primary key entries are unique, and no part of a primary key may be null.

Purpose: Each row will have a unique identity, and foreign key values can properly reference primary key values.

Example: No invoice can have a duplicate number, nor can it be null. In short, all invoices are uniquely identified by their invoice number.

Referential Integrity:
     
Requirement: A foreign key may have either a null entry, as long as it is not a part of its table’s primary key, or an entry that matches the primary key value in a table to which it is related. (Every non-null foreign key value must reference an existing primary key value.)

 


Purpose:  It is possible for an attribute NOT to have a corresponding value, but it will be impossible to have an invalid entry. The enforcement of the referential integrity rule makes it impossible to delete a row in one table whose primary key has mandatory matching foreign key values in another table.

Example: A customer might not yet have an assigned sales representative (number), but it will be impossible to have an invalid sales representative (number).

 

 

 

You May Also Like:

Basic notations of ER diagram

Characterstics of Table

Types of Keys in DBMS

Relational Set Operaotrs

Codd’s Relational Database Rules

Back to DBMS Questions