Components of an ER Diagram

Facebooktwitterredditpinterestlinkedinmailby feather

An ER Diagram consists of the following components:

  1. Entity
  2. Attributes
  3. Relationships
Components of an ER Diagram

1. Entity

An entity may be an object, place, person, or an event which stores data in the database.In an entity-relationship diagram, an entity is represented by a rectangle. Student, course, manager, employee, patient, etc. are examples of an entity.

Components of an ER Diagram

Entity type: An entity type is a collection or a set of entities having some common attributes. In a database, each entity type is described by a name and list of attributes.

Components of an ER Diagram

Entity set: It is a set (or collection) of entities of the same type which share the similar properties, or attributes.

For example,the group of people who are lecturers in a university can be defined as an entity set lecturer. Similarly, the entity set of students might represent the group of all students in the university.

Components of an ER Diagram

An entity can be characterized into two types:

  1. Strong entity: This type of entity has a primary key attribute which uniquely identifies each record in a table. In the ER diagram, a strong entity is usually represented by a single rectangle.
  2. Weak entity:An entity does not have a primary key attribute and depends on another strong entity via foreign key attribute. In the ER diagram, a weak entity is usually represented by a double rectangle.

2. Attributes: An attribute in an Entity-Relationship Model describes the properties or characteristics of an entity. It is represented by an oval or ellipse shape in the ER diagram. Every oval shape represents one attribute and is directly connected to its entity which is in the rectangle in shape.

For example, employee_id, employe_name, Gender, employee_age, Salary, and Mobile no. are the attributes which define entity type Employee.

Components of an ER Diagram

In the ER model, an attribute can be characterized into the following types:

  1. Simple attribute: An attribute which contains an atomic value and cannot be divided further is called a simple attribute.For example, Gender and Salary of a person. It is also represented by an oval.
Components of an ER Diagram
  • Key attribute: An attribute which can uniquely identify an entity in an entity set is called a key attribute. It represents a primary key in the ER diagram. In an Entity-Relationship diagram, the key attribute is denoted by an oval with an underlying line. For example, employee_id will be unique for each employee.
Components of an ER Diagram
  • Composite attribute:An attribute which is a combination of two or more simple attributes is called a composite attribute. In an Entity-Relationship diagram, it is represented by an ellipse, and that ellipse comprises of other ellipses.For example, the Name attribute of an employee entity type consists of First name, Second name, and Last name.
Components of an ER Diagram
  • Derived attribute: An attribute which can be derived from other attributes is called a derived attribute. In an entity-relationship diagram, these attributes are represented by a dashed oval shape. For example, employee_age is a derived attribute as it changes over time and can be derived from another attribute DOB (Date of birth).
Components of an ER Diagram
  • Multi-valued attribute: An attribute which contains more than one value for a given entity. For example, an employee can have more than one mobile number and email address.
Components of an ER Diagram

3. Relationship

A relationship in Entity-Relationship Model is used to describe the relation between two or more entities. It is represented by a diamond shape in the ER diagram. For example, student study in college, employee works ina department. Here, ‘study in’ and ‘works in’ are the relationships.

Degree of Relationship

A relationship where a number of different entity set participate is called as degree of a relationship.

Degree of relationship can be categorized into the following types:

  1. Unary Relationship
  2. Binary Relationship
  3. Ternary Relationship
  4. n-ary Relationship
  1. Unary Relationship: A relationship where a single entity set participates is called as a unary relationship. For example, In a company, an employee manages or supervises another employee.
Components of an ER Diagram
  • Binary Relationship: When two entity set participates in a relationship is called a binary relationship.

It is further categorized into four types:

  1. One-to-One Relationship: When one entity from an entity set A is associated with another entity of entity set B and vice versa. Such type of relationship is called one to one relationship.
Components of an ER Diagram
Components of an ER Diagram
  1. One-to-Many Relationship:When one entity from an entity set A is associated or linked with multiple entities of entity set B, then it is called a one-to-many relationship.
Components of an ER Diagram
  1. Many-to-One Relationship: When more than one entities from an entity set A is associated with one entity of entity set B, then it is called a many-to-one relationship.
Components of an ER Diagram
  1. Many-to-Many Relationship: When more than one entity from an entity set A is associated with many entity of an entity set B. Such types of relationship are called a many-to-many relationship.
Components of an ER Diagram

c) Ternary Relationship: When three entity set participates in a relationship, is called a ternary relationship.

Components of an ER Diagram

d) n-ary Relationship: When more than three entity set involves in a relationship is called an n-ary relationship.

Facebooktwitterredditpinterestlinkedinmailby feather