For enquiries call:

Phone

+1-469-442-0620

HomeBlogDatabaseFunctional Dependency in DBMS: Concept, Type, Example

Functional Dependency in DBMS: Concept, Type, Example

Published
26th Apr, 2024
Views
view count loader
Read it in
9 Mins
In this article
    Functional Dependency in DBMS: Concept, Type, Example

    In a database management system, functional dependence (FD) is a constraint that establishes the relationship between one attribute and another attribute. Functional Dependency aids in preserving the integrity of the database's data.

    If there is only one non-key attribute in the table, any changes made to the primary key attribute also affect the non-key attribute. If any changes are made to the functional dependencies, the primary key table contents will be affected, and the functional dependencies are said to have a "minimal" functional dependency case,

    Finding the distinction between excellent and terrible database architecture is crucial. Suppose you want to improve your skills and practice more in DBMS. I recommend that you check out the KnowledgeHut MongoDB course.

    What is Functional Dependency in DBMS

    Rows and columns are used to store data in relational databases. While each row in a table represents a group of linked data, and every row in the table has the same structure, columns indicate the characteristics of the data. A tuple is another name for the row.

    In a database management system (DBMS) system, functional Dependency in DBMS establishes the relationship between one attribute and another attribute. Functional dependencies make the quality of the data in the database easier. The symbol for a functional dependency is an arrow. X->Y stands for the functional dependence of X on Y. Functional Dependency is a key factor in determining the quality of database architecture.

    Determinant refers to the attribute set on the left side of the arrow, X. In contrast, Dependent refers to the attribute set on the right side, Y. While Y will be a dependent non-key attribute from a table that shares the main key with X, X will be the primary key attribute.

     It demonstrates the functional dependence between the non-key attribute Y and the primary key attribute X. Simply put if a table's column X characteristic uniquely identifies its column Y attribute. The functional dependence of column Y on column X is symbolized as X->Y.

    Functional dependencies are a crucial part of understanding advanced Relational Database System principles since they mathematically represent relationships between database elements.

    Example of Functional Dependency in DBMS

    Let's see functional Dependency in DBMS with an example.

    Assume that the student database has two distinct attributes: Stu Id and Stu Name.

    Student ID is Stu_Id. 
    The student Name is Stu_Name. 

    The StuId serves as our main key. And in this case, StuId uniquely identifies the StuName attribute. You must first have the StuId if someone wishes to know the student's name. if someone wishes to know the student's name.

    Stu_IdStu_Name
    011Marketing
    022HR
    033Finance
    044Accounting
    055Sales
    066Telecom
    Stu_Id -> Stu_Name 

    The functional Dependency between Stu Id and Stu Name mentioned above can be expressed as Stu Id depends on Stu Name. 

    Rules of Functional Dependency

    Rules of functional dependencies

    Source

    1. Reflexive Rule: Rule of reflection If Y is a subset of X and X is a set of attributes, then X has a value for Y.

    • For example, { Employee_Id, Name } → {Name} is valid.

    2. Augmentation Rule: If c is set as an attribute and x -> y holds, then ac -> bc also holds. That is the addition of properties without altering the fundamental dependencies.

    • For example, X → Y holds true then, ZX → ZY also holds true.
    • For example, if { Employee_Id, Name } → { Name } holds true then, { Employee_Id, Name, Age } → { Name, Age }

    3. Transitivity Rule: If x > y and y > z are true, then x > z is also true. This rule is quite similar to the transitive rule in algebra. As a functional relationship, X determines Y.

    • For example, if { Employee_Id } → { Name } holds true and { Name } → { Department } holds true, then { Employee_Id } → { Department } also holds true.

    Get In-depth knowledge of core as well as advanced concepts of DBMS with MongoDB Administration training

    Types of Functional Dependencies in DBMS
    types of functional dependencies

    Following are the types of functional Dependency in DBMS:

    1. Trivial Functional Dependency

    Every dependent in trivial functional Dependency is a subset of the determinant. To put it another way, a functional relationship is said to be simple if its right-side characteristics are a subset of its left-side attributes. Right-side characteristics are a subset of its left-side attributes.

    If Y is a subset of X, the functional relationship X->Y is referred to as trivial.

    Example: 

    Take a look at the Employee table, for instance.

    Employee_IdNameAge
    1Zayn24
    2Phobe34
    3Hikki26
    4David29

    Given that the dependent Name is a subset of the determinant Employee Id, Name, the functional Dependency between 

    {Employee Id, Name} and {Name} in this case is trivial.

    Additionally trivial are Name, Age, and Employee Id. The name is also trivial. Employee Id is trivial.

    2. Non-Trivial Functional Dependency

    The trivial functional Dependency in DBMS is opposed by it. Formally speaking, dependent if not a subset of the determinant in Non-Trivial functional Dependency.

    If Y is not a subset of X, the relationship between X and Y is said to be non-trivial functional. A functional dependency X Y that is not trivial is one in which X is a collection of attributes, and Y is likewise a set of those attributes but not a subset of X.

    Example: 

    Take a look at the Employee table, for instance.

    Employee_IdNameAge
    1Zayn24
    2Phobe34
    3Hikki26
    4David29
    5Phobe24

    Because Name(dependent) is not a subset of Employee Id, there is a nontrivial functional dependency between Employee Id and Name in this situation.

    The functional dependencies {Employee Id, Name} -> { Age } are likewise nontrivial.

    3. Multi-valued functional Dependency

    Attributes in the dependent set are not reliant on one another in multi-valued Dependency in DBMS. 

    If there is no functional dependency between Y and Z, for instance, the relationship X Y, and Z is referred to as multivalued functional Dependency. 

    Example: 

    Take a look at the Employee table:

    Employee_IdNameAge
    1Zayn24
    2Phobe34
    3Hikki26
    4David29
    4Phobe24

    Since the dependent attributes Name and Age are not functionally dependent (i.e. Name->Age or Age->Name doesn't exist! ), {Employee_Id} -> {Name, Age} is a multivalued functional dependency in this case.

    4. Transitive functional Dependency 

    Given two functional dependencies A –> B and B – >C, A –> C must also exist in accordance with the transitivity principle. A transitive dependency in DBMS is what is being used here.

    In transitive functional Dependency, the dependent is thus indirectly reliant on the determinant. 

    Example:

    Take a look at the Employee table, for instance.

    Employee_IdNameDepartmentStreet Number
    1ZaynCD11
    2PhobeAB24
    3HikkiCD11
    4DavidPQ71
    5PhobeLM21

    In this case, the relationships between Employee Id, Department, and Street Number are valid. Consequently, Employee Id and Street Number are both valid functional dependencies according to the axiom of transitivity. 

    How to Denote a Functional Dependency 

    An "arrow" represents a functional dependency. A B symbolizes the functional dependence of A on B. 

    An example is a relation with the four attributes A, B, C, and D. 

    R (ABCD) 
    A → BCD 
    B → CD 

    Attributes B, C, and D are functionally reliant on attribute A in the first functional dependence  

    A->BCD.

    Function dependency B->CD two qualities, C and D depend on attribute B to function. 

    All elements on the left side of a functional dependency are sometimes referred to as the determinant set, and all of the elements on the right side are the dependant attributes. 

    • Functional Dependency in DBMS, a diagrammatic representation of functional Dependency, 
    • The dependent attribute is determined by pointing arrows, and the arrow's origin determines the determinant set. 

    Advantages of Functional Dependency

    The advantages of functional dependency are many. Some of them are listed below:  

    • The database's data quality is maintained using it. 
    • It communicates the database design's facts. 
    • It aids in precisely outlining the limitations and implications of databases. 
    • It is useful to recognize poor designs. 
    • Functional Dependency eliminates data duplication in cases where the same values shouldn't appear more than once in the same database table. 
    • Finding the potential keys in the relationship is the first step in the normalization procedure. Identifying potential keys and normalizing the database without functional dependencies is impossible. 

    Conclusion

    In a DBMS system, functional dependence occurs when one attribute influences another. Keywords for functional Dependency include axiom, decomposition, dependent, determinant, and union. 

    There are four different types of functional Dependency: 1) Multivalued, 2) trivial, 3) Non-trivial, 4) Transitive. When there are numerous independent multivalued characteristics in a single table, multivalued Dependency occurs. 

    A set of attributes is said to be trivial if the set of attributes is included in that attribute, which is when the trivial Dependency arises. 

    When A->B is true, but B is not a subset of A, there is a nontrivial dependency. 

    A functional dependency is said to be transitive when another functional dependency indirectly creates it. So, now I think that you are clear of functional Dependency.

    If you are looking for a complete guide to database management systems, check out MongoDB course.

    Frequently Asked Questions (FAQs)

    1Where can I find functional dependencies in DBMS?

    A connection between two attributes is called a functional dependency. It often belongs in a table between the primary key and a non-key property. The right side of production is known as a dependant, while the left side of FD is known as a determinant.

    2What is the role of functional Dependency in DBMS?

    Functional Dependency is an important consideration when building database parameters and functions to support your business, organization, or firm in storing and managing its data since it acts as a constraint between the two sets of characteristics.

    3How do you identify functional Dependency?

    A constraint that describes the relationship between two sets of attributes in which one set reliably predicts the value of the other sets is known as a functional dependency. It is represented as X->Y, where X represents a collection of characteristics that can be used to calculate the value of Y. 

    Profile

    Monica Gupta

    Author

    I am Monica Gupta with 19+ years of experience in the field of Training and Development. I have done over 500 Corporate Trainings. I am currently working as a freelancer for several years. My core area of work is Java, C++, Angular, PHP, Python, VBA.

    Share This Article
    Ready to Master the Skills that Drive Your Career?

    Avail your free 1:1 mentorship session.

    Select
    Your Message (Optional)

    Upcoming Database Batches & Dates

    NameDateFeeKnow more
    Whatsapp/Chat icon