Entity-Relationship Model : Relationships and Relationship Sets

Relationships : 

A relationship is an association among several entities. In other words A relationship defines how two or more entities are inter-related. For example STUDENT and COURSE entities are related as 'STUDENT X studies enrolls_in a COURSE Y', here 'enrolls_in' defines the relationship between STUDENT and COURSE. Similarly, EMPLOYEE and DEPARTMENT are related as 'EMPLOYEE works_at a DEPARTMENT', here 'works_at' forms the relationship between EMPLOYEE and DEPARTMENT. A diamond is used to symbolically represent a relationship in the e-r diagram.

Relationship Sets: 

A relationship set is a set of relationships of the same type. Like entities, a relationship too can have attributes. These attributes are called descriptive attributes. Formally, it is a mathematical relation on n ≥ 2 (possibly non-distinct) entity sets. If E1 , E2 ,...,En are entity sets, then a relationship set R is a subset of

{(e 1 ,e 2 ,...,e n ) | e 1 ∈ E 1 ,e 2 ∈ E 2 ,...,e n ∈ E n }

where (e1 ,e2 ,...,en) is a relationship.

Like entities, a relationship too can have attributes. These attributes are called Descriptive attributes. suppose we have entity sets student and course which participate in a relationship set enrolls_in. We may wish to store a descriptive attribute for-credit with the relationship, to record whether a student has taken the course for credit, or is auditing (or sitting in on) the course. 

Degree of Relationship :

In a relationship two or more number of entities can participate. The number of entities who are part of a particular relationship is called degrees of relationship. Based on the degree, the relationships may be identified as unary (degree 1), binary (degree 2), ternary (degree 3) and so on.

1. Unary Relationship :  If only single entity is involved in a relationship then it is a unary relationship. The relationship 'Mentoring' connects (associates) with only one entity set.

2. Binary Relationship : When two entities participate in the mapping, then it is a binary relationship. The relationship 'Teaches' connects (associates) with entity sets, Teacher and Student.

3. Ternary Relationship : When three or more entities are participate in the mapping, than it is a ternary relationship. The relationship 'Teach' connects (associates) with entity sets instructors, Courses and Classroom.

Next Topic :  -
                Entity Relationship Model : Mapping Cardinalities
                RDBMS List

No comments:

Post a Comment