Functional Dependency in
DBMS
Understanding Concepts through Employee and Project Tables
Introduction to Functional Dependency
• A functional dependency (FD) in a database occurs when one
attribute uniquely determines. The functional dependency is a
relationship that exists between two attributes. It typically exists
between the primary key and non-key attribute within a tables
another.
• Importance in DBMS:
• Essential for normalization
• Ensures data integrity and minimizes redundancy
• Example - Emp_ID → Emp_Name (An employee ID determines the
employee name)
Employee Table
• CREATE TABLE Employee (
• Emp_ID VARCHAR2(10),
• Emp_Name VARCHAR2(50),
• Dept_ID VARCHAR2(10),
• Salary NUMBER
• );
• INSERT INTO Employee VALUES ('E001', 'Alice Smith', 'D01', 70000);
• INSERT INTO Employee VALUES ('E002', 'Bob Johnson', 'D02', 65000);
• INSERT INTO Employee VALUES ('E003', 'Charlie Lee', 'D01', 72000);
Employee Table
Project Table
• CREATE TABLE Project (
• Proj_ID VARCHAR2(10),
• Proj_Name VARCHAR2(50),
• Budget NUMBER
• );
• INSERT INTO Project VALUES ('P101', 'Alpha Development', 500000);
• INSERT INTO Project VALUES ('P102', 'Beta Testing', 300000);
• INSERT INTO Project VALUES ('P103', 'Gamma Launch', 400000);
Project Table
Works_On Table
• CREATE TABLE Works_On (
• Emp_ID VARCHAR2(10),
• Proj_ID VARCHAR2(10),
• Hours_Worked NUMBER
• );
• INSERT INTO Works_On VALUES ('E001', 'P101', 35);
• INSERT INTO Works_On VALUES ('E002', 'P102', 40);
• INSERT INTO Works_On VALUES ('E003', 'P101', 30);
• INSERT INTO Works_On VALUES ('E001', 'P103', 20);
Works_On Table
Types of Functional Dependencies
• Trivial Functional Dependency
• Non-Trivial Functional Dependency
• Partial Functional Dependency
• Full Functional Dependency
• Transitive Functional Dependency
Types of Functional Dependencies
• 1. Trivial Functional Dependency - A dependency where an attribute
is functionally dependent on itself or a subset of attributes.
• Example:Emp_ID, Proj_ID → Emp_ID
Here, Emp_ID is trivially dependent on (Emp_ID, Proj_ID).
SELECT Emp_ID, Emp_ID
FROM Employee
GROUP BY Emp_ID;
Non-Trivial Functional Dependency
• When an attribute is functionally dependent on a combination of
other attributes, and it’s not a trivial dependency.
• Example: Emp_ID → Dept
• Employee ID determines the department, which is non-trivial because
Dept is not part of the primary key.
• SELECT Emp_ID, Emp_Name
• FROM Employee
• GROUP BY Emp_ID, Emp_Name;
Partial Functional Dependency
• A non-prime attribute is functionally dependent on part of a
candidate key.
• Example:(Emp_ID, Proj_ID) → Emp_NameIn the Works On table, if
Emp_ID is part of the composite key, but Emp_Name depends only on
Emp_ID.
• SELECT Proj_ID, SUM(Hours_Worked)
• FROM Works_On
• GROUP BY Proj_ID;
Full Functional Dependency
• A non-prime attribute depends on the full composite key and not just
a part of it.
• Example: (Emp_ID, Proj_ID) → Hours_Worked
• Hours worked by an employee depends on both the employee and
the project.
• SELECT Emp_ID, Proj_ID, Hours_Worked
• FROM Works_On
• GROUP BY Emp_ID, Proj_ID, Hours_Worked;
Transitive Functional Dependency
• When one attribute depends on another through a third attribute.
• Example: Emp_ID → Dept and Dept → Manager
• Therefore, Emp_ID → Manager (transitive dependency).
• CREATE TABLE Department
• ( Dept_ID VARCHAR2(10), Dept_Name VARCHAR2(50), Manager_ID
VARCHAR2(10) );
• INSERT INTO Department VALUES ('D01', 'Development', 'M001’);
• INSERT INTO Department VALUES ('D02', 'Testing', 'M002');
Transitive Functional Dependency
• -- Transitive Dependency Query
• SELECT E.Emp_ID, D.Manager_ID
• FROM Employee E
• JOIN Department D ON E.Dept_ID = D.Dept_ID;
Inference Rules (Armstrong’s Axioms)
• Reflexivity Rule If Y is a subset of X, then X → Y.
• Example: Emp_ID → Emp_ID
SELECT Emp_ID, Emp_Name
FROM Employee
GROUP BY Emp_ID, Emp_Name;
Inference Rules (Armstrong’s Axioms)
• Augmentation Rule If X → Y, then XZ → YZ
(adding additional attributes does not affect the dependency).
Example: Emp_ID → Emp_Name implies (Emp_ID, Proj_ID) →
(Emp_Name, Proj_ID)
• SELECT Emp_ID, Emp_Name, Proj_ID
• FROM Employee E
• JOIN Works_On W ON E.Emp_ID = W.Emp_ID;
Inference Rules
• Transitivity Rule If X → Y and Y → Z, then X → Z.
• Example: Emp_ID → Dept and Dept → Manager implies
• Emp_ID → Manager
• SELECT E.Emp_ID, D.Manager_ID
• FROM Employee E
• JOIN Department D ON E.Dept_ID = D.Dept_ID;
Inference Rules
• Decomposition Rule If X → YZ, then X → Y and X → Z.
• Example: (Emp_ID, Proj_ID) → (Emp_Name, Hours_Worked) implies
Emp_ID → Emp_Name and (Emp_ID, Proj_ID) → Hours_Worked
• SELECT Emp_ID, Emp_Name, Salary
• FROM Employee
• GROUP BY Emp_ID, Emp_Name, Salary;
Inference Rules
• Union Rule If X → Y and X → Z, then X → YZ.
• Example: Emp_ID → Emp_Name and Emp_ID → Dept implies Emp_ID
→ (Emp_Name, Dept)
• SELECT Emp_ID, Emp_Name, Salary
• FROM Employee
• GROUP BY Emp_ID, Emp_Name, Salary;
Inference Rules
• Pseudo-Transitivity Rule If X → Y and WY → Z, then WX → Z.
• Example: Emp_ID → Dept and (Proj_ID, Dept) → Manager
• implies (Emp_ID, Proj_ID) → Manager
• SELECT W.Emp_ID, W.Proj_ID, P.Budget
• FROM Works_On W
• JOIN Project P ON W.Proj_ID = P.Proj_ID;
Case Study- Normalizing Works_On Table
• Issue: Emp_Name repeats for the same Emp_ID.
• Solution: First Normal Form (1NF): Already satisfied (atomic values).
• Second Normal Form (2NF): Remove partial dependencies.
• Separate Emp_Name into Employee table.
THANK YOU

More Related Content

PPTX
functional dependency in engineering.pptx
PPTX
functional dependency in database (1).pptx
PPTX
21CSC205P DBMS UNIT IV.pptx21CSC205P DBMS UNIT IV.pptx
PPT
DBMS MODULE-5 normalisation in database management
PPTX
module-3 Functional Dependency & Key Generation.pptx
PPT
Database normalization
PDF
Normalization.pdf
functional dependency in engineering.pptx
functional dependency in database (1).pptx
21CSC205P DBMS UNIT IV.pptx21CSC205P DBMS UNIT IV.pptx
DBMS MODULE-5 normalisation in database management
module-3 Functional Dependency & Key Generation.pptx
Database normalization
Normalization.pdf

Similar to Functional Dependency in DBMS Enggg.pptx (20)

PPTX
Normalisation
PPTX
Normalization-1NF,2NF,Functional dependencies.pptx
PPT
Normalization by Sanu
PPT
DBMS-Unit-3.0 Functional dependencies.ppt
PPTX
Chapter-8 Relational Database Design
PPT
UNIT-IV.ppt
PPT
MODULE 4 -Normalization_1.ppt
PPTX
DBMS_Module 3_Functional Dependencies and Normalization.pptx
PPTX
Unit 4 Normalization, Functional Dependency
PPTX
Chapter 4.pptxdatabase presentation foe fund
PPTX
FD first lesson66666666666666666666.pptx
PDF
PDF
DBMS 3.pdf
PPTX
normalization ppt.pptx
PPTX
Unit 3 dbms
DOCX
Exercise 1.docx
PDF
topic 3 dependencies Normalzation softwares-converted.pdf
PPT
DBMS Normalization (1,2,3,BCNF Normal Form,
PPTX
05- Relational Database Design_Week 05.pptx
PPTX
Functional Dependency.pptx
Normalisation
Normalization-1NF,2NF,Functional dependencies.pptx
Normalization by Sanu
DBMS-Unit-3.0 Functional dependencies.ppt
Chapter-8 Relational Database Design
UNIT-IV.ppt
MODULE 4 -Normalization_1.ppt
DBMS_Module 3_Functional Dependencies and Normalization.pptx
Unit 4 Normalization, Functional Dependency
Chapter 4.pptxdatabase presentation foe fund
FD first lesson66666666666666666666.pptx
DBMS 3.pdf
normalization ppt.pptx
Unit 3 dbms
Exercise 1.docx
topic 3 dependencies Normalzation softwares-converted.pdf
DBMS Normalization (1,2,3,BCNF Normal Form,
05- Relational Database Design_Week 05.pptx
Functional Dependency.pptx
Ad

Recently uploaded (20)

PDF
Abrasive, erosive and cavitation wear.pdf
PPTX
Module 8- Technological and Communication Skills.pptx
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPTX
Software Engineering and software moduleing
PPTX
Current and future trends in Computer Vision.pptx
PDF
Visual Aids for Exploratory Data Analysis.pdf
PPTX
Fundamentals of Mechanical Engineering.pptx
PDF
Soil Improvement Techniques Note - Rabbi
PDF
737-MAX_SRG.pdf student reference guides
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Abrasive, erosive and cavitation wear.pdf
Module 8- Technological and Communication Skills.pptx
Exploratory_Data_Analysis_Fundamentals.pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Software Engineering and software moduleing
Current and future trends in Computer Vision.pptx
Visual Aids for Exploratory Data Analysis.pdf
Fundamentals of Mechanical Engineering.pptx
Soil Improvement Techniques Note - Rabbi
737-MAX_SRG.pdf student reference guides
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
III.4.1.2_The_Space_Environment.p pdffdf
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
"Array and Linked List in Data Structures with Types, Operations, Implementat...
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Ad

Functional Dependency in DBMS Enggg.pptx

  • 1. Functional Dependency in DBMS Understanding Concepts through Employee and Project Tables
  • 2. Introduction to Functional Dependency • A functional dependency (FD) in a database occurs when one attribute uniquely determines. The functional dependency is a relationship that exists between two attributes. It typically exists between the primary key and non-key attribute within a tables another. • Importance in DBMS: • Essential for normalization • Ensures data integrity and minimizes redundancy • Example - Emp_ID → Emp_Name (An employee ID determines the employee name)
  • 3. Employee Table • CREATE TABLE Employee ( • Emp_ID VARCHAR2(10), • Emp_Name VARCHAR2(50), • Dept_ID VARCHAR2(10), • Salary NUMBER • ); • INSERT INTO Employee VALUES ('E001', 'Alice Smith', 'D01', 70000); • INSERT INTO Employee VALUES ('E002', 'Bob Johnson', 'D02', 65000); • INSERT INTO Employee VALUES ('E003', 'Charlie Lee', 'D01', 72000);
  • 5. Project Table • CREATE TABLE Project ( • Proj_ID VARCHAR2(10), • Proj_Name VARCHAR2(50), • Budget NUMBER • ); • INSERT INTO Project VALUES ('P101', 'Alpha Development', 500000); • INSERT INTO Project VALUES ('P102', 'Beta Testing', 300000); • INSERT INTO Project VALUES ('P103', 'Gamma Launch', 400000);
  • 7. Works_On Table • CREATE TABLE Works_On ( • Emp_ID VARCHAR2(10), • Proj_ID VARCHAR2(10), • Hours_Worked NUMBER • ); • INSERT INTO Works_On VALUES ('E001', 'P101', 35); • INSERT INTO Works_On VALUES ('E002', 'P102', 40); • INSERT INTO Works_On VALUES ('E003', 'P101', 30); • INSERT INTO Works_On VALUES ('E001', 'P103', 20);
  • 9. Types of Functional Dependencies • Trivial Functional Dependency • Non-Trivial Functional Dependency • Partial Functional Dependency • Full Functional Dependency • Transitive Functional Dependency
  • 10. Types of Functional Dependencies • 1. Trivial Functional Dependency - A dependency where an attribute is functionally dependent on itself or a subset of attributes. • Example:Emp_ID, Proj_ID → Emp_ID Here, Emp_ID is trivially dependent on (Emp_ID, Proj_ID). SELECT Emp_ID, Emp_ID FROM Employee GROUP BY Emp_ID;
  • 11. Non-Trivial Functional Dependency • When an attribute is functionally dependent on a combination of other attributes, and it’s not a trivial dependency. • Example: Emp_ID → Dept • Employee ID determines the department, which is non-trivial because Dept is not part of the primary key. • SELECT Emp_ID, Emp_Name • FROM Employee • GROUP BY Emp_ID, Emp_Name;
  • 12. Partial Functional Dependency • A non-prime attribute is functionally dependent on part of a candidate key. • Example:(Emp_ID, Proj_ID) → Emp_NameIn the Works On table, if Emp_ID is part of the composite key, but Emp_Name depends only on Emp_ID. • SELECT Proj_ID, SUM(Hours_Worked) • FROM Works_On • GROUP BY Proj_ID;
  • 13. Full Functional Dependency • A non-prime attribute depends on the full composite key and not just a part of it. • Example: (Emp_ID, Proj_ID) → Hours_Worked • Hours worked by an employee depends on both the employee and the project. • SELECT Emp_ID, Proj_ID, Hours_Worked • FROM Works_On • GROUP BY Emp_ID, Proj_ID, Hours_Worked;
  • 14. Transitive Functional Dependency • When one attribute depends on another through a third attribute. • Example: Emp_ID → Dept and Dept → Manager • Therefore, Emp_ID → Manager (transitive dependency). • CREATE TABLE Department • ( Dept_ID VARCHAR2(10), Dept_Name VARCHAR2(50), Manager_ID VARCHAR2(10) ); • INSERT INTO Department VALUES ('D01', 'Development', 'M001’); • INSERT INTO Department VALUES ('D02', 'Testing', 'M002');
  • 15. Transitive Functional Dependency • -- Transitive Dependency Query • SELECT E.Emp_ID, D.Manager_ID • FROM Employee E • JOIN Department D ON E.Dept_ID = D.Dept_ID;
  • 16. Inference Rules (Armstrong’s Axioms) • Reflexivity Rule If Y is a subset of X, then X → Y. • Example: Emp_ID → Emp_ID SELECT Emp_ID, Emp_Name FROM Employee GROUP BY Emp_ID, Emp_Name;
  • 17. Inference Rules (Armstrong’s Axioms) • Augmentation Rule If X → Y, then XZ → YZ (adding additional attributes does not affect the dependency). Example: Emp_ID → Emp_Name implies (Emp_ID, Proj_ID) → (Emp_Name, Proj_ID) • SELECT Emp_ID, Emp_Name, Proj_ID • FROM Employee E • JOIN Works_On W ON E.Emp_ID = W.Emp_ID;
  • 18. Inference Rules • Transitivity Rule If X → Y and Y → Z, then X → Z. • Example: Emp_ID → Dept and Dept → Manager implies • Emp_ID → Manager • SELECT E.Emp_ID, D.Manager_ID • FROM Employee E • JOIN Department D ON E.Dept_ID = D.Dept_ID;
  • 19. Inference Rules • Decomposition Rule If X → YZ, then X → Y and X → Z. • Example: (Emp_ID, Proj_ID) → (Emp_Name, Hours_Worked) implies Emp_ID → Emp_Name and (Emp_ID, Proj_ID) → Hours_Worked • SELECT Emp_ID, Emp_Name, Salary • FROM Employee • GROUP BY Emp_ID, Emp_Name, Salary;
  • 20. Inference Rules • Union Rule If X → Y and X → Z, then X → YZ. • Example: Emp_ID → Emp_Name and Emp_ID → Dept implies Emp_ID → (Emp_Name, Dept) • SELECT Emp_ID, Emp_Name, Salary • FROM Employee • GROUP BY Emp_ID, Emp_Name, Salary;
  • 21. Inference Rules • Pseudo-Transitivity Rule If X → Y and WY → Z, then WX → Z. • Example: Emp_ID → Dept and (Proj_ID, Dept) → Manager • implies (Emp_ID, Proj_ID) → Manager • SELECT W.Emp_ID, W.Proj_ID, P.Budget • FROM Works_On W • JOIN Project P ON W.Proj_ID = P.Proj_ID;
  • 22. Case Study- Normalizing Works_On Table • Issue: Emp_Name repeats for the same Emp_ID. • Solution: First Normal Form (1NF): Already satisfied (atomic values). • Second Normal Form (2NF): Remove partial dependencies. • Separate Emp_Name into Employee table.