<<<<<<< HEAD exp | H2 | SQLDoc
Skip to main content

exp

1. EXP Function

======= exp | H2 Function | SQLDoc

exp

1. EXP Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The EXP function in H2 database is used to calculate the exponential value of a given number.

2. Syntax

The syntax for the EXP function in H2 database is as follows:

EXP(number)

Arguments

  • number: The number for which the exponential value needs to be calculated. It should be a numeric value.

Return

  • The EXP function returns the exponential value of the given number.

3. Notes

  • The EXP function in H2 database calculates e raised to the power of the given number, where e is the base of the natural logarithm.
  • The input number should be within the numeric range to avoid any overflow or underflow errors.
  • If the input number is NULL, the EXP function will return NULL.
  • Ensure that you use the correct syntax and datatype while using the EXP function to avoid errors.

4. Examples

Here are a few examples demonstrating the usage of the EXP function in H2 database:

Example 1 - Calculating the exponential value of 2:

SELECT EXP(2) AS exponential_value;

Output:

exponential_value
-----------------
7.3890560989306495

Example 2 - Calculating the exponential value of a column:

CREATE TABLE numbers (
id INT PRIMARY KEY,
value DOUBLE
);

INSERT INTO numbers VALUES (1, 1.5), (2, 2.5), (3, 3.5);

SELECT id, value, EXP(value) AS exponential_value
FROM numbers;

Output:

id | value | exponential_value
---+-------+------------------
1 | 1.5 | 4.4816890703380645
2 | 2.5 | 12.182493960703473
3 | 3.5 | 33.11545195869231
  • ln - Calculate natural logarithm
  • log - Calculate logarithm to a specified base