Computer Science – 8.1 Database Concepts | e-Consult
8.1 Database Concepts (1 questions)
Answer:
Dependency in database normalization refers to the relationship between attributes in a table. Specifically, an attribute is functionally dependent on another attribute if the value of the dependent attribute can be determined from the value of the determinant attribute. This is often written as X -> Y, meaning X functionally determines Y.
In the Students table:
- StudentID -> Name: The student's name is determined by their StudentID.
- StudentID -> Major: The student's major is determined by their StudentID.
- StudentID -> Department: The student's department is determined by their StudentID.
These dependencies relate to normalization because they indicate redundancy. Storing the major and department for each student repeatedly is inefficient and can lead to inconsistencies. If a student changes their major or department, we would need to update multiple rows.
To normalize the Students table to 3NF, we would decompose it into three tables:
Table 1: Students
- StudentID (Primary Key)
- Name
Table 2: Majors
- MajorID (Primary Key)
- MajorName
Table 3: Departments
- DepartmentID (Primary Key)
- DepartmentName
Table 4: StudentMajors
- StudentID (Foreign Key referencing Students)
- MajorID (Foreign Key referencing Majors)
Table 5: StudentDepartments
- StudentID (Foreign Key referencing Students)
- DepartmentID (Foreign Key referencing Departments)
This decomposition eliminates redundancy and ensures data integrity. Each table represents a distinct entity, and the relationships between them are maintained through foreign keys.