ER-Diagrams



Hello every one, to day session is about ER Diagrams. What is an ER-Diagram . It is the short form of the Entity Relational Diagram. So you may ask from me "What is Entity Relational Diagram."
It is related to Databases. ER Diagrams shows the relationships of set of entities stored in a database.  ER Diagrams has several components. For my convenience, i will used, word "ER" instead of Entity Relational Diagrams. That's fine. Now i'm going to explain the application of the ER. Think you need to make a web based solution for a real world scenario. Then you need to break them into several modules for the building convenience as well as understanding convenience for the developers. After make the ER, you can easily understand the inter connection of the  each modules. Then you can map them by a  regular method for the further developments.

Ok.  Lets we see the main components of the ER. You can see the relevant symbols for them in following picture.



 I will explain them one by one.

ENTITY
Entity is a main component in ER diagram. Entity is an object or a concept which you want to store the information. we represent entity as a rectangle in ER. additional thing is we use singular words for label the entities. Not plural, right
Ex: Student, Employee

RELATIONSHIP
show the relationship of the connected entities. how interact with each other. we use diamond symbol for this. Singular verbs use for label the relationships.
Ex: has , belongs

ATTRIBUTE
This show the characteristics of the entity. this can categorize into several types by consider the behavior of them. we use oval as the symbol for the attributes.
Ex: if we get Student entity, the attributes should be  student_name, student_id, student_age, student_age etc.

WEAK ENTITY
Weak entity mean an entity is depending on another entity, we call as Strong entity for the rest entity.
if the strong entity removed the weak entity also removed by default. 
Ex: Employee entity is the strong entity of the Dependent entity. if employee resign from the company, the dependents are also removed by the company's ER.

WEAK ENTITY RELATIONSHIP
In sometimes, relationships also containing the attributes. then called it as weak entity. because, normally attributes are containing by the entities. but in this case we cannot exactly say that is an entity or a relationship. hence use the word of "weak entity"
Ex: Think about relationship between Student class and the Subject class, the marks of the subjects relationship name should be belong. how about the marks of the subjects. those are not directly belongs to the neither student nor subjects . hence marks containing by the relationship .

KEY ATTRIBUTE
As above mentioned, attributes are the characteristics of the entity. key attribute is a unique attribute for the entity. entity can easily recognize by the key attribute.
Ex: student_id is the unique attribute for the Student entity.

MULTIVALUED ATTRIBUTE
This kind of attributes are containing more than one value at a time.
Ex: Skills attribute in a Employee class

COMPOSITE ATTRIBUTE

An attribute is concerned composite if it comprises two or more other attributes.
Ex:name can broken down into first name and last name

DERIVED ATTRIBUTES
some attributes are derive from another attribute. in ER this attributes drawing by using the dash lined oval. Ex age attribute can derive from date of birth attribute. then age is a derived attribute
you can see in below the simple ER Diagram.
In the above ER diagram, you can see the characteristics of above mentioned. 
In above ER Diagram has follow items.

Entities                   -    Student, College
Key Attributes       -    stu_id, col_id
Composite Attribute-  stu_address, stu_name, col_name

I hope you that you have herd about tables are in database (In RDBMS) RDBMS mean Relational Database Management System. Tables are derived by the entities and columns alias attributes of the table are derived from attributes of the entity.

TYPES OF CARDINALITY
There are several types of cardinalities. Those are.
  • one to one
  • one to many
  • many to many
according to above picture, 
  • one employee is get only one id card, in other word, one id card issue for a only one person.
  • one student enroll to many courses and one course belong to only one student. 
  • student can take many tests and test can belong to many students. 
TYPES OF RELATIONSHIPS
There are several types of relationships. those are
  • unary
  • binary
  • ternary
  • N-ary
Unary
A unary relationship is when the  both of participant in the relationship are belongs to the same entity.
Ex: Employee marry Employee.



Binary
most common relationship type. participants are belongs to two different entities


Ternary
ternary relationships are arising when the three entities are participate to the relationship










Comments

Popular posts from this blog

Angular with firebase