BUT2/BD/TP01_Requetes_avec_agregats.txt

34 lines
594 B
Plaintext
Executable File

SELECT Region, COUNT(ALL NumVin)
FROM Vin
GROUP BY Region;
SELECT NUMVITIC, NOM, COUNT(ALL CRU)
FROM VITICULTEUR NATURAL JOIN VIN
GROUP BY NUMVITIC, NOM
SELECT NOM, NUMBUVEUR,AVG(ALL QTTE)
FROM BUVEUR NATURAL JOIN COMMANDE
WHERE VILLE='PARIS'
GROUP BY NOM, NUMBUVEUR;
SELECT NOM, COUNT(*)
FROM BUVEUR NATURAL JOIN COMMANDE
GROUP BY NOM;
SELECT NOM, SUM(ALL QTTE)
FROM BUVEUR NATURAL JOIN COMMANDE
GROUP BY NOM
HAVING AVG(ALL QTTE) >= 12;
SELECT NOM, NUMVITIC
FROM VITICULTEUR NATURAL JOIN VIN
GROUP BY NOM, NUMVITIC
HAVING COUNT(DISTINCT CRU) >= 2;