The HAVING clause does which of the following?

By Anjnee Bhatnagar|Updated : July 20th, 2022

The HAVING clause does which of the following?

  1. Acts like a WHERE clause but is used for groups rather than rows.
  2. Acts like a WHERE clause but is used for rows rather than columns.
  3. Acts like a WHERE clause but is used for columns rather than groups.
  4. Acts EXACTLY like a WHERE clause.

Answer:

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

Solution:

The HAVING clause of SQL is used for aggregate functions. It acts like a WHERE clause but is used for groups rather than rows. The WHERE clause applies conditions on the columns whereas the HAVING clause applies a condition to the groups formed by the GROUP BY clause. We can thus clearly eliminate options B, C, and D.

Comments

write a comment

Follow us for latest updates