SQL HAVING Keyword

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );



SQL HAVING Keyword


❮ SQL Keywords Reference



HAVING


The HAVING command is used instead of WHERE with aggregate functions.


The following SQL lists the number of customers in each country.
Only include countries with more than 5 customers:



Example



SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country

HAVING COUNT(CustomerID) > 5;


Try it Yourself »

The following SQL lists the number of customers in each country,
sorted high to low (Only include countries with more than 5 customers):



Example



SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country
HAVING COUNT(CustomerID)
> 5

ORDER BY COUNT(CustomerID) DESC;


Try it Yourself »



❮ SQL Keywords Reference


Popular posts from this blog

Malaysia to Papua New Guinea by motorcycle?

List of Bhojpuri films

.name