Download presentation
Presentation is loading. Please wait.
Published byDora Rice Modified over 9 years ago
1
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008
2
Agenda 5.1 – Functional Dependencies Between Attributes Superkeys and Keys Inferring Functional Dependencies Determining Keys from Functional Dependencies 5.2 – Normal Forms 1 st Normal Form 2 nd Normal Form 3 rd Normal Form Boyce Codd Normal Form
3
Functional Dependencies between Attributes Functionally Dependent An attribute B is functionally dependent on an attribute A in a relational table if the value of A uniquely determines the value of B We can also say that A determines B A B Formal Definition of Functional Dependencies Let R be a relation schema where R and R The functional dependency Holds on R if and only if for any legal relations r (R), whenever any two tuples t 1 and t 2 of r agree on the attributes they also agree on the attributes . That is, t 1 [ ] = t 2 [ ] t 1 [ ] = t 2 [ ]
4
Functional Dependencies between Attributes Superkeys and Keys A superkey of a relation schema is a set of attributes that functionally determines all other attributes of the table A set of attributes A is a key of a relation schema if A is a superkey and any proper subset of A is not a superkey An attribute that is part of any key of the schema is called a prime attribute and an attribute that is not part of any key is a non-prime attribute
5
Functional Dependencies between Attributes Inferring Functional Dependencies Inference process help us find functional dependencies in a relation, there are six rules: Reflexivity:If X Y, then X Y Augmentation:If X Y, then XZ YZ Transitivity:If X Y and Y Z, then X Z Decomposition: If X YZ, then X Y Union:If X Y and X Z, then X YZ Pseudo-transitivity:If X Y and WX Z, then WX Z Let W,X,Y, and Z be sets of functional dependencies and XY is the union of X and Y The first three are known as Armstrong's Axioms which was used to derive the later rules as well
6
Functional Dependencies between Attributes Determining Keys from Functional Dependencies Left side of a functional dependency is the determinant and the right side is known as the dependent Formal Definition of the keys of a schema Suppose S is a schema that is specified as a set of attributes A and a set of functional dependencies F. Let F + be the closure of the functional dependencies defined for S. A set of attributes X is a key of S if and only if X A- X is in F + and for each Y ⊂ X, Y X is not in F + If a functional dependency X Z includes all of the attributes of the schema, then X is a superkey
7
Functional Dependencies between Attributes Functionally Dependencies Example #1 Functional Dependency defined on the attributes X and Y Would read the relationship as “X determines Y” or “X Y” All the tuples in X that agree on X must also agree on Y
8
Functional Dependencies between Attributes Functionally Dependencies Example #2 Functional Dependencies in Schemas Employee: (EmpID, Name, Phone, Position) EmpID Name, Phone, Position Position Phone
9
Normal Forms Normalization Normalization is the process of transforming some objects into a structural form that satisfies some collection of rules Used to reduce update anomalies and redundancy A database schema is said to be in normal form if each of its relation schemas is in the normal form A dependency X Y is a full dependency if Y is not dependent on any subset of X A dependency X Y is a maximal dependency if there is no attribute A not in X or Y such that X ∪ Y {A} A dependency X Y is a trivial dependency if at least one attribute is part of both sides, that is, where X ∩ Y is not empty
10
Normal Forms First Normal Form: Atomic Attributes The first normal form specifies that every attribute of a schema must takes its values from an atomic domain Not in First Normal Form First Normal Form
11
Normal Forms Second Normal Form: No Partial Key Dependencies The second normal form is designed to eliminate functional dependencies that have part of a key on the left side It is in second normal form if no non-prime attributes are partially dependent on any key of the schema and it is in (1NF) Not in Second Normal Form Employee: (Emp_ID, Course_Title, Name, Dept_Name, Salary, Date_Completed) Not fully functionally dependent on the primary key
12
Normal Forms Third Normal Form: No Transitive Dependencies A schema is in third normal form if it has no transitive dependencies and it is in (2NF) A transitive dependency of X Y is a transitive dependency if there is a set of attributes Z that is not a subset of any key and both X Z and Z Y Must be dependent on the key this is not 3NF
13
Normal Forms Boyce-Codd Normal Form: No Non-Key Dependencies It is similar to (3NF) but the table is in Boyce-Codd Normal Form if it has no non-key dependencies Not in Boyce-Codd Normal Form Supplier: (supplierID, supplierName, street, zipcode) Functional Dependencies: {supplierID, zipcode} supplierName, street *Candidate Key {supplierName, zipcode} supplierID, street *Candidate Key supplierName supplierID supplierID supplierName These are in (3NF) since they are part of the prime attributes but are not BCNF since supplierID supplierName isn't satisfied BCNF would be broken into Supplier:(supplierID, street, zipcode) SupplierName:(supplierID, supplierName)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.