SQL query - Attributes, Having clause, Group by clause, Select clause

Q.  From the following statements which of them is/are true about SQL

1. All attributes used in the group by clause must appear in the select clause
2. An SQL query can contain a having clause only if it has a group by clause
3. An SQL query can contain a having clause even if it does not have a group by clause
4. Not all attributes used in the group by clause need to appear in the select clause

- Published on 16 Jun 15

a. 3 and 4
b. 1 and 2
c. 1,3 and 4
d. All of the above

ANSWER: 3 and 4
 
Statement number 3 is true because it considers the output by select query as a single group if group by statement is not present.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)