Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Study of errors committed in the identification of FDs A novel approach of teaching FDs, using logical implication operators.

Made by: AMRITA, CSE 5th semester

29/09/2012

Let

R={A1, A2,A3,.,An} be a relational schema having n attributes, i.e., A1, A2,A3,.,An. According to codd, A FD denoted by f:X Y, between two sets of attributes X,YR, specifies a constraint on the possible tuples that can form a relation state r of R. Constraint :If t i and t j are two tuples in a relation r, FD f:X Y exists if and only if t i[X] =t j [X], then t i [Y] =t j [Y], where t i represents tuple of i th row, t j represents tuple of j th row.

Made by: AMRITA, CSE 5th semester

29/09/2012

Then

R satisfies the FD f:X Y, if a given set of values for each attribute in X uniquely determines each of the values of the attribute in Y, i.e., Y is functionally dependent on X. If R represents an entity and set X of attributes represents the key of R, then for any other set of attribute Y of R, X Y. This is because the key of relation identifies a tuple and hence a particular instance of corresponding entity.

Made by: AMRITA, CSE 5th semester

29/09/2012

Social

security Number determines Employee name SSNENAME Project number determines project name and no. of hours PNUMBERPNAME, HOURS}

Made by: AMRITA, CSE 5th semester

29/09/2012

To test a given set of relations and to verify whether they are legal under a given set of FDs. Secondly, to specify constraints on the set of legal relations.

Made by: AMRITA, CSE 5th semester

29/09/2012

What happens when no two tuples in a relation schema have same values of X, then whether there will be a FD or not?

Made by: AMRITA, CSE 5th semester

29/09/2012

To

avoid all ambiguities, we use logical implication operator to find out the existing FDs. Logical implication operator(): It is a binary truth functional operator that takes the form: if a then b, where a and b denotes the statements variables.

Made by: AMRITA, CSE 5th semester

29/09/2012

A:antecedent,

B:consequent The truth of the antecedent is a sufficient condition for the truth of the consequent. The truth of the consequent is a necessary condition for the truth of the antecedent.

An alternative definition of FDs states the expression f:X Y is logically equivalent to the formula XY

Made by: AMRITA, CSE 5th semester

29/09/2012

X
T F T F

Y
T T F F

XY
T T F T
Made by: AMRITA, CSE 5th semester 29/09/2012 9

TABLE 1

ROW1:

If X is true, i.e., t i[X] =t j[X] and Y is true, i.e., t i [Y] =t j[Y], then the implication statement is true and also the FD f:X Y holds. ROW2: If X is false, i.e., t i *X+t j [X] and Y is true, i.e., t i [Y] =t j [Y], then the implication statement is true and also the FD f:X Y holds.

Made by: AMRITA, CSE 5th semester

29/09/2012

10

ROW3:

If X is false, i.e., t i *X+t j [X] and Y is also false, i.e., t i *Y+t j [Y], then the implication statement is true and also the FD f:X Y holds. ROW4: If X is true, i.e., t i [X]=t j [X] but Y is false, i.e., t i *Y+t j [Y], then the implication statement is false and the FD f:X Y does not hold. This is the only condition that determines the nonexistence of FD.

Made by: AMRITA, CSE 5th semester

29/09/2012

11

Relation

Faculty_Load gives the allocation of subjects to different faculties.


TABLE 2:

Made by: AMRITA, CSE 5th semester

29/09/2012

12

Lets

determine the existence/ non-existence of the following FDs: 1)SubjectSubject_Code 2)Faculty_IdDesignation 3)Faculty_IdFaculty_Name 4)DesignationSubject

Made by: AMRITA, CSE 5th semester

29/09/2012

13

Use,First

row of the Table1, i.e., X-TRUE and Y- TRUE. We can see that for tuple t1 and t2, t1[subject]=t2[subject]=CG, then for the existence of FD, we must have t1[Subject_Code]=t2[Subject_Code] which is IT-301E. So, for these two tuples t1 and t2, the definition of FD is satisfied. Similarly for the tuples t3 and t4.

Made by: AMRITA, CSE 5th semester

29/09/2012

14

Now,

for verifying the non-existence of FD, we must check the fourth condition, i.e., ti[X]=tj[X] but ti[Y]tj[Y]. This condition doesnt exist since all the instances of tuple having equal value in Subject attribute is also having the same Subject_Code attribute.

Made by: AMRITA, CSE 5th semester

29/09/2012

15

Use the second condition of table1, i.e., X is FALSE and Y is TRUE. All tuples of Faculty_Id attribute are unique, i.e., t i [Faculty_Id]t j [Faculty_Id] but some tuples of designation have the same values such as t1[Designation]=t2[Designation]=Lecturer. This corresponds to X-False and Y-True condition. Hence the FD holds.

Made by: AMRITA, CSE 5th semester

29/09/2012

16

This

dependency can be determined from the fourth condition of table1. Here no two tuples have of attributes Faculty_Id and Faculty_Name have the same values i.e., t i [Faculty_Id]t j [Faculty_Id] and t i [Faculty_Name]t j [Faculty_Name]. This corresponds to X-FALSE and Y-FALSE condition of table1. Accordingly, Faculty_Id determines Faculty_Name and the FD holds.

Made by: AMRITA, CSE 5th semester

29/09/2012

17

Using

third condition of Table1, i.e., X-TRUE and YFALSE this is not FD. Which means t i [X]=t j [X] but t i [Y]t j [Y]. In tuples t5 and t6, t5[Designation]=t6[Designation]=Assistant professor but the tuples t5 and t6 of subject are not equal t5[Subject]=CN, t6[Subject]=RAD. Thus Designation doesnt functionally determine Subject.

Made by: AMRITA, CSE 5th semester

29/09/2012

18

FDE1:

This error occurs when no two tuples of the X attribute and Y attribute have same values, i.e., t i *X+t j [X] and t i *Y+t j [Y] for any two tuples X and Y. This case occurs when both X and Y are keys and the FD holds. FDE2:This error occurs when no two tuples of the X attribute are same but some of the tuples of Y are same, i.e., t i *X+t j [X] but t i [Y]=t j [Y]. Students may get confused and conclude that FD doesnt hold, just because they are not able to find any 2 tuples t i and t j where t i [X]=t j [X] FDE3:Sometimes the students may forget to check each instance of tuple for FD. This may lead to false FD.
Made by: AMRITA, CSE 5th semester 29/09/2012 19

100

90
80 70 60 50 40 30 20 BEFORE

AFTER

10
0 RPE1 RPE2 FDE3 The percentage of students who answered correctly
Made by: AMRITA, CSE 5th semester 29/09/2012 20

You might also like