SQL EXP: Raises e to the nth Power

The SQL EXP function return e raised to the nth power, where e is the base of the natural logarithm i.e. equal to approximately 2.71828183.

Syntax

EXP(number | expression)Code language: SQL (Structured Query Language) (sql)

Arguments

number | expression
is the nth power which can be an integer or a float, either negative or positive is accepted

Return Type

The EXP function returns a float number with the precision that depends on each RDBMS implementation.

Examples

The following statement returns the exponential value of the 10.

SELECT EXP(10);Code language: SQL (Structured Query Language) (sql)
       exp
------------------
 22026.4657948067
(1 row)Code language: SQL (Structured Query Language) (sql)

The EXP is the inverse function of the LN function, therefore, the following statement returns 100 in both expressions:

SELECT EXP( LN(100)), LN( EXP(100));  
Code language: SQL (Structured Query Language) (sql)
 exp | ln
-----+-----
 100 | 100
(1 row)Code language: SQL (Structured Query Language) (sql)
Was this tutorial helpful ?