SUM, AVG & COUNT

SUM

SUM() is used to calculate the total numeric sum of a column, i.e. all the numeric values will be added and will be displayed as result.

SYNTAX

select SUM(columnname) 
from tablename 
where condition;

EXAMPLE

select SUM(Score)
from students;

AVG

AVG() returns the average of the numeric values of a specific column.

SYNTAX

select AVG(columnname) 
from tablename 
where condition;

EXAMPLE

select AVG(Score)
from students;

COUNT

COUNT() returns the number of rows that matches a specified criterion.

SYNTAX

select AVG(columnname) 
from tablename 
where condition;

EXAMPLE

select COUNT(Class)
from students;

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started