up

2020-02-13

Class must pick one:

voting will take place next class.

Practice

I will bold the keys instead of underlining them

Normalize this relation:

A(1,2,3,4,5,6,7,8,9)

With these dependencies:

My Solution

Identify problem dependencies

partial dependencies:

Shuffle Shuffle

Alright so now we have:

Solution

Prof has identified the same problem dependencies:

When moving dependencies to a new relation, the keys of the new relation become foreign keys in the original relation.

italics is used for something but I’ma use it here for foreign keys. Looking back, that’s hard to see. 2 is a foreign key below.

A(1, 2, 3, 4, 5)

B(2, 6, 7, 8, 9)

There must be a reference statement for referential integrity

This is a reference statement:

A(2) mei B(2)

‘mei’ means ‘must exist in’

A is still not in second normal form, because of the relationship between 1 and 4.

In the new relation, C, we use 1 as the PK because it’s already a key in A.

Note because italics are hard: 1 and 2 are foreign keys.

I’m going to try and do the relation with html

A(1,2,3,5)

That actually turned out really well

Alright - turns out we aren’t done. Because 2 determines 6,7, and 6,7 determined 8,9, there is a transitive dependency in relation B.

We fix this by making a new dependency.

Here are the results, in glorious HTML markup:

A(1,2,3,5)

B(2,6,7)

C(1,4)

D(6,7,8,9)

Slides

Kinds of anomalies:

Second normal form requirements:

BCNF

“A relation is in BCNF if all determinants are a candidate key”.

A good data model will require less normalization.

Notes from another example

Relation names must be in all capitals. Points will be lost because of this.