GATE 2012 CS (CS1) – Question 25
Which SQL assertions are true? P: HAVING can occur without GROUP BY. Q: HAVING requires GROUP BY. R: Every GROUP BY attribute must appear in SELECT. S: GROUP BY attributes need not all appear in SELECT.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) Q and R
Explanation
The official key is C (Q and R), retained for historical grading. Under standard SQL, HAVING can apply to a single implicit group without an explicit GROUP BY, so P is true and Q false. Grouping columns need not all be projected, so S is true and R false. Thus B is the general SQL answer; the official C conflicts with those semantics.
More Relational Model: Relational Algebra, Tuple Calculus, SQL questions
- GATE 2012 CS (CS1) Q60
- GATE 2012 CS (CS1) Q61
- GATE 2013 CS (CS1) Q45
- GATE 2011 CS (CS1) Q42
- GATE 2011 CS (CS1) Q56
- GATE 2010 CS (CS1) Q29
All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →