dbms unit 3
dbms unit 3
Student-Course Table
Student_ID Course
101 Math
102 Science
Course-Instructor Table
Course Instructor
Math Mr. Smith
Science Ms. Jane
Employee Table
Department Table
Department Department_Location
HR 2nd Floor
IT 3rd Floor
Teacher-Subject Table:
Teacher Subject
Mr. A Math
Mr. B Physics
Mr. C History
Subject-Department Table:
Subject Department
Math Science
Physics Science
History Arts
Student-Course Table:
Student_ID Course
101 Math
101 Science
Student-Hobby Table:
Student_ID Hobby
101 Chess
101 Music
Now, no redundancy!
Final Thought
If you're just starting, learning up to 3NF or BCNF is usually enough for
most databases! �
Would you like me to explain any part in even simpler terms? �
All functional dependencies from the original relation are still enforced in
the decomposed tables.
The lossless join property is maintained (so no data is lost when joining
the tables back).
Definition
A multivalued dependency (MVD) exists in a relation R(A, B, C) if:
It is represented as:
A ⇝ B (A multidetermines B)
This means that for each value of A, there can be multiple values of B,
and multiple values of C, but B and C are independent of each other.
Join Dependency (JD)
� A table has a Join Dependency if it can be split into two or more tables,
and when joined back, it gives the original table without extra or missing
records.
� Definition:
In simpler terms, DKNF ensures that all business rules and constraints are
enforced using domain restrictions and keys, without relying on
additional functional dependencies.
✅ Example:
StudentID (PK) Name Age
101 John 20
102 Emma 22
� StudentID is the Primary Key because:
✔ It is unique for every student.
✔ It doesn’t allow NULL values.
A Foreign Key is a column in one table that refers to the Primary Key of
another table.
✅ Example:
Student Table:
StudentID (PK) Name Age
101 John 20
102 Emma 22
Course Table:
CourseID (PK) CourseName StudentID (FK)
C101 Math 101
C102 Science 102
� StudentID in the Course Table is a Foreign Key because it links to the
StudentID in the Student Table.
A table can have multiple Candidate Keys, but only one is chosen as the
Primary Key.
✅ Example:
EmployeeID Email Phone Name
E001 [email protected] 9876543210 John
E002 [email protected] 8765432109 Emma
� Possible Candidate Keys:
A Super Key is any set of columns that can uniquely identify a row.
Every Primary Key and Candidate Key is a Super Key, but not every
Super Key is a Candidate Key.
Super Key can have extra unnecessary columns along with the unique
column.
✅ Example:
EmployeeID Email Phone Name
E001 [email protected] 9876543210 John
E002 [email protected] 8765432109 Emma
� Super Keys:
✔ (EmployeeID) – Minimal, so it’s a Candidate Key too.
✔ (Email) – Minimal, so it’s a Candidate Key too.
✔ (Phone) – Minimal, so it’s a Candidate Key too.
✔ (EmployeeID, Name) – Not minimal, because Name is unnecessary.
✔ (Email, Phone) – Not minimal, because one of them alone is enough.
Summary:
Key Type Definition Example