Functional Dependencies

# Functional Dependencies - FUNCTIONAL DEPENDENCY R A1 A2 An...

This preview shows pages 1–5. Sign up to view the full content.

FUNCTIONAL DEPENDENCY R( A 1 , A 2 ,..., A n ):arelation SCHEMA X R ,and Y R :attributes in R r ( R ): a specific relation of type R •R satisfies the functional dependency (fd) X Y if each specific relation (relational VALUE) r(R) satisfies X Y. •A relation value r satisfies X Y if each X-value in r is associated with a unique Y-value in r. In other words, a relation value r satisfies X Yif for anytwo tuples t 1 and t 2 in r, t 1 [X] = t 2 [X] t 1 [Y] = t 2 [Y]. Consider the relation schema SP (S#, P#, QTY ,STATUS). Relation value r(SP )for the relation schema SP S# P# QTY STATUS s1 p1 100 30 s1 p2 200 30 s2 p1 100 50 s2 p3 100 50 Which functional dependencies are satisfied by this relation value?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
-2- •F ull functional dependenc yVS. partial functional depen- dency Attribute Y is fully functionally dependent on attribute X, if X Y, but we do NOThav e X ′→ Yfor anyproper sub- set X of X. Consider relation R(MOTHER, CHILD, GIFT ,DATE), with functional dependencies F={CHILD MOTHER, (CHILD, DATE) GIFT}. is the attribute MOTHER fully functionally dependent on (CHILD, DATE)? The answer is: NO. Because CHILD MOTHER, and thus MOTHER is depen- dent on a proper subset of (CHILD, DATE). Attribute MOTHER is partially dependent on (CHILD, DATE). Consider the following sample data (relation value) for the relation R: MOTHER CHILD GIFT DATE Linda Jim Bik e1 -20-2009 Linda Jim Sweater 12-25-2008 Linda Jim CD 3-8-2007 Linda Mary Game 12-25-2008 Linda Mary Book 2-20-2006 Susan David CD 7-20-2009 Susan David Shoes 8-30-2009 Do you see anyproblems (redundancy, etc.) from the above sample data?
-3- EXAMPLE OF FUNCTIONAL DEPENDENCY The twomost important things to remember about functional dependency (fd) are: (1) Fd’ sare determined by the meaning of the attributes and their role in the "real world" which is being modeled by the database. (2) Fd’sare in turn used to group the attributes together to form the normalized relations of the database. Example. Consider the attributes CC lass (of a course) TT ime for the class RR oom for the class II nstructor of the class which describe the arrangement of room and time for classes taught by the instructors. These attributes are used to model part of the "real world". Wehav e certain constraints about the objects in the "real world"s: (1) No twoinstructors teach the same course. (2) At anytime and in a givenroom, there is at most one class being taught there. (3) No class can be taught at one giventime in tworooms. (4) No instructor can teach twoclasses at one giventime.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
-4- The functional dependencies are: (a) C I (b) TR C (c) CT R (d) IT C Givenbelowi sadatabase which has some tuples violating the above functional dependencies.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 15

Functional Dependencies - FUNCTIONAL DEPENDENCY R A1 A2 An...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online