Course Content
Detailed Content of Database Management System
0/1
About Lesson

Components Of E-R Model:

1. Entity: 

An Entity can be a person, place, event, or object that is relevant to a given system. For example, a school system may include students, teachers, major courses, subjects, fees, and other items. Entities are represented in E-R diagrams by a Rectangle and Named using singular Nouns.

Two Types of Entity:

  • Weak Entity: An Entity type that has no key attribute is called Weak Entity Type. It is also called Child or Subordinate Entity Type represented by .
  • Strong Entity: An Entity Type that have key attribute is called Strong Entity Type. e.g. in below example Employee is Strong Entity Type.

Some Entity Types have more than one key attribute. They are called Composite Key Attributes.

2. Attribute: 

Entities are represented by means of their properties, called Attributes. All Attributes have values. For Example, a ‘Student’ Entity may have name, class, and age as Attributes.

There exists a domain or range of values that can be assigned to Attributes. For Example, a ‘student’s name’ cannot be a numeric value. It has to be alphabetic. A ‘Student’s age’ cannot be Negative, etc.

Types of Attributes:

  • Key Attribute: The Attribute which uniquely identifies each Entity in the Entity Set is called Key Attribute. For Example, ‘Roll No.’ will be unique for each Student. In E-R Diagram, Key Attribute is represented by an Oval with Underlying Lines. 

  • Composite Attribute: Composite Attributes are made of more than one Simple Attributes. For Example, a student’s complete name may have ‘First_Name’ and ‘Last_Name’.
  • Multivalued Attribute: It is defined as an Attribute that holds Multiple Values for a Single Entity. For Example, for a ‘Student’ Entity, if one of the Attributes is ‘Hobby’ then ‘Hobby’ can have multiple values like Reading, Dancing, Singing, and so on.
  • Derived Attribute: Derived Attributes are the Attributes that do not exist in the Physical Database, but their values are Derived from other Attributes present in the Database. For Example, ‘average_salary’ in a department should not be saved directly in the Database, instead it can be Derived. For another Example, age can be Derived from Date of Birth.

3. Relationship: 

A Relationship is association among several Entities. For Example, there is a relationship between Students and Teachers. The Relationship represents the fact that a Teacher teaches several Students and a Student is taught by Several Teachers. The Relationship can be named as Teaching.

Types of Relationships:

  • One-to-One (1:1): In One-to-One Relationship, If an Entity in Entity Set X is associated with at most one Entity in Set Y, and an Entity in Y is assosiated with at most one Entity in X then then the Relationship is known as One-To-One Relationship.

         

For example, in a university, if we consider two entity sets as ‘Teachers’ and ‘Departments,’ and they are related by the ‘Head of the Department’ relationship, then there is a one-to-one mapping. This is because one department can be headed by only one teacher, and conversely, one teacher can be the head of only one department.

 

  • Many-to-One (n:1):  If an entity in the set X is associated with at most one entity in set Y and an entity in set Y is however associated with any number of entities in set X then such a relationship is known as many to one Relationship.

In this example, Diagram below, two entity sets teacher and department associated by a relation member is in a many to one relationship. As there can be many teachers belonging to one Department.

 

But one teacher cannot be associated with more than one department. Thus, it is a many-to-one Relationship.

  • One-to-Many (1:n):  If an entity set X is associated with any number of entities in set Y and an entity in set Y is however associated with at most one entity in set X. Then we say that there is one-to-many Relationship between X and Y. It shows the logic of one-to-many Relationship.

The E-R diagram represents a one-to-many relationship, where there are two entity sets: one for teachers and the other for subjects. In this scenario, a teacher can teach many subjects, but it is assumed that each subject will be taught by only one teacher, establishing a one-to-many relationship.

 

  • Many-to-Many (n:n):  If an entity in set X associated with any number of entities in set ‘Y and an entity in set Y is associated with any number of entities set X then it makes a many to many relationships.

In a college, there are multiple teachers, each capable of teaching multiple subjects, and conversely, one subject can be taught by multiple teachers. This establishes a many-to-many relationship between the two entity sets: teachers and subjects.