Week 5 Flashcards
What is Normalization?
Technique for producing a set of relations with desired properties
Remove redundancy
Remove potential for insertion, modification and deletion anomalies
What is an Insertion Anomaly?
An issue in relational databases when inserting data causes unnecessary redundancy or requires irrelevant information to be added
Cause: Occurs in poorly normalized tables, where adding new data (e.g., a student) forces the inclusion of unnecessary data (e.g., course or instructor details)
Impact: Leads to data redundancy, inconsistency, and maintenance difficulties
Fix: Normalize the database by separating data into related tables (e.g., Student, Course, Instructor) and using foreign keys to link them
What is a Modification Anomaly?
An issue in relational databases where updates (insert, delete, or modify) cause inconsistency or redundancy
Cause: Occurs in poorly normalized tables, where adding new data (e.g., a student) forces the inclusion of unnecessary data (e.g., course or instructor details)
Impact: Leads to data redundancy, inconsistency, and maintenance difficulties
Fix: Normalize the database by separating data into related tables (e.g., Student, Course, Instructor) and using foreign keys to link them
What is a Deletion Anomaly?
An issue in relational databases where deleting data causes unintended loss of other important data.
Cause: Occurs in poorly normalized tables, where multiple types of information are stored together, leading to unintended deletions
Impact: Important data might be lost when deleting a record (e.g., removing a student also deletes course information)
Fix: Normalize the database to separate data into related tables, ensuring deletion of one record doesn’t affect others
What is Functional Dependancy?
If A and B are attributes of relation R, if each value A is associated with exactly one value of B, B is said to be functionally dependant (FD) on A
Denoted A->B
A is the determinant
eg.
Student(studentID, studentName, DoB, postcode, city)
city is functionally dependant on postcode
postcode is the determinant
What is Transitive Dependancy?
If A->B and B->C, then C is transitive dependant on A via A->C
What is Partial Functional Dependancy?
Given A->B, if removing some attribute(s) from A, the dependancy still holds
What is Full Functional Dependancy?
If A->B and B is not functionally dependant on any subset of A
What is 1st Normal Form?
Remove repeating groups
What is 2nd Normal Form?
Remove partial dependancies
What is 3rd Normal Form?
Remove transitive dependancies
What is Boyce-Codd Normal Form (also called 3.5 NF)?
A stricter version of the 3rd Normal Form (3NF) that eliminates certain types of redundancy in relational databases.
Definition: A table is in BCNF if, for every non-trivial functional dependency, the left side (determinant) is a candidate key
Key Concept: In BCNF, no non-key attribute can determine another non-key attribute
Purpose: Prevents anomalies by ensuring that every determinant is a candidate key, reducing redundancy and improving data integrity
Example: If A → B (A determines B), and A is not a candidate key, the table is not in BCNF
What is Algebra?
In its most general form, algebra is the study of mathematical symbols and the rules for manipulating these symbols
What is Relational Algebra?
An Algebra whose operands are relations
Relation -> Relational Operator -> A new Relation
How does Relational Algebra help with us databases?
Relational algebra provides a means to query a means to query the data in a database and to modify the data
SQL incorporates relational algebra