The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
92 views

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

asked in Databases by Active (4.5k points)
edited by | 92 views
+1
Yes D is correct. Don't practise from Gateforum tests. Standard is not good , also lots of wrong keys, poorly explained solutions
0
Hmm, Thanks

I also feel the same.
0
What is problem with C?
0
In C, group by is not given, but we can use it with aggregate functions.
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
Yes.
0
It is not mandatory that aggregate functions will be used in select clause only when group by is present in select statement.
0
But Sir, we also cannot use having without using group by.
0
C is correct ans.
how you would use aggregate function "IN" group by clause.
0
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
I think the question is only substandard with misleading question statement.
0
Youp.
+2

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.

0
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
@Shaik Masthan

can you please provide an example where we are using aggregate function in group by clause. for rest all, i know.
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
ok. got it. thanks

Please log in or register to answer this question.

Related questions

0 votes
0 answers
3
asked Nov 3, 2018 in Databases by Gupta731 Active (4.5k points) | 44 views
0 votes
0 answers
4
asked Nov 1, 2018 in Databases by Gupta731 Active (4.5k points) | 36 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,814 questions
54,521 answers
188,387 comments
75,421 users