Functional Dependencies Flashcards
How does E-R and Functional Dependencies relate?
What are Functional Dependencies?
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.
Explain Assertions on a schema.
Explain Assertions on a domain.
What are FDs really?
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.
What’s so functional about FDs?
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.
What is the difference between dependence and reference?
Explain Multiple Attributes on R/LHS
What’s the difference between the LHS of a FD, and a key?
FD: code, period → teacher ?
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?
Explain Trivial FD:s.
Is this a trivial FD?
course, period → course, name
course, period → course, name
Shorthand for
course, period → course (trivial)
course, period → name (not trivial)
Explain Inferring FD:s.
Explain closure of attribute set X.
How do you compute closure?
How to find all the implied FDs?
Simplifying trick to find F+?
Explain how to find keys. What is a super key? Minimal super key?
Schedules(code, name, period, #students,
teacher, room, #seats, weekday, hour)
Are these superkeys?
X = {code, period, weekday, hour}
Y = {code, period, weekday}
Explain Primary Keys.
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
Syntax for determining primary key for scenario:
Rooms(name, #seats)
NextTo(right, left)
Where do FDs come from?
How NOT to find FDs and why not!
Why Normalizing Databases?
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.