BEST SITE FOR WEB DEVELOPERS

SQL Tutorial

SQL HOME SQL Intro SQL Syntax SQL SELECT SQL SELECT DISTINCT SQL WHERE SQL ORDER BY SQL AND SQL OR SQL NOT SQL INSERT INTO SQL NULL Values SQL UPDATE SQL DELETE SQL SELECT TOP SQL Aggregate Functions SQL MIN() and MAX() SQL COUNT SQL SUM SQL AVG SQL LIKE SQL Wildcards SQL IN SQL BETWEEN SQL Aliases SQL JOIN SQL INNER JOIN SQL LEFT JOIN SQL RIGHT JOIN SQL FULL OUTER JOIN SQL Self Join SQL UNION SQL GROUP BY SQL HAVING SQL EXISTS SQL ANY, ALL SQL SELECT INTO SQL INSERT INTO SELECT SQL CASE SQL NULL Functions SQL Stored Procedures SQL Comments SQL Operators

SQL Database

SQL CREATE DATABASE SQL DROP DATABASE SQL BACKUP DATABASE SQL CREATE TABLE SQL DROP TABLE SQL ALTER TABLE SQL Constraints SQL NOT NULL SQL UNIQUE SQL PRIMARY KEY SQL FOREIGN KEY SQL CHECK SQL DEFAULT SQL CREATE INDEX SQL AUTO INCREMENT SQL Dates SQL CREATE VIEW SQL Injection SQL Hosting SQL Data Types

SQL References

SQL Keywords MySQL Functions SQL Server Functions MS Access Functions SQL Quick Ref

SQL Examples

SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Bootcamp SQL Certificate

SQL. Lessons for beginners

Ua Es De Fr

SQL Aggregate Functions


SQL Aggregate Functions

An aggregate function is a function that performs a calculation on a set of values, and returns a single value.

Aggregate functions are often used with the GROUP BY clause of the SELECT statement. The GROUP BY clause splits the result-set into groups of values, and the aggregate function can be used to return a single value for each group.

The most commonly used SQL aggregate functions are:

  • MIN() - returns the smallest value within the selected column
  • MAX() - returns the largest value within the selected column
  • COUNT() - returns the number of rows in a set
  • SUM() - returns the total sum of a numerical column
  • AVG() - returns the average value of a numerical column

Aggregate functions ignore null values (except for COUNT()).

We will go through the aggregate functions above in the next chapters.