0 votes 0 votes The answer should be D, but C is provided as the answer. Databases gateforum-test-series databases sql + – Gupta731 asked Oct 24, 2018 • edited Mar 12, 2019 by akash.dinkar12 Gupta731 657 views answer comment Share Follow See all 17 Comments See all 17 17 Comments reply Sayan Bose commented Oct 24, 2018 reply Follow Share Yes D is correct. Don't practise from Gateforum tests. Standard is not good , also lots of wrong keys, poorly explained solutions 1 votes 1 votes Gupta731 commented Oct 24, 2018 reply Follow Share Hmm, Thanks I also feel the same. 0 votes 0 votes Shubhanshu commented Oct 24, 2018 reply Follow Share What is problem with C? 0 votes 0 votes Gupta731 commented Oct 24, 2018 reply Follow Share In C, group by is not given, but we can use it with aggregate functions. 0 votes 0 votes Sayan Bose commented Oct 24, 2018 reply Follow Share Without using group by, how will you use having? As you must be knowing that having is used to put conditions on groups 0 votes 0 votes Gupta731 commented Oct 24, 2018 reply Follow Share Yes. 0 votes 0 votes Shubhanshu commented Oct 24, 2018 reply Follow Share It is not mandatory that aggregate functions will be used in select clause only when group by is present in select statement. 0 votes 0 votes Gupta731 commented Oct 24, 2018 reply Follow Share But Sir, we also cannot use having without using group by. 0 votes 0 votes Dharmendra Lodhi commented Oct 24, 2018 reply Follow Share C is correct ans. how you would use aggregate function "IN" group by clause. 1 votes 1 votes Shubhanshu commented Oct 24, 2018 reply Follow Share 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 votes 0 votes Gupta731 commented Oct 24, 2018 reply Follow Share I think the question is only substandard with misleading question statement. 0 votes 0 votes Shubhanshu commented Oct 24, 2018 reply Follow Share Youp. 0 votes 0 votes Shaik Masthan commented Oct 24, 2018 reply Follow Share 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 votes 2 votes Deepanshu commented Oct 25, 2018 reply Follow Share 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 votes 0 votes aambazinga commented Oct 25, 2018 reply Follow Share @Shaik Masthan can you please provide an example where we are using aggregate function in group by clause. for rest all, i know. 0 votes 0 votes Shaik Masthan commented Oct 25, 2018 reply Follow Share 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 votes 0 votes aambazinga commented Oct 25, 2018 reply Follow Share ok. got it. thanks 0 votes 0 votes Please log in or register to add a comment.