# MySQL Numeric Functions

MySQL provides various built-in Mathematical or Numeric and trigonometric functions to perform different operations on numerical data. In this study, we show you the list of MySQL Numeric and Trigonometric functions with an example of each one of them.

## MySQL Numeric Functions

The following is the list of MySQL Mathematical and Trigonometric functions that are available to work with numerical data.

## MySQL Numeric Functions Examples

The following examples help you to understand these trigonometric or mathematical functions in MySQL.

### MySQL Trigonometric Functions Example

In this example, we are going to use the ABS to find the absolute positive value. Next, we used the ACOS and ASIN methods to find the Arc cosine and Arc Sine values.

`SELECT ABS(10), ABS(-32), ABS(-44), ABS(-23.32);SELECT ACOS(1), ACOS(0), ACOS(0.5), ACOS(0.75);SELECT ASIN(0), ASIN(0.25), ASIN(0.50), ASIN(1);`

### MySQL Trigonometric Functions Example 2

In this example, we are going to use the ATAN and ATAN2 to find the Arctangent value of single and double arguments. Next, we used the COS to find the Cosine value.

`SELECT ATAN(4), ATAN(24), ATAN(-32);SELECT ATAN2(1, 5), ATAN2(-2, 3), ATAN(3.5, 0);SELECT COS(0), COS(1), COS(2.5), COS(0.25);`

### MySQL CEIL, CEILING, CONV Example 3

In this example, we are going to use CEIL, CEILING, to find the closest value. Next, we applied the CONV method to convert the given value based on the given base.

`SELECT CEIL(1.25), CEIL(1.95), CEIL(-2.3), CEIL(-2.90);SELECT CEILING(7.98), CEILING(6.01), CEILING(-22.93);SELECT CONV('A', 16, 2), CONV('G', 18, 8);`

### Numeric Functions Example 4

In this instance, we are going to use the MySQL COT, DEGREES, and EXP mathematical functions.

`SELECT COT(5), COT(1), COT(15);SELECT DEGREES(3.14), DEGREES(PI() / 2), DEGREES(2);SELECT EXP(0), EXP(2), EXP(-2);`

### MySQL Mathematical Functions Example 5

In this example, we are going to apply the EXP, FLOOR, and FORMAT.

`SELECT EXP(0), EXP(2), EXP(-2);SELECT FLOOR(2.89), FLOOR(2.05), FLOOR(-2.25), FLOOR(-2.97);SELECT FORMAT(543212.1245, 2), FORMAT(1121343.87965, 4);`

### MySQL LN, LOG, and LOG2 Example 6

In this example, we are going to practice the LN, LOG, and LOG2 to find the Natural Logarithmic Value and Log base 2 value.

`SELECT LN(2), LN(5), LN(-5);SELECT LOG(2), LOG(2, 250), LOG(10, 250);SELECT LOG2(250), LOG2(24567), LOG2(-23234);`

### Numeric Functions Example 7

Here, we will use the LOG10 function to find the Logarithmic value of base 10. Next, the MOD finds the remainder and the PI method to get the PI value.

`SELECT LOG10(250), LOG10(1000), LOG10(2500);SELECT MOD(250, 7), MOD(59, 9), 600 MOD 16;SELECT PI(), PI() MOD 2;`

### MySQL POW, POWER, RADIANS Example 8

In this MySQL Mathematical functions example, we use the POW and POWER to find the Power. Next, we applied the RADIANS to convert Degrees to radians.

`SELECT POW(3, 2), POW(25, 5), POW(16, 2);SELECT POWER(3, 2), POWER(25, 5), POWER(16, 2);SELECT RADIANS(90), RADIANS(180), RADIANS(360);`

### MySQL Mathematical Functions Example 9

In this example, we will use the RAND to return a random value SIGN method to find the sign. Next, we used the ROUND method to round the decimals.

`SELECT RAND(), RAND(5);SELECT ROUND(-12.25), ROUND(-12.67), ROUND(14.268, 1);SELECT SIGN(-12), SIGN(12), SIGN(0);`

### MySQL Numeric Functions Example 10

In this instance, we will use the SIN and TAN methods to find the Sine Value and Tangent Value. Next, we used the SQRT to find the square root of a given value.

`SELECT SIN(0), SIN(2.5), SIN(1);SELECT TAN(3.14), TAN(1), TAN(0);SELECT SQRT(16), SQRT(25), SQRT(894);`

### MySQL TRUNCATE and HEX Example 11

We are going to use TRUNCATE and HEX mathematical methods.

`SELECT TRUNCATE(10.9876, 1), TRUNCATE(10.9876, 0);SELECT HEX(255), HEX('Hi'), HEX('Hello');`