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 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.
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.
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.
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 −
Every table has one Primary key and cannot have null values. A primary key can be StudentID, SSN, AccountNumber, etc.
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.
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.
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.
Here’s an ER Diagram for Hospital: