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);
Query :
Output :
SELECT id, name, marks
FROM student
GROUP BY marks
HAVING COUNT (marks) <=40;
Following this example, which would display a record for a similar marks count that would be more than or equal to 40.
0 Comments