1 of 12

CSE 414: Section 6

BCNF

October 31st, 2019

2 of 12

Mid-Quarter Section Survey!!

tinyurl.com/y23u4q8c

3 of 12

Outline

BCNF decomposition

  • Check whether chosen FD violates BCNF
  • Use any FD that violates BCNF to decompose.

4 of 12

Keys

We call a set of attributes that determines all other attributes in a relation to be a superkey.

If no proper subset of a superkey is a superkey, �we call that set a minimal superkey or just key

e.g. a & b, c

5 of 12

Closure Algorithm

Goal:

We want everything that an attribute/set of attributes determines

Observation:

  • If we have A -> B and B -> C, then A -> C
  • So really, A -> B and C
  • Formal notation is {A}+ = {A, B, C}
  • Since the closure of A is all attributes, A is a key

6 of 12

Conceptual Design

Name

SSN

PhoneNumber

City

Fred

123-45-6789

206-555-1234

Seattle

Fred

123-45-6789

206-555-6543

Seattle

Joe

987-65-4321

908-555-2121

Westfield

SSN Name, City

7 of 12

Conceptual Design

Anomalies:

• Redundancy = repeat data

• Update anomalies = what if Fred moves to “Bellevue”?

• Deletion anomalies = what if Joe deletes his phone number?

8 of 12

Conceptual Design

The BCNF (Boyce-Codd Normal Form) ---- A relation R is in BCNF if every set of attributes is either a superkey or its closure is the same set (itself)

9 of 12

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);

X +

10 of 12

Example

The relation is R (A, B, C, D, E)

FDs : A → E, BC → A, and DE → B

Question : Decompose R into BCNF.

11 of 12

Solution

Notice that {A}+ = {A,E}, which violates the BCNF condition.

We split R to R1(A,E) and R2(A,B,C,D).

R1 satisfies BCNF now, but R2 does not because: {B,C}+ = {B,C,A}.

Notice that there is no E in R2 table so we don't need to consider the FD

DE → B!

Split R2 to: R21(B,C,A) and R22(B,C,D)

12 of 12

Solution

Final Result:

R1(A,E), R21(B,C,A) and R22(B,C,D)