Entity-Relationship Diagram


Entity-Relationship Diagram views real world as entities. It was introduced in 1976 by P.P.Chen and is known as ER Diagram, E R Model, etc. ER Diagram displays the relationships of entity sets.

Let us first see what it consists of −

Entity

Entity in DBMS can be a real-world object with an existence, For example, in a School database, the entities can be Teachers, Students, Courses, etc.

Attributes

Entities has attributes, which can be considered as properties describing it, for example, for Teachers entity, the attributes are  Teacher_Name, Teacher_Address, Teacher_Subject, etc. The attribute value gets stored in the database.

Weak Entity

The weak entity in DBMS does not have a primary key and are dependent on the parent entity. It mainly depends on other entities, for example, dependents of a professor.

Strong Entity

The strong entity has a primary key. It has weak entities that are dependent on strong entity. Its existence is not dependent on any other entity.

For example, Professor is a strong entity −

Primary Key

Every table has one Primary key and cannot have null values. A primary key can be StudentID, SSN, AccountNumber, etc.

Multivalued Attribute

An attribute that has multiple values for a single entity at a time is called a Multivalued Attribute.

For example, technical skills of a student that can be programming, web development, etc.

Composite Attribute

If an attribute has two or more other attributes, then it is called a Composite Attribute.

For example, Student Name can be divided as Student First Name, Student Middle Name, and Student Last Name.

Derived Attribute

As the name suggests, the derived attribute is an attribute whose value can be calculated from another attribute.

For example, Student Age can be derived from Date-of-birth of a student.

ER Diagram Example

Here’s an ER Diagram for Hospital:

  • It has three entities: Patient, Doctor and Tests.
  • Age is a derived attribute for Patient Entity
  • Name in the Tests entity is a Primary Key
  • ID in the Doctor entity is a Primary Key
  • ID in the Patient entity is a Primary Key

Updated on: 15-Jun-2020

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements