Explain LOG() function in SQL?

The LOG() function returns the logarithm of a specified number or the logarithm of the number to the specified base.

Syntax :

LOG(number, base)

Parameter :

LOG() function accepts two-parameters as mentioned above and described below.

  • number – This parameter hold a number which is greater than 0.
  • base – It is the optional integer argument that sets the base for the logarithm.

Returns – It returns the logarithm of the specified number with specified base.

Example:

Return the natural logarithm of 4.

SELECT LOG(4);

Output :

1.3862943611198906