The HAVING Clause

How can you qualify the data used in your GROUP BY clause? Use the table ORGCHART and try this:

						SELECT * FROM ORGCHART;

NAME            TEAM          SALARY   SICKLEAVE ANNUALLEAVE
=============== ======== =========== =========== ===========

ADAMS           RESEARCH    34000.00          34          12
WILKES          MARKETING   31000.00          40           9
STOKES          MARKETING   36000.00          20          19
MEZA            COLLECTIONS 40000.00          30          27
MERRICK         RESEARCH    45000.00          20          17
RICHARDSON      MARKETING   42000.00          25          18
FURY            COLLECTIONS 35000.00          22          14
PRECOURT        PR          37500.00          24          24

The MySQL equivalent is

 mysql> select * from orgchart; +------------+-------------+----------+-----------+-------------+ | name | team | salary | sickleave | annualleave | +------------+-------------+----------+-----------+-------------+ | ADAMS | RESEARCH | ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.