Group by , having, avg, count
https://www.w3schools.com/sql/sql_groupby.asp
https://www.w3schools.com/sql/sql_having.asp
https://www.w3schools.com/sql/func_sqlserver_avg.asp
SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country;
SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country
HAVING COUNT(CustomerID) > 5;
SELECT AVG(Price) AS AveragePrice FROM Products;
COUNT (*) vs COUNT(column)
* includes columns with null values
column does not include column with null values
https://stackoverflow.com/questions/3003457/count-vs-countcolumn-name-which-is-more-correct
No comments:
Post a Comment