When do we use a HAVING clause?

Options
- To limit the output of a query
- To limit the output of a query using an aggregate function only
- When GROUP by is used
- both b and c


CORRECT ANSWER : To limit the output of a query using an aggregate function only

Discussion Board
When do we use a HAVING clause?

It is not necessary that having is always used with group by , if you are not using group by than also you can use having, But it will as a where condition.

Exp: select val from demo having val =10;

Gaurav 03-30-2017 03:21 PM

Wrong answer?

Hello, the having clause works without any aggregate function in MySQL and it acts like a standard where. At least on MySQL 5. Microsoft SQL does not allow having without an aggregate function.

Mihai 04-30-2016 10:16 AM

When do we use a HAVING clause?

Ambiguous question :(
HAVING is used to limit queries with aggregate functions. But aggregate functions have little value without GROUP BY.

Especially because "When GROUP by is used" isn't written as "Always when GROUP by is used"!

CoR 04-21-2016 06:10 AM

When do we use a HAVING clause?

I think the answer of this is - both b and c above


Yugant.com 02-6-2015 08:50 AM

Write your comments


Enter the code shown above:

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


Advertisement