DOC PREVIEW
UT Dallas CS 6360 - Ch15_FDs-NormalForms

This preview shows page 1-2-3-21-22-23-42-43-44 out of 44 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 44 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 15 Functional Dependencies and Normalization for Relational Databases Chapter Outline 1 Informal Design Guidelines for Relational Databases 1 1 Semantics of the Relation Attributes 1 2 Redundant Information in Tuples and Update Anomalies 1 3 Null Values in Tuples 1 4 Spurious Tuples 2 Functional Dependencies FDs 2 Chapter Outline 3 Normal Forms Based on Primary Keys 3 1 Normalization of Relations 3 2 Practical Use of Normal Forms 3 3 Definitions of Keys and Attributes Participating in Keys 3 4 First Normal Form 3 5 Second Normal Form 3 6 Third Normal Form 4 General Normal Form Definitions For Multiple Keys 5 BCNF Boyce Codd Normal Form 3 Informal Design Guidelines for Relational Databases 1 What is relational database design Two levels of relation schemas The grouping of attributes to form good relation schemas The logical user view level The storage base relation level Design is concerned mainly with base relations What are the criteria for good base relations 4 Informal Design Guidelines for Relational Databases 2 We first discuss informal guidelines for good relational design Then we discuss formal concepts of functional dependencies and normal forms 1NF First Normal Form 2NF Second Normal Form 3NF Third Normal Form BCNF Boyce Codd Normal Form 5 Semantics of the Relation Attributes GUIDELINE 1 Informally each tuple in a relation should represent one entity or relationship instance Applies to individual relations and their attributes Attributes of different entities EMPLOYEEs DEPARTMENTs PROJECTs should not be mixed in the same relation Only foreign keys should be used to refer to other entities Entity and relationship attributes should be kept apart as much as possible Bottom Line Design a schema that can be explained easily relation by relation The semantics of attributes should be easy to interpret 6 A simplified COMPANY relational database schema Redundant Information in Tuples and Update Anomalies Information is stored redundantly Wastes storage Causes problems with update anomalies Insertion anomalies Deletion anomalies Modification anomalies 8 EXAMPLE OF AN UPDATE ANOMALY Consider the relation EMP PROJ Emp Proj Ename Pname No hours Update Anomaly Changing the name of project number P1 from Billing to Customer Accounting may cause this update to be made for all 100 employees working on project P1 9 EXAMPLE OF AN INSERT ANOMALY Consider the relation Insert Anomaly EMP PROJ Emp Proj Ename Pname No hours Cannot insert a project unless an employee is assigned to it Conversely Cannot insert an employee unless a he she is assigned to a project 10 EXAMPLE OF AN DELETE ANOMALY Consider the relation EMP PROJ Emp Proj Ename Pname No hours Delete Anomaly When a project is deleted it will result in deleting all the employees who work on that project Alternately if an employee is the sole employee on a project deleting that employee would result in deleting the corresponding project 11 Two relation schemas suffering from update anomalies 12 Base Relations EMP DEPT and EMP PROJ formed after a Natural Join with redundant information 13 Guideline to Redundant Information in Tuples and Update Anomalies GUIDELINE 2 Design a schema that does not suffer from the insertion deletion and update anomalies If there are any anomalies present then note them so that applications can be made to take them into account 14 Null Values in Tuples GUIDELINE 3 Relations should be designed such that their tuples will have as few NULL values as possible Attributes that are NULL frequently could be placed in separate relations with the primary key Reasons for nulls Attribute not applicable or invalid Attribute value unknown may exist Value known to exist but unavailable 15 Spurious Tuples Bad designs for a relational database may result in erroneous results for certain JOIN operations The lossless join property is used to guarantee meaningful results for join operations GUIDELINE 4 The relations should be designed to satisfy the lossless join condition No spurious tuples should be generated by doing a natural join of any relations 16 Spurious Tuples 2 There are two important properties of decompositions a b Non additive or losslessness of the corresponding join Preservation of the functional dependencies Note that Property a is extremely important and cannot be sacrificed Property b is less stringent and may be sacrificed Chapter 16 17 2 1 Functional Dependencies 1 Functional dependencies FDs Are used to specify formal measures of the goodness of relational designs And keys are used to define normal forms for relations Are constraints that are derived from the meaning and interrelationships of the data attributes A set of attributes X functionally determines a set of attributes Y if the value of X determines a unique value for Y 18 Functional Dependencies 2 X Y holds if whenever two tuples have the same value for X they must have the same value for Y For any two tuples t1 and t2 in any relation instance r R If t1 X t2 X then t1 Y t2 Y X Y in R specifies a constraint on all relation instances r R Written as X Y can be displayed graphically on a relation schema as in Figures denoted by the arrow FDs are derived from the real world constraints on the attributes 19 Examples of FD constraints 1 Social security number determines employee name Project number determines project name and location SSN ENAME PNUMBER PNAME PLOCATION Employee ssn and project number determines the hours per week that the employee works on the project SSN PNUMBER HOURS 20 Examples of FD constraints 2 An FD is a property of the attributes in the schema R The constraint must hold on every relation instance r R If K is a key of R then K functionally determines all attributes in R since we never have two distinct tuples with t1 K t2 K 21 FD s are a property of the meaning of data and hold at all times certain FD s can be ruled out based on a given state of the database 22 Normal Forms Based on Primary Keys 3 1 Normalization of Relations 3 2 Practical Use of Normal Forms 3 3 Definitions of Keys and Attributes Participating in Keys 3 4 First Normal Form 3 5 Second Normal Form 3 6 Third Normal Form 23 Normalization of Relations 1 Normalization The process of decomposing unsatisfactory bad relations by breaking up their attributes into smaller relations Normal form Condition using keys and FDs of a relation to certify whether a relation schema is in a particular normal form 24 Normalization of Relations 2 2NF 3NF BCNF based on keys and FDs


View Full Document

UT Dallas CS 6360 - Ch15_FDs-NormalForms

Documents in this Course
Ch22(1)

Ch22(1)

44 pages

Ch21

Ch21

38 pages

Ch19

Ch19

46 pages

Ch18

Ch18

25 pages

Ch17

Ch17

21 pages

Ch15

Ch15

42 pages

Ch09

Ch09

42 pages

Ch05

Ch05

34 pages

Ch22

Ch22

45 pages

Ch21

Ch21

38 pages

Ch19

Ch19

48 pages

Ch18

Ch18

24 pages

Ch17

Ch17

22 pages

Ch16

Ch16

17 pages

Ch15

Ch15

42 pages

Ch09

Ch09

42 pages

Ch08

Ch08

39 pages

Ch07

Ch07

34 pages

Ch06

Ch06

43 pages

Ch05

Ch05

34 pages

Ch04

Ch04

39 pages

Ch03(2)

Ch03(2)

36 pages

Ch02

Ch02

33 pages

Ch08

Ch08

28 pages

Ch07

Ch07

31 pages

Ch06

Ch06

43 pages

Ch05

Ch05

39 pages

Ch04(1)

Ch04(1)

39 pages

Ch03(1)

Ch03(1)

38 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch24

Ch24

36 pages

Ch21

Ch21

54 pages

Ch19

Ch19

48 pages

Ch18

Ch18

24 pages

Ch17

Ch17

22 pages

Ch03(1)

Ch03(1)

38 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch24

Ch24

36 pages

Ch21

Ch21

54 pages

Ch19

Ch19

48 pages

Ch18

Ch18

24 pages

Ch17

Ch17

22 pages

Ch08

Ch08

28 pages

Ch07

Ch07

31 pages

Ch06

Ch06

43 pages

Ch05

Ch05

39 pages

Ch04(1)

Ch04(1)

39 pages

Ch08

Ch08

39 pages

Ch07

Ch07

40 pages

Ch06

Ch06

47 pages

Ch05

Ch05

41 pages

Ch04

Ch04

43 pages

Ch03

Ch03

41 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch18

Ch18

24 pages

Ch08

Ch08

39 pages

Ch07

Ch07

40 pages

Ch06

Ch06

47 pages

Ch05

Ch05

41 pages

Ch04

Ch04

43 pages

Ch03

Ch03

41 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch18

Ch18

24 pages

Ch17

Ch17

25 pages

lab-manual

lab-manual

215 pages

Ch08

Ch08

39 pages

Ch07

Ch07

40 pages

Ch06

Ch06

47 pages

Ch05

Ch05

41 pages

Ch04

Ch04

43 pages

Ch03

Ch03

41 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch17

Ch17

25 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch18

Ch18

24 pages

Ch17

Ch17

25 pages

Ch08

Ch08

39 pages

Ch07

Ch07

40 pages

Ch06

Ch06

47 pages

Ch05

Ch05

41 pages

Ch04

Ch04

43 pages

Ch03

Ch03

41 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Ch04(1)

Ch04(1)

43 pages

Ch07

Ch07

40 pages

Ch03

Ch03

42 pages

Ch01

Ch01

36 pages

Ch02

Ch02

38 pages

Ch05

Ch05

41 pages

Ch06

Ch06

47 pages

Ch08

Ch08

39 pages

Ch17

Ch17

25 pages

Ch18

Ch18

24 pages

Ch09

Ch09

42 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch21

Ch21

54 pages

Ch19

Ch19

51 pages

Ch18

Ch18

24 pages

Ch17

Ch17

25 pages

Ch09

Ch09

42 pages

Ch08

Ch08

39 pages

Ch07

Ch07

40 pages

Ch06

Ch06

47 pages

Ch05

Ch05

41 pages

Ch04(1)

Ch04(1)

43 pages

Ch03

Ch03

42 pages

Ch02

Ch02

38 pages

Ch01

Ch01

36 pages

Load more
Download Ch15_FDs-NormalForms
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Ch15_FDs-NormalForms and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Ch15_FDs-NormalForms and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?