Вступ до 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 і 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 і JOIN: визначають, які дані запитуються
WHERE: фільтрує окремі рядки
GROUP BY: групує рядки
HAVING: фільтрує групи
SELECT: обирає стовпці та застосовує функції до них
DISTINCT: прибирає дублікати
UNION, UNION ALL, INTERSECT, MINUS: оператори над множинами
ORDER BY: впорядковує рядки
Вступ до Oracle SQL