Entity Relationship Diagram in DBMS
Entity Relationship Diagram:
In DBMS, a group of information or data which is of interest to an organization is called an Entity. A model that represents system data by entity and relationship sets is called an Entity Relationship Diagram (E-R Diagram) or Entity-Relationship Model (E-R Model). The E-R model is based on a perception of the real world which consists of a set of basic objects. This E-R diagram was initially developed by P.P. Chen.
Components of ER Diagram:
E-R Diagram consist of the following major components:
- Key attributes
An entity is a class of persons, places, objects, events or concepts about which we need to collect and store data. Here showing different entities include:
- Persons: Employee, students, customer etc.
- Places: Office, Building, Room etc.
- Objects: Books, Vehicle, Machine etc.
- Events: Sale, Registration, Order etc.
- Concepts: Account, Qualification, Course etc.
An entity set is the collection of entities of the same type entities which share common properties or attributes.
Such as : The set of all employees of an organization can be called as the entity set Employee.
Each entity can have a number of characteristics. The characteristics of an entity are called Attributes. An attribute is a descriptive property or characteristic of an entity. Some attributes can be logically grouped into super attributes called Compound Attributes.
The Key attribute is an attribute that uniquely identifies an entity in the entity set.
An association of several entities in an Entity Relation model is called Relationship.
There are three types of relationships are exist :
(i) One to One Relationship (1:1)
(ii) One to Many Relationship (1:M)
(iii) Many to Many Relationship (M:M)
(i) One to One Relationship (1:1) : (i) One to One Relationship is an association only between two entities.
Such as: In a College, each department has only one head of the department.
(ii) One to Many Relationship (1:M) : One to Many Relationship exists when one entity is related to more than one entity.
Such as: A father may have many children but a child has one father.
(iii) Many to Many Relationship (M: M): A Many to Many Relationship (M: M) indicates that entities may have many relationships with each other.
Such as One customer may buy any item of goods and one item of goods may be bought by many customers.
ER Diagram Symbols:
E-R Diagram uses the following symbols:
ER Diagram Examples:
This E-R diagram as seen in the above figure consists of two entity sets. Customer and Account and relates through a binary relationship set Cust_Acct. The attributes associated with customers are Cust_Name, Cust_No, State and City. The attributes associated with Account are Acc_No and Balance.