SQL 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_numFROM 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.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
- Learn to analyze data with SQL and prepare for technical interviews.
- Includes 9 Courses
- With Certificate
- Beginner Friendly.17 hours
- In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
- Beginner Friendly.5 hours