How to reduce a Relational Model to make it more compact.
Armstrong’s Axioms
- Reflexivity:
- Augmentation:
- Transitivity:
Secondary Rules
- Decomposition:
- Composition:
- Union:
- Pseudo-transitivity:
- Identity:
- Extensivity:
Functional Dependency
def. Functional Dependency. If for all tuples in a relation that has the same values for attribute and attribute , then is functionally dependent on .
e.g. an address
relation with street, city, state, zip
zip
→(city, state)
- Zip code determines city and state
(zip, state)
→zip
- This is a Trivial dependency:=
zip
→(state,zip)
- This is non-trivial, but not complete,
- Complete Non-trivial dependency:=
alg. BCNF decomposition procedure. Given a set of dependencies and relation , BCNF decomposition determines a minimally redundant (=row-redundant) Relation.
- Choose (non-determinisitcally) a dependency in , let which is non-trivial (= is not a superkey)
- Decompose using into two relations
- has attributes
- has attributes
- Recurse procedure for
- It’s a non-deterministic process (=there can be multiple ways to decompose a relation). def. Closure. Given dependencies , the closure of set of attributes is all attributes determined by through those dependencies
Finding a Key Using Functional Dependencies
alg. Given set of functional dependencies on relation , find the keys of the schema
- For each dependencies , compute the closure of such that .
- If doesn’t contain all the attributes of , then augment such that it reaches all the attributes.
- i.e., let
- then, it must be
- Then, is a superkey of . let this be .
- Can you reduce this superkey ?
- Try taking out one attribute at a time from to create
- Is reducible?
- → Repeat until we reach something unreducible.
- ⇒ The final that is unreducible is a key.
- If doesn’t contain all the attributes of , then augment such that it reaches all the attributes.
- Repeat for all dependencies in .
Multi-value Dependency
def. Multi-value Dependency (MVD). is a multi-value dependency of if…
- for all tuples with the same values of …
- …if we swapped all the values of them…
- …those entries also exist in the database. then:
In colloquial terms, we can say that for every determined value of , all tuples with values of “associated” with that must exist too. def. Trivial MVD. Given relation :
- : Obvious.
- : Obvious.
def. 4th Normal Form (4NF). if every MVD in relation is such that is always a superkey, then relation is in the 4th Normal Form. Example
Multivalue Dependency Rules
- Complementation:
- Augmentation:
- Transitivity:
- Automatically means
- Replication:
- Coalescence: If 𝑋 ↠ 𝑌 and 𝑍 ⊆ 𝑌 and there is some 𝑊 disjoint from 𝑌 such that 𝑊 → 𝑍, then 𝑋 → 𝑍
Chase
Proving theorems about chase. Example: alg. Tuple Generation. To enforce on table
- For a determined
- Enumerate all availble
- Enumerate all available
- let
- Enumerate all availalbe
- Are all combinations available in the table?
- If not, add missing ones
- For another determined , repeat
- Repeat for all
alg. Chase. To prove …
- Initialization: add two tuples to the initial table
- For each MVD (order doesn’t matter):
- Tuple Generation: see above
- For each FD (order doesn’t matter):
- You may infer equalities, e.g.
- Does fully available? (= all in table)?
- Yes → proven
- No → disproven (counterexample)