KnowledgeBoat Logo

Computer Science

Assertion (A): The HAVING clause is used with GROUP BY clause and aggregate functions.

Reasoning (R): WHERE clause specifies the condition on individual rows or records.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

SQL Queries

3 Likes

Answer

Both A and R are true but R is not the correct explanation of A.

Explanation
The HAVING clause is used in combination with the GROUP BY clause. It allows aggregate functions to be used along with the specified condition. This is necessary because aggregate functions cannot be used with the WHERE clause, which is evaluated on a single row, whereas aggregate functions are evaluated on a group of rows specified by the GROUP BY clause.

Answered By

3 Likes


Related Questions