E-R Model |What is an Entity-Relationship Model
3 min readE-R Model: E-R model stands for Entity-Relationship Data Model. An E-R Model is a detailed, logical representation of the entities, associations & data elements for an organization or business area.
The basis entity-relationship modeling notation uses three main constructs: data entities, relationships & their associated attributes.
An E-R Model is normally expressed as an Entity-Relationship diagram, which is a graphical representation of an E-R model.
Entity;
An entity is a person, place, object, event or concept about which the organization wishes to maintain data.
Eg.
Person; FACULTY, DOCTOR, EMPLOYEE
Place; COLLEGE, SHOP, ROOM
Event; PHONE, BOOK, BLACK-BOARD
Event; MARRIAGE, SALE, REGISTRATION
Concept; DISCOUNT, QUANTITY, BANK ACCOUNT
Entity Type;
A collection of entities that share common properties or characteristics. We use capital letters in naming an entity type& is placed inside a rectangle.
Eg.
EMPLOYEE PHONE HOSTEL
Entity Instance;
Entity Instance is a single occurrence of an entity type. An entity type is described just once in a data model, where as many instances of that entity type may be represented by data stored in the database.
Attributes Of E-R Model
Each entity type has a set of attributes associated with it. An attribute is a property or characteristics of an entity that is of interest to the organization.
Eg. Entity type Attributes
Book; ISBN, Title, Author, Price, Edition, Publication_Year, Pages.
Marriage; Person_ Name, Spouse_ Name, Marriage_ Place.
Attributes are enclosed in ovals & are attaché to their entity type by straight lines.
Types of Attributes of E-R Model
-
Single-Valued Attributes
Attributes which have a single value for a particular entity is known as single-valued attributes.
Eg.
Age of an employee entity.
-
Multivalued Attributes
Attributes which have a set of values for the same entity is known as multivalued attributes.
Eg.
Colour for a motorbike.
-
Simple/ Atomic Attributes
The attributes, which cannot be divided into smaller subparts are known as simple or atomic attributes.
Eg.
Soc_Sec_No. in employee entity.
-
Null Value Attribute
An attribute has null value if either the value of that attribute is not known or not applicable to that entity.
Eg.
If a person does not have any degree then collage degree attribute value will be null or even if it is not known it is again null.
-
Complex Attributes
It is a combination of composite & multi-valued attributes.
Data Value;
A data value is an actual data or information contained in each attribute.
Eg.
Entity Attributes Values(Data)
Customer Customer Id No. 123456
Customer Name Sumit
Customer Address 2444/6 Karnal.
Relationships in E-R Model
A relationship is a mapping or linkage between two sets of data. It can be;
- One-to-One
- One-to-Many
- Many-to-One
- Many-to-Many
-
One-to-One(1:1)
The relationship between a Department & a Manager is usually one-to-one.
-
One-to-Many(1:N)
The relationship between manager & employees id (1:N) because there are several employees reporting to the manager.
-
Many to One(N:1)
The relationship between Dependent & Employee is N:1.
-
Many-to-Many(M:N)
The relationship between Employee &Project is M:N because each employee could be involved in a number of different projects & a number of employee could be working on a given project.
E-R Diagram in E-R Model
The E-R diagram are useful in representing the relationship among entities.
In this diagram, objects of similar structures are collected into an entity set. An entity set is shown as a rectangle.
A diamond represents the relationship among a number of entities, which are connected to the diamond by lines.
The attributes shown as ovals area connected to the entities of relationships by lines.
Diamond, ovals & rectangles are labeled.
The type of relationship existing between the entities is represented by giving the cardinality of the relationship on the line joining the relationship to the entity.
The following E-R diagram shows the relationship between the entity sets EMPLOYEE and POSITION. The relationship set is called DUTY_ALLOCATION & its attributes are Date & Shift.
Data for an E-R relationship could be represented by a number of tables. The relationship Duty_Allocation between the entities EMPLOYEE and POSITION its represented by three tables.
Hope you liked this Article. Keep visiting Mentor Way for more articles like this.