MySQL + SQL · Lesson 55

Aggregate Functions in MySQL

What are Aggregate Functions?

Aggregate functions work on many rows and return a single summary value — like a total or average.

The Five Functions

FunctionReturns
COUNT()number of rows
SUM()total
AVG()average
MAX()highest
MIN()lowest

Examples

SELECT COUNT(*) FROM students;
SELECT SUM(marks) FROM students;
SELECT AVG(marks) FROM students;
SELECT MAX(marks), MIN(marks) FROM students;
Each query returns one summary number for the whole table.

Summary

  • Aggregate functions summarise many rows into one value.
  • COUNT, SUM, AVG, MAX, MIN.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp