in Databases edited by
600 views
0 votes
0 votes

The answer should be D, but C is provided as the answer.

in Databases edited by
600 views

17 Comments

Yes D is correct. Don't practise from Gateforum tests. Standard is not good , also lots of wrong keys, poorly explained solutions
1
1
Hmm, Thanks

I also feel the same.
0
0
What is problem with C?
0
0
In C, group by is not given, but we can use it with aggregate functions.
0
0
Without using group by, how will you use having? As you must be knowing that having is used to put conditions on groups
0
0
Yes.
0
0
It is not mandatory that aggregate functions will be used in select clause only when group by is present in select statement.
0
0
But Sir, we also cannot use having without using group by.
0
0
C is correct ans.
how you would use aggregate function "IN" group by clause.
1
1
May be I am taking options in other sense.

I am considering given pairs seperately, but I think the question is asking that both pairs should be present in statement simultaneously. Is that so??
0
0
I think the question is only substandard with misleading question statement.
0
0
Youp.
0
0

we also cannot use having without using group by.

this is false.... we can have a having clause without groupby clause.

select count(*)

from student

having count(*) > 2;

 

this query provide the output as no.of rows if no.of rows in student table is grater than 2 otherwise result nothing printed.

SQL contains having clause without groupby clause is meaningless but VALID.

But note that, if aggregate operator uses attributes, then groupby clause must present.

 

we have to consider each clause separetely,

where clause doesn't support aggregate operators ===> option a and b are ruledout

option c and option d both are correct.

2
2
the answer d is correct according to gate standard .

but c is correct to new standards of sql.

i think in gate they go with sql 93 as they go with basic sql so no doubt d is correct but if they go with higher versions like nowdays then c is also correct
0
0
@Shaik Masthan

can you please provide an example where we are using aggregate function in group by clause. for rest all, i know.
0
0

 aggregate function in group by clause. 

aggregate functions can't used by groupby clause.

 

in option D, " select groupby " means

you have grouped by some attribute ===> select statement should have the attributes used by groupby clause

and along with that it may have aggregate functions.

0
0
ok. got it. thanks
0
0

Please log in or register to answer this question.