Introduction à Oracle SQL
Hadrien Lacroix
Content Developer
SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
SELECT BillingCountry, AVG(Total) > 100) AS Average
-> FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
-> WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
-> GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
-> HAVING AVG(Total) > 100
ORDER BY Average DESC
-> SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
SELECT BillingCountry, AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
-> ORDER BY Average DESC
SELECT BillingCountry,
AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
WHERE, GROUP BY et HAVINGORDER BYSELECT BillingCountry,
AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100
ORDER BY Average DESC
WHEREHAVINGSELECT BillingCountry,
AVG(Total) > 100) AS Average
FROM Invoice
WHERE BillingCity <> 'Paris'
GROUP BY BillingCountry
HAVING AVG(Total) > 100)
ORDER BY Average DESC
HAVINGWHEREFROM et JOIN : déterminer quelles données interroger
WHERE : filtrer les lignes individuelles
GROUP BY : regrouper les lignes
HAVING : filtrer les groupes
SELECT : choisir les colonnes et appliquer des fonctions
DISTINCT : retirer les doublons
UNION, UNION ALL, INTERSECT, MINUS : appliquer des opérateurs d'ensembles
ORDER BY : trier les lignes
Introduction à Oracle SQL