Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
70 views

Aggregate Functions: Name:N.Madhuniga Reg - No: 293575057 Dept: It

The document discusses aggregate functions in SQL including AVG, MIN, MAX, SUM, COUNT, VARIANCE, and STDDEV. It provides the syntax and description for each function and demonstrates examples of using each function to aggregate data from a Student table. It summarizes that the aggregate functions were executed and verified on the sample data.

Uploaded by

Kowsalya Sankar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Aggregate Functions: Name:N.Madhuniga Reg - No: 293575057 Dept: It

The document discusses aggregate functions in SQL including AVG, MIN, MAX, SUM, COUNT, VARIANCE, and STDDEV. It provides the syntax and description for each function and demonstrates examples of using each function to aggregate data from a Student table. It summarizes that the aggregate functions were executed and verified on the sample data.

Uploaded by

Kowsalya Sankar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

NAME :N.MADHUNIGA REG.

NO : 293575057 DEPT : IT

AGGREGATE FUNCTIONS
The Aggregate Functions are :

 AVG
 MIN
 MAX
 SUM
 COUNT

AVG :

Syntax:
select avg(<field_name>) from <table_name>;

Description:
Determines the Average of the specified values of column, ignoring null values.

MIN :

Syntax:
select min(<field_name>) from <table_name>;

Description:
Determines the Minimum value of a specified column, ignoring null values.

MAX :

Syntax:
select max(<field_name>) from <table_name>;
Description:
Determines the Maximum value of a specified column, ignoring null values.

SUM :

Syntax:
select sum(<field_name>) from <table_name>;

Description:
Determines the Sum of a specified column, ignoring null values.

COUNT :

Syntax:
select count(*) from <table_name>;
select count(<field_name>) from <table_name>;

Description:
Determines the Total number of vales of a specified column.

VARIANCE :

Syntax:
select variance(<field_name>) from <table_name>;

Description:
Determines the Variance of expression, ignoring null values.

STDDEV :

Syntax:
select stddev(<field_name>) <table_name>;

Description:
Determines the Standard deviation of a specified column, ignoring null values.
PROGRAM TO LEARN AGGREGATE FUNCTIONS

SQL> select * from Student;

REGNO NAME MARKS


--------------------- --------------------- ---------------------
1 A 100
2 B 98
3 C 95
4 D 85
5 E 75

SQL> select AVG(marks) from Student;

AVG(MARKS)
---------------------------
90.6

SQL> select MIN(marks) from Student;

MIN(MARKS)
---------------------------
75

SQL> select MAX(marks) from Student;

MAX(MARKS)
---------------------------
100

SQL> select COUNT(marks) from Student;

COUNT(MARKS)
---------------------------
5
SQL> select COUNT(*) from Student;

COUNT(*)
---------------------------
5

SQL> select SUM(marks) from Student;

SUM(MARKS)
---------------------------
453

SQL> select VARIANCE(marks) from Student;

VARIANCE(MARKS)
---------------------------
109.3

SQL> select STDDEV(marks) from Student;

STDDEV(MARKS)
---------------------------
10.454664

SQL>

RESULT :
Thus, the Aggregate Functions are executed and verified.

You might also like