in Unknown Category
580 views
3 votes
3 votes

in Unknown Category
580 views

2 Answers

5 votes
5 votes
Best answer

We know in the execution flow of SQL query , having clause is imposed on the output of group by clause and having clause is hence used to select the groups  on the basis of some aggregate function like some() , sum() , avg() on some other attributes .

So if we are using other attributes it is necessary to use it with some aggregate functions as mentioned above..So according to the query the grouping of records is done on the basis of values of A and then using having clause , we select those groups which have corresponding no. of values of B for a given A is more than 1..

Hence it is clear that if we have non empty output , then we will have only those A values for which more than 1 B values exist..

Also we know by basic definition of Functional Dependency ,

A --> B holds only if there is a unique value of  B for a given A which is not the case here.Hence the FD  A --> B does not hold here provided the result is non empty..

Hence A) should be the correct option.


PS: If the result set is empty, then we cannot say FD is satisfied. Because there can be another instance of $R$ where it might be violated.

selected by

4 Comments

Corrected the answer...
0
0

However , if the result were empty , then it would mean we would have at most one value of B for a given A and hence the FD A --> B would hold in that case.

But this is not correct. If the result were empty- FD may or may not hold. Using one instance we cannot say FD does exist.

1
1
Ok sir ..Thanks for rectifying..
0
0
1 vote
1 vote

Option A.

The result will be non-empty only when there are multiple entries of attribute B to a corresponding entry of A.

e.g.

A | B

1  |  2

1  | 3

2  | 4

 

the above query will return 

A

------

1

Notice, that the dependency A-->B cannot hold. 

edited by
by