- Let R be a relation schema o _ R and | _ R The functional dependency o | 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 o, they also agree on the attributes |. That is, t1[o] = t2 [o] t1[| ] = t2 [| ]
- K is a superkey for relation schema R if and only if K R
- K is a candidate key for R if and only if K R, and for no o c K, o R
- In general, o | is trivial if | _ o
- A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form o | where o _ R and | _ R, at least one of the following holds: o o | is trivial (i.e., | _ o) o o is a superkey for R
- Suppose we have a schema R and a nontrivial dependency o | causes a violation of BCNF. We decompose R into: (o U | ) ( R- (|o) )
- A relation schema R is in third normal form (3NF) if for all: o | in F+ at least one of the following holds: l o | is trivial (i.e., | e o) l o is a superkey for R l Each attribute A in | o is contained in a candidate key for R. (NOTE: each attribute may be in a different candidate key)
- The set of all functional dependencies logically implied by F is the closure of F.
- We denote the closure of F by F+.
- We can find all of F+ by applying Armstrongs Axioms: l if | _ o, then o | (reflexivity) l if o |, then o | (augmentation) l if o |, and | , then o (transitivity) - We can further simplify manual computation of F+ by using the following additional rules. o l If o | holds and o holds, then o | holds (union) o l If o | holds, then o | holds and o holds (decomposition) o l If o | holds and | o holds, then o o holds (pseudotransitivity)
- a canonical cover of F is a minimal set of functional dependencies equivalent to F, having no redundant dependencies or redundant parts of dependencies.
- Consider a set F of functional dependencies and the functional dependency o | in F. o l Attribute A is extraneous in o if A e o and F logically implies (F {o |}) {(o A) |}. o l Attribute A is extraneous in | if A e | and the set of functional dependencies (F {o |}) {o (| A)} logically implies F.
- testing for 3NF has been shown to be NPhard
- Let R be a relation schema with a set of attributes that are partitioned into 3 nonempty subsets. Y, Z, W We say that Y Z (Y multidetermines Z ) if and only if for all possible relations r (R )
< y1, z1, w1 > e r and < y1, z2, w2 > e r then < y1, z1, w2 > e r and < y1, z2, w1 > e r
( Note: that since the behavior of Z and W are identical it follows that Y Z if Y W )
- That is, every functional dependency is also a multivalued dependency.
- A relation schema R is in 4NF with respect to a set D of functional and multivalued dependencies if for all multivalued dependencies in D+ of the form o |, where o _ R and | _ R, at least one of the following hold: l o | is trivial (i.e., | _ o or o | = R) l o is a superkey for schema R
- If a relation is in 4NF it is in BCNF
- Join dependencies generalize multivalued dependencies lead to projectjoin normal form (PJNF) (also called fifth normal form)
- Triggering event can be insert, delete or update
- Triggers on update can be restricted to specific attributes l E.g. create trigger overdrafttrigger after update of balance on account
- Values of attributes before and after an update can be referenced l referencing old row as : for deletes and updates l referencing new row as : for inserts and updates
- Triggers can be activated before an event, which can serve as extra constraints. E.g. convert blanks to null.
create trigger setnulltriger before update on r referencing new row as nrow for each row when nrow.phonenumber = set nrow.phonenumber = null
- Instead of executing a separate action for each affected row, a single action can be executed for all rows affected by a transaction l Use for each statement instead of for each row l Use referencing old table or referencing new table to refer to temporary tables (called transition tables) containing the affected rows l Can be more efficient when dealing with SQL statements that update a large number of rows
- with grant option: allows a user who is granted a privilege to pass the privilege on to other users. Example:
grant select on branch to U1 with grant option
(gives U1 the select privileges on branch and allows U1 to grant this privilege to others)
- Primary index: in a sequentially ordered file, the index whose search key specifies the sequential order of the file. l Also called clustering index l The search key of a primary index is usually but not necessarily the primary key. - Secondary index: an index whose search key specifies an order different from the sequential order of the file. Also called nonclustering index. o Index record points to a bucket that contains pointers to all the actual records with that particular searchkey value. o Secondary indices have to be dense
- Dense index Index record appears for every searchkey value in the file.
- Sparse Index: contains index records for only some searchkey values. Applicable when records are sequentially ordered on searchkey.