1 of 14

IP

CLASS : XII

MySQL

Numeric & Aggregate Functions in MySQL

2 of 14

Learning Outcomes

  • Learn about Numeric Functions in MySQL

  • Learn about Aggregate Functions in MySQL

3 of 14

NUMERIC FUNCTIONS

1. MOD( )

2. POWER( )/POW( )

3. ROUND( )

4. SIGN( )

5. SQRT( )

6. TRUNCATE( )

The numeric functions are those functions that accept numeric values and after performing the required operation, return numeric values.

Some commonly used numeric functions are :

4 of 14

SNo

PName

Cost

1

Keyboard

730

2

Mouse

325

3

Projector

45000

4

Monitor

5600

Sample Table: Peripherals

5 of 14

1.MOD( )

This function returns modulus (i.e.,remainder) of given two numbers

Syntax: MOD(m,n), M%N, M MOD N

6 of 14

2.POWER( )/POW( )

This function returns mn

ie., a number m raised to the nth power.

7 of 14

3.ROUND( )

This function returns a number rounded off as per given specification.

8 of 14

  1.Avg( )   

2.Count( ) 

3.Min( )   

4.Max( )   

5. Sum( )

Aggregate Functions

In MySQL, aggregate functions are used to perform calculations on a set of values and return a single result.

These functions operate on multiple rows and produce a single value as the result.

Some commonly used aggregate functions are :

9 of 14

  1.Avg( ) 

This function computes the average of given data.

10 of 14

2. COUNT( )

This function counts the number of rows in a given column or expression.

11 of 14

3. MIN( )

This function returns the minimum value from a given column or expression.

12 of 14

4. MAX( )

This function returns the maximum value from a given column or expression.

13 of 14

5.SUM( )

This function returns the sum of values in a given column or expression.

14 of 14

 

 

Thank you Dear….