SQL - Having Clause | Corona Updates

Having Clause


The HAVING clause enables you to specify conditions that filter which group result appear in the final results.
HAVING Clause is provided with the GROUP BY Statement.

Syntax :-


SELECT column_name(s)

FROM table_name

WHERE condition
GROUP BY column_name(s)

HAVING condition

ORDER BY column_name(s);

Example :Let's how to use HAVING clause statement in table.

Query :

SELECT id, name, marks

FROM student

GROUP BY marks

HAVING COUNT (marks) <=40;

Output : 

Following this example, which would display a record for a similar marks count that would be more than or equal to 40.

Post a Comment

0 Comments