SQL GROUP BY Keyword

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







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



SQL GROUP BY Keyword


❮ SQL Keywords Reference



GROUP BY


The GROUP BY command is used to group the result set (used with aggregate functions: COUNT, MAX, MIN, SUM,
AVG).


The following SQL lists the number of customers in each country:



Example



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


Try it Yourself

The following SQL lists the number of customers in each country,
sorted high to low:



Example



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

ORDER BY COUNT(CustomerID) DESC;


Try it Yourself



❮ SQL Keywords Reference