Developpement/23BDD/TP1-S2.sql

41 lines
669 B
SQL

//1
SELECT region, COUNT(*)
FROM Vin
GROUP BY region;
//2
SELECT nom, numvitic, COUNT(DISTINCT cru)
FROM Viticulteur NATURAL JOIN Vin
GROUP BY nom, numvitic;
//3
SELECT nom, numbuveur, AVG(ALL qtte)
FROM Buveur NATURAL JOIN Commande
WHERE ville = 'PARIS'
GROUP BY nom, numbuveur;
//4
SELECT numBuveur, COUNT (*)
FROM Commande
GROUP BY numBuveur;
//5
SELECT NumBuveur, SUM(qtte)
FROM Commande
GROUP BY NumBuveur
HAVING AVG(qtte)>=12;
//6
SELECT nom, numvitic
FROM viticulteur NATURAL JOIN vin
GROUP BY nom, numvitic
HAVING COUNT(DISTINCT cru) >= 2;
//7
SELECT numvin, cru, COUNT()
FROM
WHERE ;
//8
SELECT
FROM
GROUP BY
HAVING;
/*SELECT
FROM
WHERE
GROUP BY
HAVING*/