SQL COUNT(), AVG() and SUM() Aggregate Functions

SQL COUNT(), AVG() and SUM() Aggregate Functions

Instructor-svgAl-Mamun Sarkar
Apr 14 , 2020

SQL COUNT(), AVG() and SUM() Aggregate Functions. The following SQL queries show how to query count, how to query average value, query sum use SQL

 

SQL COUNT() Syntax:

SELECT COUNT(column)
FROM table_name
WHERE condition;

Example:

SELECT COUNT(id)
FROM employees;

 

SQL AVG Syntax:

SELECT AVG(column)
FROM table_name
WHERE condition;

Example:

SELECT AVG(salary)
FROM employees;

 

SQL SUM Syntax:

SELECT SUM(column)
FROM table_name
WHERE condition;

Example:

SELECT SUM(salary)
FROM employees;

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram