Relationship degree and types of relationships in dbms

By
Advertisement
The degree of a relationship is the number of entities that participate in that relationship. Relationship degree refers to the number of associated entities. The relationship degree can be broadly classified into unary, binary, and ternary relationship.

Unary Relationship

The unary relationship is otherwise known as recursive relationship. In the unary relationship the number of associated entity is one. An entity related to itself is known as recursive relationship.

Binary Relationship

In a binary relationship, two entities are involved. Consider the example; each staff will be assigned to a particular department. Here the two entities are STAFF and DEPARTMENT.


Ternary Relationship

In a ternary relationship, three entities are simultaneously involved. Ternary relationships are required when binary relationships are not sufficient to accurately describe the semantics of an association among three entities.

Example

Consider the example of employee assigned a project. Here we are considering three entities EMPLOYEE, PROJECT, and LOCATION. The relationship is “assigned-to.” Many employees will be assigned to one project hence it is an example of one-to-many relationship.



Quaternary Relationships

Quaternary relationships involve four entities. The example of Quaternary relationship is “A professor teaches a course to students using slides.” Here the four entities are PROFESSOR, SLIDES, COURSE, and STUDENT. The relationships between the entities are “Teaches.”


 Relationship Classification

Relationship is an association among one or more entities. This relationship can be broadly classified into one-to-one relation, one-to-many relation, many-to-many relation and recursive relation.

One-to-Many Relationship Type

The relationship that associates one entity to more than one entity is called one-to-many relationship.



 Example of one-to-many relationship is Country having states. For one country there can be more than one state hence it is an example of one-to-many relationship.

 One-to-One Relationship Type

One-to-one relationship is a special case of one-to-many relationship. True one-to-one relationship is rare.

The relationship between the President and the country is an example of one-to-one relationship. For a particular country there will be only one President.

Many-to-Many Relationship Type

The relationship between EMPLOYEE entity and PROJECT entity is an example of many-to-many relationship.

Many employees will be working in many projects hence the relationship between employee and project is many-to-many relationship.

0 comments:

Post a Comment