Question 4322 – UGC NET CS 2006 Dec-paper-2
January 7, 2024
Question 8885 – ISRO CS 2020
January 7, 2024
Question 4322 – UGC NET CS 2006 Dec-paper-2
January 7, 2024
Question 8885 – ISRO CS 2020
January 7, 2024

Database-Management-System

Question 675
Given the following two statements about SQL:
a) An SQL query can contain HAVING clause only if it has GROUP BY clause
b) Not all attributes used in the GROUP BY clause need to appear in the SELECT clause
Which of the following is correct?
A
Both a and b are true
B
Both a and b are false
C
a is true, b is false
D
b is true, a is false
Question 675 Explanation: 
The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. The attributes used in GROUP BY clause must present in SELECT statement.
The HAVING Clause enables you to specify conditions that filter which group results appear in the results. The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause. So, we cannot use HAVING clause without GROUP BY clause.

Correct Answer: C
Question 675 Explanation: 
The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. The attributes used in GROUP BY clause must present in SELECT statement.
The HAVING Clause enables you to specify conditions that filter which group results appear in the results. The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause. So, we cannot use HAVING clause without GROUP BY clause.

Leave a Reply

Your email address will not be published. Required fields are marked *