Mapping Cardinalities, Relationship, ER-Diagram
Mapping Cardinalities
In this tutorial, we shall discuss the Mapping Cardinalities, Relationships and ER-Diagram. There are four different types of mapping cardinalities. They are:
One to One:
If we consider the two sets A&B. The entity in A associated with at most one entity in B and in the same way, one entity in B is associated with the at most one entity in A.
One to Many:
In the consideration of two sets A&B. The entity in A associated with one or more than one entity in B, however every entity in B associated with at most one entity in A.
Many to One:
The entity in A associated with at most one entity in B, but every entity in B is associated with one or more entities in A.
Many to Many:
An entity in A associated with one or more than one entity in B and similarly, the entity in B associated with one or more than one entity in A.
Relationship:
A relationship is an association among several entities.
Relationship Set:
A relationship set is a set of relations of the same type. It is a mathematical relation on n>=2 entity sets.
Entity 1 – Student(roll, name, age)
Entity 2 – Book(bkno, author, subject)
The relation can be between the student to the book taken from the library
Relation set can be – issue(roll, bkno)
Having two entities in a relationship is known as binary relationship, three entities is known as ternary relationship and n entities is known as n-ary relationship
Entity – Relationship Diagram (ER Diagram)
ER diagram is a graphical representation of the logical structure of the database.
ER Diagram consists of the following components:
Rectangles – denotes the entities
Ellipse – denotes the attributes
Diamonds – denotes a relationship
Lines – denotes links between attribute, relationships and entities
Double Ellipse – denotes the multi-valued attribute
Dashed Ellipse – denotes derived attribute
Double Lines – denotes total participation that is the merging between relationship and entity
Double Rectangles – denotes the weak entity set (set with a partial key without primary key)
For more information visit the section of SQL.