Relational Database Design
Relational Database Design
• Write a rule “if there were a schema (dept_name, building, budget), then dept_name
would be a candidate key”
• Denote as a functional dependency:
• In inst_dept, because dept_name is not a candidate key, the building and budget of a
department may have to be repeated.
o This indicates the need to decompose inst_dept
• A Lossy Decomposition
• Atomicity is actually a property of how the elements of the domain are used.
o Example: Strings would normally be considered indivisible
o Suppose that students are given roll numbers which are strings of the form
CS0012 or EE1127
o If the first two characters are extracted to find the department, the domain of roll
numbers is not atomic.
o Doing so is a bad idea: leads to encoding of information in application program
rather than in the database.
o multivalued dependencies
FUNCTIONAL DEPENDENCIES
• Require that the value for a certain set of attributes determines uniquely the value for
another set of attributes.
• A functional dependency is a generalization of the notion of a key.
α ⊆ R and β ⊆ R
• α →β
holds on R if and only if for any legal relations r(R), whenever any two tuples t1 and t2 of
r agree on the attributes α , they also agree on the attributes β . That is,
t1[α ] = t2 [α ] ⇒ t1[β ] = t2 [β ]
K → R, and
for no α ⊂ K, α → R
dept_name→ building
and ID à building
but would not expect the following to hold:
dept_name → salary
Use of Functional Dependencies
We use functional dependencies to:
o test relations to see if they are legal under a given set of functional
dependencies.
If a relation r is legal under a set F of functional dependencies, we
say that r satisfies F.
o specify constraints on the set of legal relations
ID, name → ID
name → name
o In general, α → β is trivial if β ⊆ α