Docsity

Functional Dependencies and Normal Forms in Database Systems, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Functional Dependencies and Normal Forms in Database Systems and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

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

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

LetR be a relation schema where

ฮฑ โІ R and ฮฒ โІ R

The functional dependency

ฮฑ โ†’ ฮฒ

Holds on R if and only if for any legal relationsr (R), whenever any two tuples t 1

and t 2 ofr agree on the attributes ฮฑ they also agree on the attributes ฮฒ. That

is, t 1 [ฮฑ] = t 2 [ฮฑ] โ‡’ t 1 [ ฮฒ ] = t 2 [ ฮฒ ]

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

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

Functional Dependencies between Attributes

๏ฌ Functionally Dependencies

Example

Functional Dependencies in Schemas

Employee: (EmpID, Name, Phone, Position)

EmpID โ†’ Name, Phone, Position

Position โ†’ Phone

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

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

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