unit 6 Dbms
unit 6 Dbms
Functional Dependency
The functional dependency is a relationship that exists between two attributes.
It typically exists between the primary key and non-key attribute within a table.
Key Terms
Multivalued Dependency
o Multivalued dependency occurs when two attributes in a table are
independent of each other but, both depend on a third attribute.
o A multivalued dependency consists of at least two attributes that are
dependent on a third attribute that's why it always requires at least three
attributes.
Example:
BIKE_MODEL → → MANUF_YEAR
BIKE_MODEL → → COLOR
Join dependency:
A join dependency in a database occurs when a table can be divided into multiple
smaller tables, and those smaller tables can be joined back together to recreate the
original table without losing any information.
Example:
Student Course Instructor
John Math Dr. Smith
John Math Dr. Brown
John Science Dr. White
Mary Math Dr. Smith
Mary Science Dr. White
Student Course
John Math
John Science
Mary Math
Mary Science
Table 2: Course-Instructor
Course Instructor
Math Dr. Smith
Math Dr. Brown
Science Dr. White
Anomalies can cause issues with data accuracy, consistency, and integrity.
Insertion Anomaly: You can’t add new data unless other data is also added.
Deletion Anomaly: Deleting some data also removes other important information.
Redundancy: Storing duplicate data, which wastes space and can cause mistakes.
Normalization:
Normalization in a Database Management System (DBMS) is the process of
organizing data to reduce redundancy (duplicate data) and improve data integrity.
Advantages of Normalization
It must be in 1NF, and all non-key attributes must depend fully on the
primary key (eliminates partial dependencies).
Not in 2NF:
Here, Course_Name and Instructor only depend on Course_ID, not the whole
composite key.
Table 1 (Student-Course):
Student_ID Course_ID
1 101
1 102
Table 2 (Course-Details):
Example:
Not in 3NF:
Table 1 (Student-Course):
Table 2 (Instructor-Department):
Instructor Department
Mr. Brown Science
Example
Functional Dependencies:
Here, Course is not a superkey, but it determines Instructor. This violates BCNF
because every determinant must be a superkey.
Converting to BCNF
Course-Instructor Table:
Course Instructor
Math Mr. Brown
Science Dr. Smith
Student-Course Table:
Student_ID Course
1 Math
2 Math
3 Science
4 Science
A transaction state refers to the different stages a transaction goes through during
its execution.
These stages help track its progress and determine if it’s completed successfully or
if it needs to be rolled back.
Active: The transaction is being processed, and actions are still being performed.
Partially Committed: The transaction has finished its operations, but the changes
are not yet final.
Committed: The transaction is successful, and all changes are saved permanently
to the database.
Aborted: Something went wrong, and the transaction is canceled. All changes are
undone.