How ER Model works in DBMS. in this tutorial we will discuss how ER Model works in DBMS. An ER diagram shows the relationship amongst entity sets. An entity set is a group of alike entities and these entities can have attributes. An ER diagram shows the relationship among entity sets. This model shows Association among different entities as the shown figure below.
ER drawing shows the complete logical structure of a database.As shown above figure Student and College are both entities and Studyin is relationship diagram which shows association between student and college while with college entity Col_ID and Col_Name are attributes, while with Student entity Stu_Id,Stu_Name and Stu_Addr are attributes.
Components of a ER Diagram in DBMS
As shown in the above diagram, an ER diagram has three main components:
Entity. 2. Attribute. 3. Relationship
An entity is an object or component of data. An entity is represented as a rectangle in an ER diagram. In the following diagram Student and College are both entities.
What is Weak Entity in DBMS.
An entity that cannot be uniquely recognized by its individual attributes and relies on the relationship with another entity is called a weak entity. The weak entity is represented by a double rectangle. Bank Account is weak entity and Bank is a Strong Entity.
Bank_Account is exist without Bank, So therefore Bank Account is weak Entity.
Attribute in DBMS
An attribute labels the property of an entity. Attributes describe the characteristics or properties of an entity in a database table..An attribute is signified as Oval in an ER diagram. There are four types of attributes. Which are describe bellow.
- Key Attribute.
- Composite Attribute
- Multivalued Attribute.
- Derived Attribute.
- Key Attribute
A key attribute is the unique characteristic of the entity. For example. Name and hire date are attributes of the entity Employee. Rollo is Key Attribute because RollNo is Primary Key which is uniquely identified the whole record.
Composite Attribute in DBMS.
An attribute that is a combination of other attributes is recognized as composite attribute.First Name and Last Name both are Composite Attribute.
Multivalued attribute in DBMS
An attribute that can hold multiple values is identified as multivalued attribute. Generes is Multivalued Attribute
Derived attribute in DBMS:
A derived attribute is one whose value is dynamic and resulting from additional attribute.Age is Derived Attribute because age is derived from Date of Birth Attribute.
Relationship in DBMS
A relationship is signified by diamond shape in ER diagram, As Shown following figure Creates and Buys are two relationship diagram which diamond in shap.
In ER Model diamond shap displays the relationship among entities. Writer creates a Novel , While Consumer Buys a Novel.
There are four types of relationships:
One to One Relationship
When a single instance of an entity is associated with a single instance of an additional entity then it is called one to one relationship.Person has only one Passport which creates 1:1 Relationship
1. One to Many Relationship
When a single example of an entity is associated with more than one instance of an additional entity then it is called one to many relationships. .In the following diagram Customer’s table relates to many Orders tables.
2. Many to One Relationship
When an additional than one instance of an entity is related with a single instance of an additional entity then it is named many to one relationship. In the above diagram order tables associates one customer’s table.
3. Many to Many Relationship
When additional than one instance of an entity is related with more than one instances of another entity then it is named many to many relationships.