CSE 544 Principles of Database Management Systems

Size: px
Start display at page:

Download "CSE 544 Principles of Database Management Systems"

Transcription

1 CSE 544 Principles of Database Management Systems Lecture 3 Schema Normalization CSE Winter

2 Announcements Project groups due on Friday First review due on Tuesday (makeup lecture) Run git pull to get the review subdirectory Place your review there Commit, push (see instructions in hw1.md); no need to tag Homework 1 due next Friday Run turninhw.sh hw1 Or manually: git commit..., git tag..., git push... CSE Winter

3 Database Design The relational model is great, but how do I design my database schema? CSE Winter

4 Outline Conceptual db design: entity-relationship model Problematic database designs Functional dependencies Normal forms and schema normalization CSE Winter

5 Conceptual Schema Design Conceptual Model: name Patient patien_of Doctor zip name dno Relational Model: plus FD s (FD = functional dependency) Normalization: Eliminates anomalies CSE Winter

6 Entity-Relationship Diagram Attributes Entity sets Relationship sets name Patient patient_of 6

7 Entity-Relationship Diagram Patient Doctor Attributes Entity sets Relationship sets name Patient patient_of 7

8 Entity-Relationship Diagram name pno dno Patient Doctor zip specialty name Attributes Entity sets Relationship sets name Patient patient_of 8

9 Entity-Relationship Diagram name pno dno Patient patient_of Doctor zip specialty name Attributes Entity sets Relationship sets name Patient patient_of 9

10 Entity-Relationship Diagram pno name since dno Patient patient_of Doctor zip specialty name Attributes Entity sets Relationship sets name Patient patient_of 10

11 Entity-Relationship Model Typically, each entity has a key ER relationships can include multiplicity One-to-one, one-to-many, etc. Indicated with arrows Many One Can model multi-way relationships Can model subclasses And more... CSE Winter

12 Subclasses to Relations price name category Product isa isa Software Product Educational Product platforms Age Group 12

13 Subclasses to Relations price name category Product Name Price Category Gizmo 99 gadget Product Camera 49 photo Toy 39 gadget isa isa Software Product Educational Product platforms Age Group 13

14 Subclasses to Relations price name category Product Name Price Category Gizmo 99 gadget Product Camera 49 photo Toy 39 gadget isa isa Sw.Product Name platforms Software Product Educational Product Gizmo unix platforms Age Group 14

15 Subclasses to Relations price name category Product Name Price Category Gizmo 99 gadget Product Camera 49 photo Toy 39 gadget isa isa Sw.Product Name platforms Software Product platforms Educational Product Age Group Gizmo Name unix Age Group Gizmo toddler Ed.Product Toy senior

16 General approach to Translating Diagram into Relations Each entity set becomes a relation with a key Each relationship set becomes a relation with foreign keys except many-one relationships: just add a fk Each isa relationship becomes another relation, with both a key and foreign key CSE Winter

17 Outline Conceptual db design: entity-relationship model Problematic database designs Functional dependencies Normal forms and schema normalization CSE Winter

18 Relational Schema Design Name SSN PhoneNumber City Fred Seattle Fred Seattle Joe Westfield One person may have multiple phones, but lives in only one city Primary key is thus (SSN, PhoneNumber) What is the problem with this schema? CSE Winter

19 Relational Schema Design Name SSN PhoneNumber City Fred Seattle Fred Seattle Joe Westfield Anomalies: Redundancy = repeat data for Fred Update anomalies = what if Fred moves to Bellevue? Deletion anomalies = what if Joe deletes his phone number? CSE Winter

20 Relation Decomposition Break the relation into two: Name SSN PhoneNumber City Fred Seattle Fred Seattle Joe Westfield Name SSN City Fred Joe Seattle Westfield SSN PhoneNumber Anomalies have gone: No more repeated data Easy to move Fred to Bellevue (how?) Easy to delete all Joe s phone numbers (how?) 20

21 Relational Schema Design (or Logical Design) How do we do this systematically? Start with some relational schema Find out its functional dependencies (FDs) Use FDs to normalize the relational schema CSE Winter

22 Functional Dependencies (FDs) Definition If two tuples agree on the attributes A 1, A 2,, A n then they must also agree on the attributes Formally: B 1, B 2,, B m A1 An determines B1..Bm A 1, A 2,, A n à B 1, B 2,, B m CSE Winter

23 Functional Dependencies (FDs) Definition A 1,..., A m à B 1,..., B n holds in R if: t, t R, (t.a 1 = t.a 1... t.a m = t.a m à t.b 1 = t.b 1... t.b n = t.b n ) R A 1... A m B 1... B n t t if t, t agree here then t, t agree here 23

24 Example An FD holds, or does not hold on an instance: EmpID Name Phone Position E0045 Smith 1234 Clerk E3542 Mike 9876 Salesrep E1111 Smith 9876 Salesrep E9999 Mary 1234 Lawyer EmpID à Name, Phone, Position Position à Phone but not Phone à Position CSE Winter

25 Example EmpID Name Phone Position E0045 Smith 1234 Clerk E3542 Mike 9876 ß Salesrep E1111 Smith 9876 ß Salesrep E9999 Mary 1234 Lawyer Position à Phone CSE Winter

26 Example EmpID Name Phone Position E0045 Smith 1234 à Clerk E3542 Mike 9876 Salesrep E1111 Smith 9876 Salesrep E9999 Mary 1234 à Lawyer But not Phone à Position CSE Winter

27 Example name à color category à department color, category à price name category color department price Gizmo Gadget Green Toys 49 Tweaker Gadget Green Toys 99 Which FD s hold? CSE Winter

28 Buzzwords FD holds or does not hold on an instance If we can be sure that every instance of R will be one in which a given FD is true, then we say that R satisfies the FD If we say that R satisfies an FD, we are stating a constraint on R CSE Winter

29 An Interesting Observation If all these FDs are true: Then this FD also holds: name à color category à department color, category à price name, category à price Find out from application domain some FDs, Compute all FD s implied by them CSE Winter

30 Closure of a set of Attributes Given a set of attributes A 1,, A n The closure is the set of attributes B, denoted {A 1,, A n } +, s.t. A 1,, A n à B CSE Winter

31 Closure of a set of Attributes Given a set of attributes A 1,, A n The closure is the set of attributes B, denoted {A 1,, A n } +, s.t. A 1,, A n à B Example: 1. name à color 2. category à department 3. color, category à price CSE Winter

32 Closure of a set of Attributes Given a set of attributes A 1,, A n The closure is the set of attributes B, denoted {A 1,, A n } +, s.t. A 1,, A n à B Example: 1. name à color 2. category à department 3. color, category à price Closures: name + = {name, color} CSE Winter

33 Closure of a set of Attributes Given a set of attributes A 1,, A n The closure is the set of attributes B, denoted {A 1,, A n } +, s.t. A 1,, A n à B Example: 1. name à color 2. category à department 3. color, category à price Closures: name + = {name, color} {name, category} + = {name, category, color, department, price} CSE Winter

34 Closure of a set of Attributes Given a set of attributes A 1,, A n The closure is the set of attributes B, denoted {A 1,, A n } +, s.t. A 1,, A n à B Example: 1. name à color 2. category à department 3. color, category à price Closures: name + = {name, color} {name, category} + = {name, category, color, department, price} color + = {color} CSE Winter

35 Keys A superkey is a set of attributes A 1,..., A n s.t. for any other attribute B, we have A 1,..., A n à B A key is a minimal superkey (no subset is a superkey) CSE Winter

36 Computing (Super)Keys For all sets X, compute X + If X + = [all attributes], then X is a superkey Try reducing to the minimal X s to get the key CSE Winter

37 Example Product(name, price, category, color) name, category à price category à color What is the key? CSE Winter

38 Example Product(name, price, category, color) name, category à price category à color What is the key? (name, category) + = { name, category, price, color } CSE Winter

39 Example Product(name, price, category, color) name, category à price category à color What is the key? (name, category) + = { name, category, price, color } Hence (name, category) is a key CSE Winter

40 Key or Keys? Can we have more than one key? CSE Winter

41 Key or Keys? Can we have more than one key? A à B B à C C à A what are the keys here? CSE Winter

42 Key or Keys? Can we have more than one key? A à B B à C C à A ABàC BCàA what are the keys here? AàBC BàAC CSE Winter

43 Eliminating Anomalies Main idea: X à A is OK if X is a (super)key X à A is not OK otherwise Need to decompose the table, but how? CSE Winter

44 Boyce-Codd Normal Form There are no bad FDs: Definition. A relation R is in BCNF if: Whenever Xà B is a non-trivial dependency, then X is a superkey. Equivalently: Definition. A relation R is in BCNF if: X, either X + = X or X + = [all attributes] CSE Winter

45 BCNF Decomposition Algorithm Normalize(R) find X s.t.: X X + and X + [all attributes] if (not found) then R is in BCNF let Y = X + - X; Z = [all attributes] - X + decompose R into R1(X Y) and R2(X Z) Normalize(R1); Normalize(R2); Y X Z X + CSE Winter

46 Example Name SSN PhoneNumber City Fred Seattle Fred Seattle Joe Westfield Joe Westfield SSN à Name, City The only key is: {SSN, PhoneNumber} Hence SSN à Name, City is a bad dependency Name, City SSN + SSN Phone- Number In other words: SSN+ = SSN, Name, City and is neither SSN nor All Attributes

47 Find X s.t.: X X + and X + [all attributes] Example BCNF Decomposition Person(name, SSN, age, haircolor, phonenumber) SSN à name, age age à haircolor CSE Winter

48 Find X s.t.: X X + and X + [all attributes] Example BCNF Decomposition Person(name, SSN, age, haircolor, phonenumber) SSN à name, age age à haircolor Iteration 1: Person: SSN+ = SSN, name, age, haircolor Decompose into: P(SSN, name, age, haircolor) Phone(SSN, phonenumber) name, age, haircolor SSN phonenumber CSE Winter

49 Find X s.t.: X X + and X + [all attributes] Example BCNF Decomposition Person(name, SSN, age, haircolor, phonenumber) SSN à name, age What are age à haircolor the keys? Iteration 1: Person: SSN+ = SSN, name, age, haircolor Decompose into: P(SSN, name, age, haircolor) Phone(SSN, phonenumber) Iteration 2: P: age+ = age, haircolor Decompose: People(SSN, name, age) Hair(age, haircolor) Phone(SSN, phonenumber) CSE Winter

50 Find X s.t.: X X + and X + [all attributes] Example BCNF Decomposition Person(name, SSN, age, haircolor, phonenumber) SSN à name, age Note the keys! age à haircolor Iteration 1: Person: SSN+ = SSN, name, age, haircolor Decompose into: P(SSN, name, age, haircolor) Phone(SSN, phonenumber) Iteration 2: P: age+ = age, haircolor Decompose: People(SSN, name, age) Hair(age, haircolor) Phone(SSN, phonenumber) CSE Winter

51 R(A,B,C,D) Example: BCNF A à B B à C R(A,B,C,D) CSE Winter

52 R(A,B,C,D) Example: BCNF A à B B à C Recall: find X s.t. X X + [all-attrs] R(A,B,C,D) CSE Winter

53 R(A,B,C,D) Example: BCNF A à B B à C R(A,B,C,D) A + = ABC ABCD CSE Winter

54 R(A,B,C,D) Example: BCNF A à B B à C R(A,B,C,D) A + = ABC ABCD R 1 (A,B,C) R 2 (A,D) CSE Winter

55 R(A,B,C,D) Example: BCNF A à B B à C R(A,B,C,D) A + = ABC ABCD R 1 (A,B,C) B + = BC ABC R 2 (A,D) CSE Winter

56 R(A,B,C,D) Example: BCNF A à B B à C R(A,B,C,D) A + = ABC ABCD R 11 (B,C) R 1 (A,B,C) B + = BC ABC R 12 (A,B) R 2 (A,D) What are the keys? What happens if in R we first pick B +? Or AB +? 56

57 Decompositions in General R(A 1,..., A n, B 1,..., B m, C 1,..., C p ) S 1 (A 1,..., A n, B 1,..., B m ) S 2 (A 1,..., A n, C 1,..., C p ) S 1 = projection of R on A 1,..., A n, B 1,..., B m S 2 = projection of R on A 1,..., A n, C 1,..., C p CSE Winter

58 Lossless Decomposition Name Price Category Gizmo Gadget OneClick Camera Gizmo Camera Name Price Name Category Gizmo OneClick Gizmo Gizmo OneClick Gizmo Gadget Camera Camera CSE Winter

59 Lossy Decomposition What is lossy here? Name Price Category Gizmo Gadget OneClick Camera Gizmo Camera Name Gizmo OneClick Gizmo Category Gadget Camera Camera Price Category Gadget Camera Camera CSE Winter

60 Lossy Decomposition Name Price Category Gizmo Gadget OneClick Camera Gizmo Camera Name Gizmo OneClick Gizmo Category Gadget Camera Camera Price Category Gadget Camera Camera CSE Winter

61 Decomposition in General R(A 1,..., A n, B 1,..., B m, C 1,..., C p ) S 1 (A 1,..., A n, B 1,..., B m ) S 2 (A 1,..., A n, C 1,..., C p ) Let: S 1 = projection of R on A 1,..., A n, B 1,..., B m S 2 = projection of R on A 1,..., A n, C 1,..., C p The decomposition is called lossless if R = S 1 S 2 Fact: If A 1,..., A n à B 1,..., B m then the decomposition is lossless It follows that every BCNF decomposition is lossless

62 Testing for Lossless Join If we decompose R into Π S1 (R), Π S2 (R), Π S3 (R), Is it true that S1 S2 S3 = R? That is true if we can show that: R S1 S2 S3 always holds (why?) R S1 S2 S3 neet to check

63 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3

64 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R?

65 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R)

66 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R) a b2 c d2 (a,c) S2 = Π BD (R)

67 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R) a b2 c d2 (a,c) S2 = Π BD (R) a3 b c d (b,c,d) S3 = Π BCD (R)

68 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: Chase them (apply FDs): AàB A B C D a b1 c1 d a b1 c d2 a3 b c d A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R) a b2 c d2 (a,c) S2 = Π BD (R) a3 b c d (b,c,d) S3 = Π BCD (R)

69 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: Chase them (apply FDs): AàB BàC A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R) a b2 c d2 (a,c) S2 = Π BD (R) a3 b c d (b,c,d) S3 = Π BCD (R) A B C D a b1 c1 d a b1 c d2 a3 b c d A B C D a b1 c d a b1 c d2 a3 b c d

70 Example from textbook Ch The Chase Test for Lossless Join R(A,B,C,D) = S1(A,D) S2(A,C) S3(B,C,D) R satisfies: AàB, BàC, CDàA S1 = Π AD (R), S2 = Π AC (R), S3 = Π BCD (R), hence R S1 S2 S3 Need to check: R S1 S2 S3 Suppose (a,b,c,d) S1 S2 S3 Is it also in R? R must contain the following tuples: Chase them (apply FDs): A B C D Why? a b1 c1 d (a,d) S1 = Π AD (R) a b2 c d2 (a,c) S2 = Π BD (R) a3 b c d (b,c,d) S3 = Π BCD (R) AàB BàC CDàA A B C D a b1 c1 d a b1 c d2 A B C D a b1 c d a b1 c d2 A B C D a b1 c d a b1 c d2 Hence R contains (a,b,c,d) a3 b c d a3 b c d a b c d

71 Schema Refinements = Normal Forms 1st Normal Form = all tables are flat 2nd Normal Form = obsolete Boyce Codd Normal Form = no bad FDs 3rd Normal Form = see book BCNF is lossless but can cause loss of ability to check some FDs 3NF fixes that (is lossless and dependency-preserving), but some tables might not be in BCNF i.e., they may have redundancy anomalies CSE Winter

CSE 344 MAY 16 TH NORMALIZATION

CSE 344 MAY 16 TH NORMALIZATION CSE 344 MAY 16 TH NORMALIZATION ADMINISTRIVIA HW6 Due Tonight Prioritize local runs OQ6 Out Today HW7 Out Today E/R + Normalization Exams In my office; Regrades through me DATABASE DESIGN PROCESS Conceptual

More information

CSE 344 AUGUST 3 RD NORMALIZATION

CSE 344 AUGUST 3 RD NORMALIZATION CSE 344 AUGUST 3 RD NORMALIZATION ADMINISTRIVIA WQ6 due Monday DB design HW7 due next Wednesday DB design normalization DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lectures 18: BCNF 1 What makes good schemas? 2 Review: Relation Decomposition Break the relation into two: Name SSN PhoneNumber City Fred 123-45-6789 206-555-1234

More information

11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design) Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates

More information

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design Outline Introduction to Database Systems CSE 444 Design theory: 3.1-3.4 [Old edition: 3.4-3.6] Lectures 6-7: Database Design 1 2 Schema Refinements = Normal Forms 1st Normal Form = all tables are flat

More information

Database Design and Implementation

Database Design and Implementation Database Design and Implementation CS 645 Schema Refinement First Normal Form (1NF) A schema is in 1NF if all tables are flat Student Name GPA Course Student Name GPA Alice 3.8 Bob 3.7 Carol 3.9 Alice

More information

Introduction to Management CSE 344

Introduction to Management CSE 344 Introduction to Management CSE 344 Lectures 17: Design Theory 1 Announcements No class/office hour on Monday Midterm on Wednesday (Feb 19) in class HW5 due next Thursday (Feb 20) No WQ next week (WQ6 due

More information

11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design) Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates

More information

Introduction to Database Systems CSE 414. Lecture 20: Design Theory

Introduction to Database Systems CSE 414. Lecture 20: Design Theory Introduction to Database Systems CSE 414 Lecture 20: Design Theory CSE 414 - Spring 2018 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data Unit

More information

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database

CSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database CSE 303: Database Lecture 10 Chapter 3: Design Theory of Relational Database Outline 1st Normal Form = all tables attributes are atomic 2nd Normal Form = obsolete Boyce Codd Normal Form = will study 3rd

More information

CSE 344 AUGUST 6 TH LOSS AND VIEWS

CSE 344 AUGUST 6 TH LOSS AND VIEWS CSE 344 AUGUST 6 TH LOSS AND VIEWS ADMINISTRIVIA WQ6 due tonight HW7 due Wednesday DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address Relational Model: Tables + constraints

More information

Practice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization

Practice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization Practice and Applications of Data Management CMPSCI 345 Lecture 16: Schema Design and Normalization Keys } A superkey is a set of a/ributes A 1,..., A n s.t. for any other a/ribute B, we have A 1,...,

More information

CMPT 354: Database System I. Lecture 9. Design Theory

CMPT 354: Database System I. Lecture 9. Design Theory CMPT 354: Database System I Lecture 9. Design Theory 1 Design Theory Design theory is about how to represent your data to avoid anomalies. Design 1 Design 2 Student Course Room Mike 354 AQ3149 Mary 354

More information

Practice and Applications of Data Management CMPSCI 345. Lecture 15: Functional Dependencies

Practice and Applications of Data Management CMPSCI 345. Lecture 15: Functional Dependencies Practice and Applications of Data Management CMPSCI 345 Lecture 15: Functional Dependencies First Normal Form (1NF) } A database schema is in First Normal Form if all tables are flat Student Student Name

More information

Schema Refinement. Feb 4, 2010

Schema Refinement. Feb 4, 2010 Schema Refinement Feb 4, 2010 1 Relational Schema Design Conceptual Design name Product buys Person price name ssn ER Model Logical design Relational Schema plus Integrity Constraints Schema Refinement

More information

Lectures 6. Lecture 6: Design Theory

Lectures 6. Lecture 6: Design Theory Lectures 6 Lecture 6: Design Theory Lecture 6 Announcements Solutions to PS1 are posted online. Grades coming soon! Project part 1 is out. Check your groups and let us know if you have any issues. We have

More information

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies

Design Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies Design Theory BBM471 Database Management Systems Dr. Fuat Akal akal@hacettepe.edu.tr Design Theory I 2 Today s Lecture 1. Normal forms & functional dependencies 2. Finding functional dependencies 3. Closures,

More information

CSC 261/461 Database Systems Lecture 11

CSC 261/461 Database Systems Lecture 11 CSC 261/461 Database Systems Lecture 11 Fall 2017 Announcement Read the textbook! Chapter 8: Will cover later; But self-study the chapter Everything except Section 8.4 Chapter 14: Section 14.1 14.5 Chapter

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 18: Design Theory Wrap-up 1 Announcements WQ6 is due on Tuesday Homework 6 is due on Thursday Be careful about your remaining late days. Today: Midterm review

More information

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018 CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018 Announcement Read Chapter 14 and 15 You must self-study these chapters Too huge to cover in Lectures Project 2 Part 1 due tonight Agenda 1.

More information

SCHEMA NORMALIZATION. CS 564- Fall 2015

SCHEMA NORMALIZATION. CS 564- Fall 2015 SCHEMA NORMALIZATION CS 564- Fall 2015 HOW TO BUILD A DB APPLICATION Pick an application Figure out what to model (ER model) Output: ER diagram Transform the ER diagram to a relational schema Refine the

More information

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 CSC 261/461 Database Systems Lecture 8 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Agenda 1. Database Design 2. Normal forms & functional dependencies 3. Finding functional dependencies

More information

L14: Normalization. CS3200 Database design (sp18 s2) 3/1/2018

L14: Normalization. CS3200 Database design (sp18 s2)   3/1/2018 L14: Normalization CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 3/1/2018 367 Announcements! Keep bringing your name plates J Outline today - More Normalization - Project 1

More information

CSC 261/461 Database Systems Lecture 13. Spring 2018

CSC 261/461 Database Systems Lecture 13. Spring 2018 CSC 261/461 Database Systems Lecture 13 Spring 2018 BCNF Decomposition Algorithm BCNFDecomp(R): Find X s.t.: X + X and X + [all attributes] if (not found) then Return R let Y = X + - X, Z = (X + ) C decompose

More information

CSC 261/461 Database Systems Lecture 12. Spring 2018

CSC 261/461 Database Systems Lecture 12. Spring 2018 CSC 261/461 Database Systems Lecture 12 Spring 2018 Announcement Project 1 Milestone 2 due tonight! Read the textbook! Chapter 8: Will cover later; But self-study the chapter Chapter 14: Section 14.1 14.5

More information

L13: Normalization. CS3200 Database design (sp18 s2) 2/26/2018

L13: Normalization. CS3200 Database design (sp18 s2)   2/26/2018 L13: Normalization CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/26/2018 274 Announcements! Keep bringing your name plates J Page Numbers now bigger (may change slightly)

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms UMass Amherst Feb 14, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke, Dan Suciu 1 Relational Schema Design Conceptual Design name Product buys Person price name

More information

Chapter 3 Design Theory for Relational Databases

Chapter 3 Design Theory for Relational Databases 1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Remember our

More information

DECOMPOSITION & SCHEMA NORMALIZATION

DECOMPOSITION & SCHEMA NORMALIZATION DECOMPOSITION & SCHEMA NORMALIZATION CS 564- Spring 2018 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Bad schemas lead to redundancy To correct bad schemas: decompose relations

More information

Design theory for relational databases

Design theory for relational databases Design theory for relational databases 1. Consider a relation with schema R(A,B,C,D) and FD s AB C, C D and D A. a. What are all the nontrivial FD s that follow from the given FD s? You should restrict

More information

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information Relational Database Design Database Design To generate a set of relation schemas that allows - to store information without unnecessary redundancy - to retrieve desired information easily Approach - design

More information

DESIGN THEORY FOR RELATIONAL DATABASES. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018

DESIGN THEORY FOR RELATIONAL DATABASES. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 DESIGN THEORY FOR RELATIONAL DATABASES csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 1 Introduction There are always many different schemas for a given

More information

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi

Design Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi Design Theory for Relational Databases Spring 2011 Instructor: Hassan Khosravi Chapter 3: Design Theory for Relational Database 3.1 Functional Dependencies 3.2 Rules About Functional Dependencies 3.3 Design

More information

Design Theory for Relational Databases

Design Theory for Relational Databases Design Theory for Relational Databases FUNCTIONAL DEPENDENCIES DECOMPOSITIONS NORMAL FORMS 1 Functional Dependencies X ->Y is an assertion about a relation R that whenever two tuples of R agree on all

More information

Relational Database Design

Relational Database Design Relational Database Design Jan Chomicki University at Buffalo Jan Chomicki () Relational database design 1 / 16 Outline 1 Functional dependencies 2 Normal forms 3 Multivalued dependencies Jan Chomicki

More information

Design Theory for Relational Databases

Design Theory for Relational Databases Design Theory for Relational Databases Keys: formal definition K is a superkey for relation R if K functionally determines all attributes of R K is a key for R if K is a superkey, but no proper subset

More information

CS322: Database Systems Normalization

CS322: Database Systems Normalization CS322: Database Systems Normalization Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Introduction The normalization process takes a relation schema through

More information

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li 1 Third Normal Form (3NF) v Relation R is in 3NF if it is in 2NF and it has no transitive dependencies

More information

Introduction to Data Management. Lecture #7 (Relational DB Design Theory II)

Introduction to Data Management. Lecture #7 (Relational DB Design Theory II) Introduction to Data Management Lecture #7 (Relational DB Design Theory II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Homework

More information

Relational Design Theory

Relational Design Theory Relational Design Theory CSE462 Database Concepts Demian Lessa/Jan Chomicki Department of Computer Science and Engineering State University of New York, Buffalo Fall 2013 Overview How does one design a

More information

Normal Forms (ii) ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Normal Forms (ii) ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa ICS 321 Fall 2012 Normal Forms (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/12/2012 Lipyeow Lim -- University of Hawaii at Manoa 1 Hourly_Emps

More information

Functional Dependency Theory II. Winter Lecture 21

Functional Dependency Theory II. Winter Lecture 21 Functional Dependency Theory II Winter 2006-2007 Lecture 21 Last Time Introduced Third Normal Form A weakened version of BCNF that preserves more functional dependencies Allows non-trivial dependencies

More information

Databases 2012 Normalization

Databases 2012 Normalization Databases 2012 Christian S. Jensen Computer Science, Aarhus University Overview Review of redundancy anomalies and decomposition Boyce-Codd Normal Form Motivation for Third Normal Form Third Normal Form

More information

Lossless Joins, Third Normal Form

Lossless Joins, Third Normal Form Lossless Joins, Third Normal Form FCDB 3.4 3.5 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 19, 2018 Decomposition wish list 1. Eliminate redundancy and anomalies 2. Recover

More information

Chapter 3 Design Theory for Relational Databases

Chapter 3 Design Theory for Relational Databases 1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Our example

More information

Schema Refinement & Normalization Theory

Schema Refinement & Normalization Theory Schema Refinement & Normalization Theory Functional Dependencies Week 13 1 What s the Problem Consider relation obtained (call it SNLRHW) Hourly_Emps(ssn, name, lot, rating, hrly_wage, hrs_worked) What

More information

Introduction to Data Management. Lecture #6 (Relational Design Theory)

Introduction to Data Management. Lecture #6 (Relational Design Theory) Introduction to Data Management Lecture #6 (Relational Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW#2 is

More information

Introduction to Data Management. Lecture #6 (Relational DB Design Theory)

Introduction to Data Management. Lecture #6 (Relational DB Design Theory) Introduction to Data Management Lecture #6 (Relational DB Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Homework

More information

INF1383 -Bancos de Dados

INF1383 -Bancos de Dados INF1383 -Bancos de Dados Prof. Sérgio Lifschitz DI PUC-Rio Eng. Computação, Sistemas de Informação e Ciência da Computação Projeto de BD e Formas Normais Alguns slides são baseados ou modificados dos originais

More information

Schema Refinement and Normal Forms. Chapter 19

Schema Refinement and Normal Forms. Chapter 19 Schema Refinement and Normal Forms Chapter 19 1 Review: Database Design Requirements Analysis user needs; what must the database do? Conceptual Design high level descr. (often done w/er model) Logical

More information

CS54100: Database Systems

CS54100: Database Systems CS54100: Database Systems Keys and Dependencies 18 January 2012 Prof. Chris Clifton Functional Dependencies X A = assertion about a relation R that whenever two tuples agree on all the attributes of X,

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Quiz #2 Next Thursday Comp 521 Files and Databases Fall 2012 1 The Evils of Redundancy v Redundancy is at the root of several problems associated with relational

More information

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization Relational Design Theory II Normalization Detecting Anomalies SID Activity Fee Tax 1001 Piano $20 $2.00 1090 Swimming $15 $1.50 1001 Swimming $15 $1.50 Why is this bad design? Can we capture this using

More information

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due Information Systems for Engineers Exercise 8 ETH Zurich, Fall Semester 2017 Hand-out 24.11.2017 Due 01.12.2017 1. (Exercise 3.3.1 in [1]) For each of the following relation schemas and sets of FD s, i)

More information

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies?

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies? Normalization Introduction What problems are caused by redundancy? UVic C SC 370 Dr. Daniel M. German Department of Computer Science What are functional dependencies? What are normal forms? What are the

More information

Relational Database Design

Relational Database Design CSL 451 Introduction to Database Systems Relational Database Design Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan! Recap - Boyce-Codd

More information

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016 Normal Forms Dr Paolo Guagliardo University of Edinburgh Fall 2016 Example of bad design BAD Title Director Theatre Address Time Price Inferno Ron Howard Vue Omni Centre 20:00 11.50 Inferno Ron Howard

More information

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen LECTURE 4: DESIGN THEORIES (FUNCTIONAL DEPENDENCIES) Design theory E/R diagrams are high-level design Formal theory for

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Information Systems (Informationssysteme)

Information Systems (Informationssysteme) Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2015 c Jens Teubner Information Systems Summer 2015 1 Part VII Schema Normalization c Jens Teubner

More information

Lecture #7 (Relational Design Theory, cont d.)

Lecture #7 (Relational Design Theory, cont d.) Introduction to Data Management Lecture #7 (Relational Design Theory, cont d.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements

More information

Functional Dependency and Algorithmic Decomposition

Functional Dependency and Algorithmic Decomposition Functional Dependency and Algorithmic Decomposition In this section we introduce some new mathematical concepts relating to functional dependency and, along the way, show their practical use in relational

More information

Functional Dependencies and Normalization

Functional Dependencies and Normalization Functional Dependencies and Normalization There are many forms of constraints on relational database schemata other than key dependencies. Undoubtedly most important is the functional dependency. A functional

More information

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated

More information

FUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20

FUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20 FUNCTIONAL DEPENDENCY THEORY II CS121: Relational Databases Fall 2018 Lecture 20 Canonical Cover 2 A canonical cover F c for F is a set of functional dependencies such that: F logically implies all dependencies

More information

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd. The Evils of Redundancy Schema Refinement and Normal Forms Chapter 19 Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke 1 Redundancy is at the root of several problems associated with relational

More information

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram Schema Refinement and Normal Forms Chapter 19 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems Relational Database Design Theory Part II CPS 116 Introduction to Database Systems Announcements (October 12) 2 Midterm graded; sample solution available Please verify your grades on Blackboard Project

More information

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Background We started with schema design ER model translation into a relational schema Then we studied relational

More information

FUNCTIONAL DEPENDENCY THEORY. CS121: Relational Databases Fall 2017 Lecture 19

FUNCTIONAL DEPENDENCY THEORY. CS121: Relational Databases Fall 2017 Lecture 19 FUNCTIONAL DEPENDENCY THEORY CS121: Relational Databases Fall 2017 Lecture 19 Last Lecture 2 Normal forms specify good schema patterns First normal form (1NF): All attributes must be atomic Easy in relational

More information

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) CIS 330, Spring 2004 Lecture 11 March 2, 2004

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) CIS 330, Spring 2004 Lecture 11 March 2, 2004 Schema Refinement and Normal Forms CIS 330, Spring 2004 Lecture 11 March 2, 2004 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational schemas: redundant storage,

More information

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram The Evils of Redundancy Schema Refinement and Normalization Chapter 1 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Redundancy is at the root of several problems

More information

Database Design: Normal Forms as Quality Criteria. Functional Dependencies Normal Forms Design and Normal forms

Database Design: Normal Forms as Quality Criteria. Functional Dependencies Normal Forms Design and Normal forms Database Design: Normal Forms as Quality Criteria Functional Dependencies Normal Forms Design and Normal forms Design Quality: Introduction Good conceptual model: - Many alternatives - Informal guidelines

More information

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19 Schema Refinement and Normal Forms [R&G] Chapter 19 CS432 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational schemas: redundant storage, insert/delete/update

More information

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd. The Evils of Redundancy Schema Refinement and Normal Forms INFO 330, Fall 2006 1 Redundancy is at the root of several problems associated with relational schemas: redundant storage, insert/delete/update

More information

Database Design and Normalization

Database Design and Normalization Database Design and Normalization Chapter 11 (Week 12) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 1 1NF FIRST S# Status City P# Qty S1 20 London P1 300 S1 20 London

More information

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh Functional Dependencies and Normalization Instructor: Mohamed Eltabakh meltabakh@cs.wpi.edu 1 Goal Given a database schema, how do you judge whether or not the design is good? How do you ensure it does

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 32 Schema Design When we get a relational

More information

Chapter 10. Normalization Ext (from E&N and my editing)

Chapter 10. Normalization Ext (from E&N and my editing) Chapter 10 Normalization Ext (from E&N and my editing) Outline BCNF Multivalued Dependencies and Fourth Normal Form 2 BCNF A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever an FD X ->

More information

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke Schema Refinement Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Revisit a Previous Example ssn name Lot Employees rating hourly_wages hours_worked ISA contractid Hourly_Emps

More information

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst November 1 & 6, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Reference: A First Course in Database Systems, 3 rd edition, Chapter 3 Important Notices CMPS 180 Final Exam

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10 & 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting

More information

Schema Refinement: Other Dependencies and Higher Normal Forms

Schema Refinement: Other Dependencies and Higher Normal Forms Schema Refinement: Other Dependencies and Higher Normal Forms Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Higher Normal Forms 1 / 14 Outline 1

More information

Functional Dependencies & Normalization. Dr. Bassam Hammo

Functional Dependencies & Normalization. Dr. Bassam Hammo Functional Dependencies & Normalization Dr. Bassam Hammo Redundancy and Normalisation Redundant Data Can be determined from other data in the database Leads to various problems INSERT anomalies UPDATE

More information

Schema Refinement and Normal Forms Chapter 19

Schema Refinement and Normal Forms Chapter 19 Schema Refinement and Normal Forms Chapter 19 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh Database Management

More information

Schema Refinement and Normalization

Schema Refinement and Normalization Schema Refinement and Normalization Schema Refinements and FDs Redundancy is at the root of several problems associated with relational schemas. redundant storage, I/D/U anomalies Integrity constraints,

More information

Constraints: Functional Dependencies

Constraints: Functional Dependencies Constraints: Functional Dependencies Fall 2017 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 42 Schema Design When we get a relational

More information

Normal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Normal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa ICS 321 Fall 2013 Normal Forms 1 Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/16/2013 Lipyeow Lim -- University of Hawaii at Manoa 1 The Problem with

More information

A few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre

A few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre A few details using Armstrong s axioms Supplement to Normalization Lecture Lois Delcambre 1 Armstrong s Axioms with explanation and examples Reflexivity: If X Y, then X Y. (identity function is a function)

More information

Schema Refinement and Normal Forms. Why schema refinement?

Schema Refinement and Normal Forms. Why schema refinement? Schema Refinement and Normal Forms Why schema refinement? Consider relation obtained from Hourly_Emps: Hourly_Emps (sin,rating,hourly_wages,hourly_worked) Problems: Update Anomaly: Can we change the wages

More information

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3

Desirable properties of decompositions 1. Decomposition of relational schemes. Desirable properties of decompositions 3 Desirable properties of decompositions 1 Lossless decompositions A decomposition of the relation scheme R into Decomposition of relational schemes subschemes R 1, R 2,..., R n is lossless if, given tuples

More information

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17 Normalization October 5, 2017 Chapter 19 Pacific University 1 Description A Real Estate agent wants to track offers made on properties. Each customer has a first and last name. Each property has a size,

More information

But RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status)

But RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status) So far we have seen: RECAP How to use functional dependencies to guide the design of relations How to modify/decompose relations to achieve 1NF, 2NF and 3NF relations But How do we make sure the decompositions

More information

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago

COSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago COSC 430 Advanced Database Topics Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago Learning objectives and references You should be able to: define the elements of the relational

More information

Chapter 11, Relational Database Design Algorithms and Further Dependencies

Chapter 11, Relational Database Design Algorithms and Further Dependencies Chapter 11, Relational Database Design Algorithms and Further Dependencies Normal forms are insufficient on their own as a criteria for a good relational database schema design. The relations in a database

More information

CSE 132B Database Systems Applications

CSE 132B Database Systems Applications CSE 132B Database Systems Applications Alin Deutsch Database Design and Normal Forms Some slides are based or modified from originals by Sergio Lifschitz @ PUC Rio, Brazil and Victor Vianu @ CSE UCSD and

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on Overview - detailed DB design and normaliza:on pi?alls of bad design decomposi:on normal forms

More information

CS 186, Fall 2002, Lecture 6 R&G Chapter 15

CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Schema Refinement and Normalization CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Functional Dependencies (Review)

More information

Functional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design

Functional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design Applied Databases Handout 2a. Functional Dependencies and Normal Forms 20 Oct 2008 Functional Dependencies This is the most mathematical part of the course. Functional dependencies provide an alternative

More information