Entity-Relationship (ER) Data Model

  1. describes the structure of a database with the help of a diagram, which is known as Entity Relationship Diagram (ER Diagram).
  2. An ER model is a design or blueprint of a database that can later be implemented as a database.
  3. The main components:
    1. entity set
    2. relationship set.
  4. An ER diagram shows the relationship among entity sets.
  5. model for identifying entities to be represented in the database and representation of how those entities are related.
  6. ER models are used to model real-world objects like a person, a car, or a company
  7. relation between these real-world objects.
  8. In short, the ER Diagram is the structural format of the database. 

Symbols Used in ER Model

  1. Rectangles: Rectangles represent Entities in the ER Model.
  2. Ellipses: Ellipses represent Attributes in the ER Model.
  3. Diamond: Diamonds represent Relationships among Entities.
  4. Lines: Lines represent attributes to entities and entity sets with other relationship types.
  5. Double Ellipse: Double Ellipses represent Multi-Valued Attributes .
  6. Double Rectangle: Double Rectangle represents a Weak Entity.

]

Components of a ER Diagram

1. Entity

  1. An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptual existence – a company, a job, or a university course. 
  2. An entity is represented as rectangle in an ER diagram.
  3. Consider an organization as an example- manager, prodct, employee, department etc. can be taken as an entity.
  4. For example: In the following ER diagram we have two entities Student and College and these two entities have many to one relationship as many students study in a single college.

2. Weak Entity:

  1. An entity that depends on another entity called a weak entity.
  2. The weak entity doesn’t contain any key attribute of its own.
  3. The weak entity is represented by a double rectangle.
  4. For Example, A company may store the information of dependents (Parents, Children, Spouse) of an Employee. But the dependents don’t have existed without the employee. So Dependent will be a Weak Entity Type and Employee will be Identifying Entity type for Dependent, which means it is Strong Entity Type.

3. Attribute and types

  1. An attribute describes the property of an entity.
  2. For example, Roll No, Name, DOB, Age, Address, and Mobile No are the attributes that define entity type Student.
  3. In ER diagram, the attribute is represented by an oval. 
There are four types of attributes:
  1. Key attribute:
    1. The attribute which uniquely identifies each entity in the entity set is called the key attribute.
    2. For example, Roll no. will be unique for each student
    3. In ER diagram, the key attribute is represented by an oval with underlying lines.
  2. Composite Attribute
    1. An attribute composed of many other attributes is called a composite attribute.
    2. An attribute that is a combination of other attributes is known as composite attribute.
    3. For example, In student entity, the student address is a composite attribute as an address is composed of other attributes such as pin code, state, country.
  3. Multivalued Attribute
    1. An attribute consisting of more than one value for a given entity.
    2. An attribute that can hold multiple values is known as multivalued attribute.
    3. It is represented with double ovals in an ER Diagram.
    4. For example – A person can have more than one phone numbers so the phone number attribute is multivalued.
  4. derived attribute
    1. its an attribute that can be derive from an existing attribute
    2. for example, we can derive the age attribute from the Date of birth of the entity.

4. Relationships

  1. one to one e.g a person can have only one passport
  2. one to many e.g each customer can place multiple orders, but each order is associated with only one customer.
  3. many to many e.g a customer can buy many products and a product can have multiple customers
  4. many to one e.g