# What is Transitive dependency in DBMS?

DBMSDatabaseBig Data Analytics

A functional dependency X->Y is a transitive dependency, if X is not candidate key or super key and Y is a non-key attribute(s).

## Example 1

Let a relation be R(A,B,C)

Thus, Key attribute = A and Non-key attribute =B,C.

B->C is a transitive dependency.

## Example 2

Let's consider another example, where a relation is R(A,B.C.D)

Thus, Key attributes = A,B and Non-key attributes = C,D.

Then, C->D is a Transitive dependency

AB-> D is not a transitive dependency

C->DB is not a transitive dependency.

## Problem

A relation R(ABCDEF) and F: {AB->C, C->A, B->DE, ABD-> F}. Find the transitive dependency.

## Solution

AB+=ABCDE => AB is candidate key

C+=CA

B+=BDE

ABD+=ABDFCE =>ABD is not candidate key [since AB is candidate key]

=>key attribute= {A,B} and non-key attributes ={C,D,E}

AB-> C is not a transitive dependency

C->A is not a transitive dependency

B->DE is a transitive dependency [Since, B is not a candidate key/super key and DE is a non-key attribute}.

ABD->F is not a transitive dependency. [Since, ABD is a super key].

## Example of Transitive Dependency

Consider the table given below −

BookBook_AuthorAge_of_Author
ABCHari60
PQRPotter45

The dependencies are as follows −

{Book} -> {Book_Author}
{Book_Author} does not -> {Book}
{Book_Author} -> {Age_of_Author}

Hence, as per the transitivity, the {Book} -> {Age_of_Author}. Therefore, if one knows the book, then the age of the Author is also known.