Monday, 31 July 2017

entity integrity in database management system relational model

Entity integrity in DBMS, Define entity integrity, entity integrity examples

Entity Integrity
Entity integrity and referential integrity are the basic set of rules for the relational model. Entity integrity defines the properties that are to be satisfied by a primary key.
We all know that a primary key is UNIQUE + NOT NULL. That is, it cannot contain duplicate values and NULL values. This is what entity integrity is all about.

Entity integrity - No component of a primary key is allowed to have NULL values.

Example 1:
STUDENT (Register_Number, Name, Date_Of_Birth, Phone)
In this table STUDENT, the attribute Register_Number is the primary key. Hence, it cannot contain NULL value in it.

Example 2:
STUDENT_COURSE (Register_Number, Subject_Code, Registered_Date)
Assume that the table given above is to store the subjects that are registered by a student. A student may register one or more subjects. Hence, the key for this table is a composite key which consists of (Register_Number, Subject_Code).
In this case, neither Register_Number nor Subject_Code can contain NULL values.


No comments:

Post a Comment

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...