The document discusses functional dependency in databases. It defines functional dependency as the relationship between attributes in a table where one attribute determines other attributes. It then explains how functional dependencies are denoted with arrows and examples. Finally, it covers Armstrong's axioms which define the properties of functional dependencies, including reflexivity, augmentation, and transitivity. It also defines and provides examples of different types of functional dependencies such as trivial, non-trivial, multivalued, and transitive functional dependencies.
The document discusses functional dependency in databases. It defines functional dependency as the relationship between attributes in a table where one attribute determines other attributes. It then explains how functional dependencies are denoted with arrows and examples. Finally, it covers Armstrong's axioms which define the properties of functional dependencies, including reflexivity, augmentation, and transitivity. It also defines and provides examples of different types of functional dependencies such as trivial, non-trivial, multivalued, and transitive functional dependencies.
Introduction • Functional Dependency in DBMS, as the name suggests it is the relationship between attributes(characteristics) of a table related to each other. Introduction
•Functional Dependency in DBMS, as the
name suggests it is the relationship between attributes(characteristics) of a table related to each other. How to denote a Functional Dependency?
•A functional dependency is denoted by
an arrow “→”. The functional dependency of A on B is represented by A → B. How to denote a Functional Dependency? • Consider a relation with four attributes A, B, C and D, • R (ABCD) • A → BCD • B → CD • For the first functional dependency A → BCD, attributes B, C and D are functionally dependent on attribute A. Armstrong’s Axioms/Properties of a Functional Dependency • William Armstrong in 1974 suggested a few rules related to functional dependency. They are called RAT rules. • Reflexivity • Augmentation • Transitivity Reflexivity
•If A is a set of attributes and B is a subset
of A, then the functional dependency A → B holds true. •EX: • { Employee_Id, Name } → Name is valid. Augmentation
• If a functional dependency A → B holds true, then appending any
number of the attribute to both sides of dependency doesn't affect the dependency. It remains true.
• X → Y holds true then, ZX → ZY also holds true.
• if { Employee_Id, Name } → { Name } holds true then, { Employee_Id, Name, Age } → { Name, Age } Transitivity
• If two functional dependencies X → Y and Y → Z hold true, then X →
Z also holds true by the rule of Transitivity. • Example • if { Employee_Id } → { Name } holds true and { Name } → { Department } holds true, then { Employee_Id } → { Department } also holds true. Types of Functional Dependencies
•Trivial functional dependency
•Non-Trivial functional dependency •Multivalued functional dependency •Transitive functional dependency Trivial functional dependency • Functional dependency is called trivial if the attributes on the right side are the subset of the attributes on the left side of the functional dependency. • X → Y is called a trivial functional dependency if Y is the subset of X. Trivial functional dependency • Example Trivial functional dependency
• Example
•Here, { Employee_Id, Name } → { Name } is a Trivial functional dependency,
since the dependent Name is the subset of determinant { Employee_Id, Name }. •{ Employee_Id } → { Employee_Id }, { Name } → { Name } and { Age } → { Age } are also Trivial Non-Trivial functional dependency • It is the opposite of Trivial functional dependency. Formally speaking, in Non-Trivial functional dependency, dependent if not a subset of the determinant. • X → Y is called a Non-trivial functional dependency if Y is not a subset of X. So, a functional dependency X → Y where X is a set of attributes and Y is also a set of the attribute but not a subset of X, then it is called Non-trivial functional dependency. Trivial functional dependency
• Example
Here, { Employee_Id } → { Name } is a non-trivial functional
dependency because Name(dependent) is not a subset of Employee_Id(determinant). Similarly, { Employee_Id, Name } → { Age } is also a non- trivial functional dependency. Multivalued functional dependency • In Multivalued functional dependency, attributes in the dependent set are not dependent on each other. • For example, X → { Y, Z }, if there exists is no functional dependency between Y and Z, then it is called as Multivalued functional dependency. Multivalued functional dependency • Here, { Employee_Id } → { Name, Age } is a Multivalued functional dependency, since the dependent attributes Name, Age are not functionally dependent(i.e. Name → Age or Age → Name doesn’t exist !). Transitive functional dependency • Consider two functional dependencies A → B and B → C then according to the transitivity axiom A → C must also exist. This is called a transitive functional dependency. • In other words, dependent is indirectly dependent on determinant in Transitive functional dependency. Transitive functional dependency
Here, { Employee_Id → Department } and { Department → Street Number
} holds true. Hence, according to the axiom of transitivity, { Employee_Id → Street Number } is a valid functional dependency Adv functional dependency • It is used to maintain the quality of data in the database. • It expresses the facts about the database design. • It helps in clearly defining the meanings and constraints of databases. • It helps to identify bad designs. • Functional Dependency removes data redundancy where the same values should not be repeated at multiple locations in the same database table. • The process of Normalization starts with identifying the candidate keys in the relation. Without functional dependency, it's impossible to find candidate keys and normalize the database Practice Questions on Functional Dependency in DBMS 1. When an FD is reflexive, Y is a subset of X and X refers to the set of attributes, then: • A. Y -> X holds • B. X -> Y holds • C. XY -> Z holds • D. None of the above Practice Questions on Functional Dependency in DBMS 2.When an FD is reflexive, Y is a subset of X, and X is the set of attributes, then X -> Y would always hold. It is known as the Armstrong axioms reflexivity rule. • If P -> Q, P -> R, then which of these would be true? • A. P -> QR • B. P -> Q • C. P -> R • D. All of the above