Database Presentation 1
Database Presentation 1
-Definition: A functional dependency occurs when one attribute (or a set of attributes) uniquely
determines another attribute (or set of attributes). This means that if you know the value of one
attribute, you can determine the value of another attribute.
- In this case:
- `StudentID -> StudentName`: The StudentID uniquely determines the StudentName. Knowing
the `StudentID` (say `101`), you can determine that the student's name is "John Doe."
- `CourseID -> CourseName`: The CourseID uniquely determines the CourseName. If you know the
`CourseID` (say `C001`), you can determine that the course is "Math."
- In this case:
- The composite key is `{StudentID, CourseID}` (both are needed to uniquely identify a record).
- `StudentID, CourseID -> Instructor`: The combination of StudentID and CourseID determines the
Instructor. For example, `101, C001` will always result in "Dr. Smith."
- `StudentID, CourseID -> Semester`: The combination of StudentID and CourseID determines the
Semester. For example, `101, C002` will result in "Spring."
- The dependency holds for the entire key `{StudentID, CourseID}` because no part of the key (just
`StudentID` or `CourseID`) can determine the Instructor or Semester alone.
- If `StudentID` alone could determine the `Instructor`, it would be a partial dependency and
would violate the principle of full functional dependency.
3. Transitive Dependency:
Definition: A transitive dependency occurs when one attribute depends on another through a third
attribute. If `A -> B` and `B -> C`, then by transitivity, `A -> C`. Transitive dependencies often lead to
redundancy in the database.
- Here:
- `EmpID -> DeptID`: Each employee is associated with a department. For example, `101 -> D001`
means Employee `John` is in the HR department.
- `DeptID -> DeptName`: The DeptID uniquely determines the department name. For example,
`D001 -> HR`.
- `DeptID -> DeptLocation`: The DeptID also determines the department's location. For example,
`D001 -> New York`.
- By transitivity, we have:
- `EmpID -> DeptName`: Knowing the EmpID indirectly gives us the DeptName because `EmpID ->
DeptID` and `DeptID -> DeptName`.
- `EmpID -> DeptLocation`: Similarly, knowing the EmpID also gives us the DeptLocation.
- Redundancy: This transitive dependency can lead to redundant data (e.g., the department's name
and location are repeated for each employee in the same department). We can resolve this by
normalizing the database (e.g., separating the department information into a separate table).
- Definition: A multi-valued dependency occurs when one attribute (or set of attributes) determines
a set of independent values for another attribute. These values do not depend on each other but are
associated with the same entity.
- Here:
- `StudentID ->> Hobby`: The StudentID determines a set of hobbies (e.g., Student `101` has
hobbies `Tennis` and `Reading`).
- `StudentID ->> Course`: The StudentID also determines a set of courses (e.g., Student `101` is
taking `Math` and `History`).
-Multi-valued Dependency: The StudentID determines two independent sets of values—one for
Hobby and one for **Course**. The values for Hobby and Course do not depend on each other, but
they are both dependent on StudentID
---
Summary of Dependencies:
Full Functional Dependency: The entire primary key determines an attribute, not just part of it.
-Multi-valued Dependency (MVD): One attribute determines multiple independent sets of values.
Each of these concepts helps in organizing data and minimizing redundancy during database
normalization, leading to a more efficient and reliable database design.