14 October 2019
Database(17) -- Review(2)
by Jerry Zhang
Keys of Relations
We say a set of one or more attributes {A1, A2,…,An} is a key for a relation R if:
- Those attributes functionally determine all other attributes of the relation. That is, it is impossible for two distinct tuples of R to agree on all of A1,A2,…,An.
- No proper subset of {A1,A2,…,An} functionally determines all other attributes of R; i.e., a key must be minimal.
superkey, short for “superset of a key.”
Equivalence of FD
- Two sets of FD’s S and T are equivalent if the set of relation instances satisfying S is exactly the same as the set of relation instances satisfying T.
- More generally, a set of FD’s S follows from a set of FD’s T if every relation instance that satisfies all the FD’s in T also satisfies all the FD’s in S.
Trivial FD
A trivial FD has a right side that is a subset of its left side.
The Transitive Rule
If A1A2…An -> B1B2…Bm and B1B2…Bm -> C1C2…Ck hold in relation R, then A1A2…An -> C1C2…Ck also holds in R.
Minimal basis
A minimal basis for a relation is a basis B that satisfies three conditions:
- All the FD’s in B have singleton right sides.
- If any FD is removed from B, the result is no longer a basis.
- If for any FD in B we remove one or more attributes from the left side of F, the result is no longer a basis.