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.

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

\n

💻 Live Code Editor

Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.
Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.

💻 Live Code Editor

Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें. Agar load na ho to naye tab mein kholें.