Partial Dependency in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

Partial dependency is a situation in database normalization where a non-prime attribute is functionally dependent on only a part of a candidate key. The second normal form (2NF) is a normalization process that specifically addresses and eliminates partial dependencies.

What is Partial Dependency in DBMS?

To understand partial dependency, let us first know some basic terminologies with the help of an example.

Consider a relation(table) having four attributes, PP, QQ, RR, SS having the following dependencies:

P,QSP, Q \rightarrow S
QRQ \rightarrow R

Using PP and QQ, we can derive SS, and using only QQ, we can derive RR. Hence, we can say that if we use both PP and QQ together, then we can derive all the attributes of the table, i.e., PP, QQ, RR, SS. (since PPP \rightarrow P and QQQ \rightarrow Q is self-explanatory).

We can write as (PQ)+={P,Q,R,S}(PQ)^+ = \{P, Q, R, S\}, or in simple words, we can say the closure of PP and QQ gives us all the attributes of the relation. The minimal sets like PPQ in a relation(table) that are capable of deriving all the attributes of a relation(table) are called Candidate keysCandidate\ keys. There can be more than one candidate key in a table.

If an attribute is a part of any candidate key of the relation, then it is called a Primary attributePrimary\ attribute else, it is said to be a NonPrimary attributeNon-Primary\ attribute. In the example above, we can say that PP and QQ are primary attributes, and RR and SS are non-primary attributes.

We now know the basic definitions required to understand the concept of partial dependency. In the above example, SS is dependent on all the primary attributes, i.e., PP and QQ. If either PP or QQ are missing, then we cannot derive SS. In the case of RR, it is not the same.

Even if PP, a primary attribute, is missing, we can still derive RR using only QQ. Hence, instead of depending totally on the candidate key, RR is partially dependent on QQ, part of a candidate key. This is the concept of partial\ dependency.

What Causes Partial Dependency to Occur?

As we saw in the above section, partial dependency occurs whenever a non-prime attribute depends functionally on a part of the given candidate key.

In other words, Partial Dependency occurs when an attribute in a table depends on only a part of the primary key and not the whole key.

Partial Functional Dependency

A functional dependency denoted as XYX \rightarrow Y where XX and YY are an attribute set of a relation, is a partial dependency , if some attribute AXA \in X can be removed and the dependency still holds.

Let us take an example, consider an example of a College. A student studies in a course, and every student in the college has a unique Roll number.

CourseRoll. No.Name
BTech EE2015EE42Saloni
BTech CS2014CS12Anshuman
BSc Maths2017MM16Saloni
BTech CS2014CS10Abhimanyu
Mtech EE2018EE40Suchandra
MTech CS2020CS37Satbir

Suppose you are a student at this college. If a professor asks you to go and give a notebook to the student who has a roll. No. 2020CS37, you can quickly identify the student by observing his/her roll. no., i.e., 2020CS372020CS37. S/he is from 20202020 batch, studying Computer Science(CS)Computer\ Science(CS) and his Roll. No. is 3737.

Hence, you can successfully give him/her the notebook. You don't even need to know the Course that s/he is pursuing because you can easily determine it with his/her unique Roll. No.

In other words, if someone provides you with a just the roll number, you can quickly tell the student's name. A roll number alone is sufficient to identify or know the student's name. The NameName attribute is partially dependent on the Roll. No.Roll.\ No. attribute.

Full Functional Dependency

A functional dependency denoted as XYX \rightarrow Y where XX and YY are an attribute set of a relation, is a full dependency , if all the attributes present in XX are required to maintain the dependency.

Let us take an example, consider an example of a school. A student studies in a class, and in each class, every student has a unique Roll number.

ClassRoll. No.Name
542Saloni
812Anshuman
1137Saloni
810Abhimanyu
1040Suchandra
337Satbir

Suppose you are a student at this school. If a teacher asks you to go and give a notebook to the student who has a roll. No. 37, you will get confused. Then you will ask the teacher to tell you about the class in which s/he is studying. You can then quickly identify the student and successfully give him/her the notebook.

In other words, if someone provides you with a class and the roll number, you can quickly tell the student's name. A class or a roll number alone is insufficient to identify or know the student's name. The NameName attribute is fully dependent on the ClassClass and Roll. No.Roll.\ No. attribute.

Conclusion

  • Partial Functional Dependency occurs when an attribute in a table depends only on a part of the candidat key and not on the whole key i.e., Prime Non-prime\text{Prime}\ \rightarrow \text{Non-prime}
  • If a relation is not partially dependent then it is considered as Full Functional Dependency.