SIGN UP MEMBER LOGIN:    
Blog

Database relationship in DB2

Posted by Hanery Paula Blogs | DB2 Dec 28, 2011
Here in this blog we will look database relationship in DB2.

Database relationship

Here in this blog we will look database relationship in DB2

Here in this blog several types of relationship can be defined in a database consider the following relationship between employee and documents

One to many and many to one relationships

An employee can work in only one department; this relationship is single-valued for employees. On the other hand, one department can have many employees this relationship is multi-valued for departments. The relationship between employees (single-valued) and departments (multi-valued) is a one-to-many relationship.

To define tables for each one-to-many and each many-to-one relationship:

Group all the relationship for which the "many side of the relationship is the same entity and define a single table for all the relationship in the group

Example the many side of the first and second relationship is employee table employee is defined.

Table:

entity.jpg

Third relationship, "departments" is on the "many" side, so a department table, DEPARTMENT, is defined.

following tables show these different relationships.

Employee table:

Table:

entity2.jpg

share this blog :
post comment