CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

MySQL Math Function

 

MySQL Math Function

MySQL provides different Mathematics functions to perform Math operations. In your syllabus we have to learn these three functions:

1. POWER ( ) or POW( ) 

The MySQL POWER function returns m raised to the nth power. (mn)
Ex:- 32 = 9

Syntax:
POWER( m, n ) OR POW( m, n)

Parameters or Arguments:
m: Numeric value. It is the base used in the calculation.
n: Numeric value. It is the exponent used in the calculation.

2. ROUND ( ) 

Returns a number rounded to a certain number of decimal places.
– Ex:- 12.265 rounded to 2 decimal points 12.27 .

Syntax:
ROUND( number, [ decimal_places ] )

Parameters or Arguments:
number: The number to round.
decimal_places: The number of decimal places to round. This value must be a positive or negative integer. If this parameter is omitted, the ROUND function will round the number to 0 decimal places.

3. MOD ( ) 

Returns the remainder of n divided by m.
– Ex:- 5 %  2  =  1 

Syntax:
MOD( n, m )  OR  n MOD m  OR  n % m

Parameters or Arguments:
n: Number.
m: Devisor.



No comments:

Post a Comment