FDs Flashcards

1
Q

How to identify “bad” schemas and improve them

A
  1. express constraints on the data: functional dependencies

2. use FDs to decompose the relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Normalization

A

obtains a schema in the “normal form” that guarantees certain properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Functional dependencies (FDs)

A

form of constraint that generalizes the concept of keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A functionally determines B

A

if 2 tuples agree on the attributes A = A1, A2…An then they must agree on the attributes B = B1, B2, …Bm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A,B -> C,D can be split how?

A

A,B -> C
A,B -> D
Attributes on right are independently determined by A,B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A,B -> C,D

= A-> C,D and B->C,D?

A

cannot split this way

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Trivial FDs

X->A

A

the attribute A belongs to the attribute set X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

examples of trivial FDs

A

A -> A

A, B, C -> C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

FD is domain knowledge

A
  • inherent property of the application and data

- not something we can infer from a set of tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Given a table with a set of tuples, can we confirm FD is valid?

A

No, can only confirm FD seems valid or infer FD is invalid, can’t prove FD is valid

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why FDs?

A
  • keys are special cases of FDs
  • more integrity constraints
  • help detect if schema has redundancies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Armstrongs Axioms

A

Reflexivity, Augmentation, Transitivity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Reflexivity

A

For any subset X in {A1..An}

A1, A2, …An -> X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

examples reflexivity

A

A,B -> B
A,B,C -> A,B
A,B,C -> A,B,C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Augmentation

A

For any attribute sets X,Y,Z:

if X->Y, then X,Z -> Y,Z

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

examples Augmentation

A

A -> B implies A,C -> B,C

A,B -> C implies A,B,C -> C

17
Q

Transitivity

A

For any attribute sets X, Y, Z: if X-> Y and Y -> Z then X -> Z

18
Q

examples transitivity

A

A-> B and B-> C then A-> C

A->C,D and C,D -> then A->E

19
Q

FD closure

A

the closure F+ is the set of all FDs logically implied by F

20
Q

Armstrong’s axioms are:

A

sound

complete

21
Q

Sound

A

any FD generated by an axiom belongs in F+

22
Q

Complete

A

repeated application of the axioms will generate all FDs in F+

23
Q

Attribute Closure

A

If X is an attribute set, the closure X+ is the set of all attributes B s.t. X -> B
X+ includes all attributes that are functionally determined from X

24
Q

Closure Algorithm

A

X = {A1, A2, …An}

Until X doesn’t change repeat: if B1,…Bm -> C is an FD and B1…Bm are all in X, then add C to X

25
Q

Why is closure needed?

A

Does X-> Y hold?

We can check if Y is in X+

26
Q

To compute the closer F+ of FDs

A

for each subset of attributes X, compute X+, for each subset of attributes Y in X+, ouput FD X->Y

27
Q

superkey

A

set of attributes A1, A2,…An s.t. for any other attribute B in the relation:
A1, A2,…An -> B

28
Q

key

A

minimal super key

none of its subsets functionally determines all attributes of the relation

29
Q

Compute X+ for all sets of attributes X. How do we know if X is a key or superkey?

A

if X+ = all attributes, X is a superkey

if no subset of X is a superkey, X is a key

30
Q

Is it possible to have many keys in a relation R?

A

Yes. R(A,B,C) with FDs
A,B -> C
A,C -> B

31
Q

S is a minimal basis for a set F of FDs if:

A

S+ = F+
every FD in S has one attribute on the RHS
if we remove a FD from S, the closure is not F+
if we remove 1+ attributes on LHS from any FD in S, closure is not F+