-- GROUP BY

SELECT age FROM Employes;

SELECT Age FROM Employes GROUP BY Age;

SELECT Age, count(*) AS "Nombre d'employés" 
FROM Employes
GROUP BY Age;

-- GROUP BY & AVG

SELECT Age, AVG(Salaire) AS "Salaire moyen"
FROM Employes
GROUP BY Age;

-- HAVING (Cest le WHERE pour les functions aggregation)

SELECT Age, AVG(Salaire) AS "Salaire moyen"
FROM Employes
GROUP BY Age
HAVING AVG(Salaire)>6000;

-- Quels utilisateurs ont passé plus d'une commande?

SELECT utilisateur_id, COUNT(*) AS "Nombre de Commandes"
FROM commande
GROUP BY utilisateur_id
HAVING COUNT(*) > 1;
