w3resource

MySQL EXP() function

EXP() function

MySQL EXP() returns the value of the base of natural logarithm number e, raised to the power of a number specified as argument.

This function is useful in -

  • The EXP() function allows for easy calculations involving 'e'.
  • The EXP() function is a vital tool in calculus for solving differential equations, particularly those involving exponential growth and decay.
  • The EXP() function is used in ecology and demography to model populations, especially in scenarios where births and deaths occur continuously.
  • In finance and investment analysis, the EXP() function is used to make projections about the future value of investments, taking into account compounding.
  • In probability theory and statistics, the EXP() function is used to model continuous random variables with an exponential distribution.
  • The constant 'e' is a fundamental mathematical constant that arises in many areas of mathematics and science.

Syntax:

EXP(N);

Argument:

Name Description
N A number.

Syntax Diagram:

MySQL EXP() Function - Syntax Diagram

MySQL Version: 8.0


Pictorial presentation of MySQL EXP() function

pictorial presentation of MySQL EXP() function

Example of MySQL EXP() function

Code:

SELECT EXP(1);

Explanation:

The above MySQL statement will return the value of the natural logarithm base number e raised to the power of the given number.

Output:

mysql> SELECT EXP(1);
+------------------+
| EXP(1)           |
+------------------+
| 2.71828182845905 | 
+------------------+
1 row in set (0.03 sec)

Example: EXP() function with negative value

Code:

SELECT EXP(-1);

Explanation:

The above MySQL statement will return the value of the natural logarithm base number e raised to the power of the given number.

Output:

mysql> SELECT EXP(-1);
+-------------------+
| EXP(-1)           |
+-------------------+
| 0.367879441171442 | 
+-------------------+
1 row in set (0.00 sec)

All Mathematical Functions

Previous: DIVISION
Next: FLOOR()



Follow us on Facebook and Twitter for latest update.