Functional Dependencies Flashcards

1
Q

How does E-R and Functional Dependencies relate?

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

What are Functional Dependencies?

A

In relational database theory, a functional dependency is a constraint between two sets of attributes in a relation from a database. In other words, functional dependency is a constraint that describes the relationship between attributes in a relation.

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

Explain Assertions on a schema.

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

Explain Assertions on a domain.

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

What are FDs really?

A

What are FDs really?
• Functional dependencies represent a special kind of
constraints of a domain – dependency constraints.
• The database we design should properly capture all
constraints of the domain.
• We can use FDs to verify that our design indeed
captures the constraints we expect, and add more
constraints to the design when needed.

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

What’s so functional about FDs?

A

What’s so functional?
• X → A is a (deterministic) function from X
to A. Given values for the attributes in the
set X, we get the value of A.
• Example:
– code → name
– imagine a deterministic function f(code)
which returns the name associated with a
given code.

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

What is the difference between dependence and reference?

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

Explain Multiple Attributes on R/LHS

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

What’s the difference between the LHS of a FD, and a key?

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

FD: code, period → teacher ?

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

Given values for a code and a period, starting from any relation where
they appear, is it possible to reach more than one teacher value by following
keys and references?

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

Explain Trivial FD:s.

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

Is this a trivial FD?
course, period → course, name

A

course, period → course, name

Shorthand for
course, period → course (trivial)
course, period → name (not trivial)

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

Explain Inferring FD:s.

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

Explain closure of attribute set X.

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

How do you compute closure?

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

How to find all the implied FDs?

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

Simplifying trick to find F+?

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

Explain how to find keys. What is a super key? Minimal super key?

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

Schedules(code, name, period, #students,
teacher, room, #seats, weekday, hour)

Are these superkeys?

X = {code, period, weekday, hour}

Y = {code, period, weekday}

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

Explain Primary Keys.

A

Primary keys
• There can be more than one key for the
same relation.
• We choose one of them to be the primary
key, which is the key that we actually use
for the relation.
• Other keys could be asserted through
uniqueness constraints.
– E.g. for the self-referencing relation

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

Syntax for determining primary key for scenario:

Rooms(name, #seats)
NextTo(right, left)

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

Where do FDs come from?

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

How NOT to find FDs and why not!

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

Why Normalizing Databases?

A

Normalization of Database

Database Normalization is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion Anamolies. It is a multi-step process that puts data into tabular form, removing duplicated data from the relation tables.

Normalization is used for mainly two purposes,

Eliminating reduntant(useless) data.

Ensuring data dependencies make sense i.e data is logically stored.

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

How can FD:s be used to detect anomalies?

A
32
Q

What is the problem and how to fix it?

A
33
Q

Explain Boyce-Codd Normal Form.

A
34
Q

Explain BCFN violations using the example below:

A
35
Q

Explan the BCFN normalization algorithm.

A
36
Q
A
37
Q

What does Recovery mean?

A
38
Q

Explain Lossy joins using this example.

A
39
Q

Explain Lossless join.

A

Lossless join
• Only if we decompose on proper
dependencies can we guarantee that no
facts are lost.
– Schemas from proper translation of correct
E-R diagrams get this ”for free”.
– The BCNF decomposition algorithm
guarantees lossless join.
• A decompositon that does not give
lossless join is bad.

40
Q
A
41
Q

Why not use BCNF decomposition for designing database schemas?

Why go via E-R diagrams?

A
42
Q

Why use FDs and decomposition at all?

Why not just go via E-R diagrams?

A
43
Q
A
44
Q
A
45
Q

Explain Equality Constraints

A

Equality constraints
• FDs don’t always give the full story.
• Equality constraints over circular
relationship paths are relatively common.
– Can sometimes – but not always – be
captured via extra references.
– Extra attributes may be needed – more on
that later…

46
Q
A
47
Q
A
48
Q

What is a problem with BCNF?

A
49
Q

Explain the Third Normal Form (3NF).

A
50
Q

Explain the algorithm of 3NF.

A
51
Q
A
52
Q
A
53
Q
A
54
Q

Problem with 3NF?

A
55
Q

3NF vs BCNF

A
56
Q

What is X+?

A

X+ = Closure of X = all derivable (from X) attributes

57
Q

What is F+?

A

F+ = Closure of F = all implied (from F) FDs

58
Q

Short description of BCNF?

A

Boyce-Codd Normal Form (BCNF):
– The LHS (X) of every non-trivial FD (X → A) must be a superkey

59
Q

Explain Decompostition.

A

Decomposition:
– Split up relations until normal form (e.g. BCNF) holds
– Make sure to preserve recovery!!! No lossy joins allowed

60
Q

Why Normal Forms?

A

Normal Forms?!
• Use normal forms to detect anomalies (e.g. Redundancy)
• Use decomposition to remove anomalies

61
Q

Scale of Normal Forms?

A
62
Q

Howcome?

A
63
Q
A
64
Q

Explain Independencies (INDs).

A
65
Q

Independent how?

A
66
Q

If two tuples have the same value for X, different
values for Y and different values for the Z attributes,
then there must also exist tuples where the values
of Y are exchanged, otherwise Y and Z are not
independent! (Visualize)

A
67
Q

Explain.

A
68
Q

Explain Joining.

A
69
Q

Are FD:s Independencies?

A
70
Q

What are the possible combinations of attibutes?

A
71
Q

Are IND rules equal FD rules?

A
72
Q

Problems with IND?

A
73
Q

Explain Fourth Normal Form (4NF) holistically.

A

Fourth Normal Form (4NF)
• The redundancy that comes from IND’s is not removable by putting the databaseschema in BCNF.
• There is a stronger normal form, called 4NF, that (intuitively) treats IND’s as FD’s when it comes to decomposition, but not when determining keys of the relation.

74
Q

Explain 4NF in detail.

A
75
Q

BCNF vs 4NF.

A
76
Q

INDs for validation?

A
77
Q
A