Examveda

The HAVING clause does which of the following?

A. Acts like a WHERE clause but is used for groups rather than rows.

B. Acts like a WHERE clause but is used for rows rather than columns.

C. Acts like a WHERE clause but is used for columns rather than groups.

D. Acts EXACTLY like a WHERE clause.

Answer: Option A

Solution (By Examveda Team)

Option A: Acts like a WHERE clause but is used for groups rather than rows. - This option is correct. The HAVING clause in SQL is used to filter group rows that are returned by a GROUP BY clause, similar to how the WHERE clause filters individual rows.
Option B: Acts like a WHERE clause but is used for rows rather than columns. - This option is incorrect. The WHERE clause is used to filter rows based on a condition, whereas the HAVING clause filters grouped rows based on a condition.
Option C: Acts like a WHERE clause but is used for columns rather than groups. - This option is incorrect. The WHERE clause filters rows, and it does not filter columns.
Option D: Acts EXACTLY like a WHERE clause. - This option is incorrect because the WHERE and HAVING clauses serve different purposes in SQL.
Conclusion:
In SQL, the HAVING clause is used to apply a filter to the groups of rows returned by a GROUP BY clause, similar to how the WHERE clause filters individual rows. Therefore, the correct answer is Option A: Acts like a WHERE clause but is used for groups rather than rows.

This Question Belongs to Database >> Introduction To SQL

Join The Discussion

Related Questions on Introduction to SQL

The SQL WHERE clause:

A. limits the column data that are returned.

B. limits the row data are returned.

C. Both A and B are correct.

D. Neither A nor B are correct.