COUNT() function returns the number of rows that matches a specified condition.
Syntax โ
SELECT COUNT(ColumnName)
FROM <TableName>
WHERE<condition> ;
Example-
SELECT Count(ProductID)
FROM Products;
AVG() function returns the average value of a numeric column.
Syntax โ
SELECT AVG(ColumnName)
FROM <TableName>
WHERE<condition> ;
Example-
SELECT AVG(Price)
FROM Products;
SUM() function returns the sum value of a numeric column.
Syntax โ
SELECT SUM(ColumnName)
FROM <TableName>
WHERE<condition> ;
Example-
SELECT SUM(Quantity)
FROM OrderDetails;
Note-
Northwind sample database is used for examples.
Leave a Reply