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

log10

1. LOG10 Function

======= log10 | H2 Function | SQLDoc

log10

1. LOG10 Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The LOG10 function in H2 database is used to calculate the logarithm (base 10) of a given number.

2. Syntax

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

LOG10(number)

Arguments

  • number: The number for which the logarithm needs to be calculated. It should be a numeric value greater than 0.

Return

  • The LOG10 function returns the logarithm (base 10) of the given number.

3. Notes

  • The LOG10 function in H2 database calculates the logarithm (base 10) of a number. If you need to calculate the logarithm with a different base, use the LOG function instead.
  • If the input number is not a positive number or exceeds the numeric range, the LOG10 function will return NULL.
  • Ensure that the number passed to the LOG10 function is of a numeric type to avoid errors.

4. Examples

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

Example 1 - Calculating the logarithm (base 10) of 100:

SELECT LOG10(100) AS logarithm;

Output:

logarithm
---------
2.0

Example 2 - Calculating the logarithm (base 10) of numbers stored in a column:

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

INSERT INTO numbers VALUES (1, 10), (2, 100), (3, 1000);

SELECT id, value, LOG10(value) AS logarithm
FROM numbers;

Output:

id | value | logarithm
---+-------+-----------
1 | 10.0 | 1.0
2 | 100.0 | 2.0
3 | 1000.0| 3.0
  • log - Calculate logarithm with a custom base (not base 10)
  • ln - Calculate natural logarithm (base e)