EXP()

Published Jul 21, 2023
Contribute to Docs

EXP() is a mathematical function in SQL that returns the value of e raised to the power of a given number. Where e is a mathematical constant equal to approximately 2.71828, which is the base used in the determination of natural logarithms.

Syntax

EXP(number)

number represents a numeric value that e is raised to.

Example

The following table exp contains example data:

id num
1 0
2 1
3 2

The EXP() function is used to return the value of e raised to the power of the num column:

SELECT id, num, EXP(num) as exp_num
FROM exp;

Output:

id num exp_num
1 0 1
2 1 2.71828
3 2 7.38906

Note: The EXP() function can be used with many popular SQL databases such as SQLite, MySQL, PostgreSQL, and SQL Server.

All contributors

Looking to contribute?

Learn SQL on Codecademy