Module 3 DBMS 4th Sem B.Tech CSE
Module 3 DBMS 4th Sem B.Tech CSE
Kalundia
DATABASE MANAGEMENT SYSTEM Assistant Professor
MODULE III Dept. of Computer Sc. & Engg.
Amity University, Jharkhand
MODULE III: RELATIONAL DATABASE DESIGN
•Problem: If a new instructor Dr. Singh is hired to teach a new course CSE103,
but no student has enrolled in that course yet, we cannot insert the instructor's
details because the table structure requires a Student_ID for each row.
Example: School Database where student and teacher information is stored in the same table:
Issue:
If all students from Class 5A leave the school, their records are deleted.
•Unintended Loss: Since Mr. Sharma's details are stored only in student records, deleting all students from Class
5A also removes information about Mr. Sharma, even though he is still a teacher at the school.
•Problem: The school loses track of Mr. Sharma just because no students are currently assigned to him.
Solution:
•Create separate tables for Teachers and Students, ensuring that deleting students does not remove teacher
data.
C) Updatation Anomaly: The update anomaly is when an update of a single data value requires
multiple rows of data to be updated.
Company Database where employee and department details are stored in the same table:
Employee_ID Employee_Name Department_ID Department_Name Manager_Name
101 Rahul D1 HR Mr. Sharma
102 Priya D1 HR Mr. Sharma
103 Aman D2 IT Ms. Verma
Issue:
If Mr. Sharma (HR Manager) is replaced by Mr. Gupta, we must update every row where HR department is
listed.
•Unintended Consequence: Since Mr. Sharma’s name appears multiple times, updating the manager’s name
requires modifying multiple records.
•Risk of Inconsistency: If we miss updating one row, some employees will still show Mr. Sharma as their
manager while others will have Mr. Gupta.
Solution:
•Normalize the database by storing Departments and Employees in separate tables.
2. Difficulty in managing relationships:
It becomes more challenging to maintain complex relationships in an unnormalized structure.
Solution:
•Normalize the database by creating separate Tables for Students & Courses.
•This reduces redundancy and simplifies queries.
3. Data Dependency issue:
Other factors that drive the need for normalization are partial dependencies and transitive
dependencies, in which partial dependencies can lead to data redundancy and update
anomalies, and transitive dependencies can lead to data anomalies.
FUNCTIONAL DEPENDENCY IN DBMS
❑The core concepts behind database
normalization are based on functional
dependencies.
❑Functional Dependency is the relationship
between attributes(characteristics) of a table
related to each other.
❑Functional dependencies help in identifying
unique relationships between attributes. (If we know A, we can determine B)
R (ABCD)
A → BCD
For the first functional dependency A → BCD, attributes B,
C and D are functionally dependent on attribute A.
B → CD
Function dependency B → CD has two
attributes C and D functionally depending upon
attribute B.
Types of Functional Dependencies in DBMS
1. Trivial Functional Dependency
2. Non-Trivial Functional Dependency
3. Full Functional Dependency
4. Partial Functional Dependency
5. Transitive Functional Dependency
6. Multivalued Dependency (MVD)
7. Join Dependency
Impact on Normalization (Breaking 2NF Rule) - Partial Functional Dependency leads to redundancy
and should be removed in 2NF.
Impact on Normalization : Causes redundancy and is removed in 3NF (Third Normal Form).
6. Multivalued Dependency (MVD)
• A Multivalued Dependency (MVD) exists when for a single value of X, multiple values of Y exist but are
independent of third attribute Z. Given a relation R with attributes X,Y, and Z : -
• It is denoted as: X↠Y (read as X multidetermines Y) relates one value of X to many values of Y but
independent of values of Z. (where Z = all other attributes in the table apart from X and Y).
A Join Dependency exists if we can split this table into smaller relations:
1.Emp_Projects (Emp_ID, Project_ID) - Stores which employees are assigned to which projects.
2.Emp_Skills (Emp_ID, Skill) - Stores which skills each employee has.
Such that when we join these tables back on Emp_ID, we obtain the original Project table without any
loss of information.
Impact on Normalization : Ensures lossless decomposition and is used in 5NF (Fifth Normal Form).
Types of Normal Forms (Database Normalization Techniques)
Normalization works through a series of stages called Normal forms. The normal forms apply to
individual relations. The relation is said to be in particular normal form if it satisfies constraints.
There are six normal forms commonly used. Each Normal Form (NF) is a step in this process,
with stricter rules as we move higher.
Problem:
•Roll_No → Dept
•Dept → HOD
•Transitive Dependency: Roll_No → HOD
Problem:
•Professor → Department (FD exists, but Professor is not a candidate key)
After BCNF (Splitting into separate tables)
Professor Table: Course Table:
Professor Department Professor Course
Dr. Rao CSE Dr. Rao DBMS
Now, the table follows BCNF.
Dr. Singh ECE Dr. Rao DS
Dr. Singh OS
Example: Student_Course
Emp_ID Project_ID
101 P1
101 P2
102 P1
102 P2
Table 2: Employee_Skill (Which skills each employee has) Table 3: Project_Skill (Which skills
are required for each project)
Emp_ID Skill
Project_ID Skill
101 Java
P1 Java
101 Python
P1 Python
102 Java
P2 Java
102 Python
END