563 views

2 Answers

Best answer
5 votes
5 votes

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
1 votes
1 votes

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

Related questions

2 votes
2 votes
1 answer
1
reena_kandari asked Nov 8, 2016
588 views
0 votes
0 votes
1 answer
2
Shivangi Verma asked Nov 18, 2016
2,935 views
Can anybody explain main difference between Aggregation and Ternary relationship
1 votes
1 votes
1 answer
3
sh!va asked Jul 15, 2016
774 views
Spot the wrong statement.Subschema is related with external view only.Data dictionary is a tool used exclusively by the database administrator.To define a schema DDL, DML...