# Database: SELECT: HAVING

The HAVING clause indicates which rows to keep after GROUP BY has produced its rows. Typically it uses an aggregate function.

## Example - All countries with more than one Ed Center

First, let's look at the solution using GROUP BY that listed the count of Ed Centers in each country.

    /* Display countries and count of Ed Centers */
    SELECT edc_country, COUNT(*)
        FROM Ed_Centers
        GROUP BY edc_country
        ORDER BY edc_country;

We can add a HAVING clause to select only those summary lines which have more than one Ed Center

    /* Display countries with more than one Ed Centers */
    SELECT edc_country, COUNT(*)
        FROM Ed_Centers
        GROUP BY edc_country
        HAVING COUNT(*) > 1
        ORDER BY edc_country;