2 min read

Aggregate functions in SQL

SQL aggregation function is used to perform the calculations on multiple rows of a single column of a table. It returns a single value. It is also used to summarize the data.
Aggregate functions in SQL
https://static.javatpoint.com/dbms/images/dbms-sql-aggregate-functio.png

1. COUNT FUNCTION

  • COUNT function is used to Count the number of rows in a database table. It can work on both numeric and non-numeric data types.
  • COUNT function uses the COUNT(*) that returns the count of all the rows in a specified table. COUNT(*) considers duplicate and Null.

SELECT COUNT(*)

FROM PRODUCT_MAST;

2. SUM Function

Sum function is used to calculate the sum of all selected columns. It works on numeric fields only.

SELECT SUM(COST)
FROM PRODUCT_MAST;

3. AVG function

The AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all non-Null values.
Example:

SELECT AVG(COST)
FROM PRODUCT_MAST;

4. MAX Function

MAX function is used to find the maximum value of a certain column. This function determines the largest value of all selected values of a column.

Example:

SELECT MAX(RATE)
FROM PRODUCT_MAST;

5. MIN Function

MIN function is used to find the minimum value of a certain column. This function determines the smallest value of all selected values of a column.
Example:

SELECT MIN(RATE)
FROM PRODUCT_MAST;

DBMS SQL Aggregate function - javatpoint
DBMS SQL Aggregate function with DBMS Overview, DBMS vs Files System, DBMS Architecture, Three schema Architecture, DBMS Language, DBMS Keys, DBMS Generalization, DBMS Specialization, Relational Model concept, SQL Introduction, Advantage of SQL, DBMS Normalization, Functional Dependency, DBMS Schedu…
https://www.javatpoint.com/dbms-sql-aggregate-function

#SQL #MIN #COUNT #MAX #SUM #AVG #Probyto #ProbytoAI

Subscribe and follow us for latest news in Data Science, Machine learning, technology and stay updated!

Facebook: https://facebook.com/probyto
Twitter: https://twitter.com/probyto
LinkedIn: https://linkedin.com/company/probyto
Instagram: https://instagram.com/probyto