SQL Having

The HAVING clause in SQL is used to filter records that are grouped by the GROUP BY clause. Unike the WHERE clause, which operates on individual rows, the HAVING clause works on groups (or aggregates) of rows.

Tutorials dojo strip

SQL Having Syntax

SQL

SQL Having Basic Example

This query groups the result by doctor’s first and last name, counts how many appointments each doctor has, and filter out those with 2 or fewer appointments.

SQL

SQL Having Visual Diagram

SQL Having Labs

Tutorials dojo strip