MySQL Tutorial MySQL Advanced MySQL Database Account Management MySQL References

MySQL EXP() Function

The MySQL EXP() function returns e raised to the power of specified number, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.




x Required. Specify the exponent of e.

Return Value

Returns e raised to the power of specified number.

Example 1:

The example below shows the usage of EXP() function.

mysql> SELECT EXP(0);
Result: 1

mysql> SELECT EXP(1);
Result: 2.718281828459045

mysql> SELECT EXP(-1);
Result: 0.36787944117144233

mysql> SELECT EXP(2);
Result: 7.38905609893065

mysql> SELECT EXP(-2);
Result: 0.1353352832366127

mysql> SELECT LN(EXP(1));
Result: 1

Example 2:

Consider a database table called Sample with the following records:

Data 1-2
Data 2-1
Data 30
Data 41
Data 52

The query given below can be used to calculate the exponent of records of column x.

SELECT *, EXP(x) AS EXP_Value FROM Sample;

This will produce the result as shown below:

Data 1-20.1353352832366127
Data 2-10.36787944117144233
Data 301
Data 412.718281828459045
Data 527.38905609893065

❮ MySQL Functions