Explain join dependency in DBMS

DBMSDatabaseBig Data Analytics

Join dependency is a constraint which is similar to functional dependency or multivalued dependency. It is satisfied if and only if the relation concerned is the join of a certain number of projections. Such type of constraint is called join dependency.

Let's consider a special class of join dependencies which help to capture data dependencies present in a hierarchical data structure.

Example 1

The above hierarchical organization informs regarding ward and patients currently admitted to a ward depend only on the hospital but not the facilities present in that hospital. Since hospitals have multiple wards, functional dependencies are not adequate to describe the data dependency among hospitals and wards or facilities.

In this case, multivalued dependencies,

Hospital->-> ward or

Hospital ->-> facilities hold.

Using first order hierarchical decomposition would enable us to represent data dependencies present in hierarchical data structure in a more natural way.

Thus we can store hospital database as lossless join of the following −

Hospital_facility(hospital, facilities),

Hospital_ward(hospital, ward, patient, complaints, treatment, doctor)

Example 2

A relation R satisfies join dependency if R is equal to the join of R1,R2,.....Rn where Ri is a subset of the set of attributes of R.

Relation R

DeptSubjectName
CSECAmmu
CSECAmar
CSEJavaAmar
ITCbhanu

Here,

dept ->-> subject

dept->-> name

The above relation is in 4NF. Anomalies can occur in relation in 4NF if the primary key has three or more fields. The primary key is (dept, subject, name). Sometimes decomposition of a relation into two smaller relations does not remove redundancy. In such cases it may be possible to decompose the relation in three or more relations using 5NF.

The above relation says that dept offers many elective subjects which are taken by a variety of students. Students have the opinion to choose subjects. Therefore all three fields are needed to represent the information.

The above relation does not show non-trivial MVDs since the attributes subject and name are dependent; they are related to each other (A FD subject->name exists). The relation cannot be decomposed in two relations (dept, subject) and (dept,sname).

Therefore the relation can be decomposed into following three relations −

R1(dept, subject)

R2(dept, name) and

R3(subject, name) and it can be shown that decomposition is lossless.

R1

DeptSubject
CSEC
CSEJava
ITC

R2

DeptName
CSEAmmu
CSEAmar
ITbhanu

R3

SubjectName
CAmmu
CAmar
JavaAmar
Cbhanu
raja
Published on 06-Jul-2021 12:43:33
Advertisements