PostgreSQL LOG Function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PostgreSQL LOG() function

LOG() function

The PostgreSQL log() function is used to return the base 10 logarithm of a given number or logarithm of a number for a particular base, as specified in the argument.

Syntax :

log()

PostgreSQL Version : 9.3

Pictorial presentation of PostgreSQL LOG() function

 

Example 1: PostgreSQL LOG() function

SELECT LOG(200.0) AS "Base 10 Logarithm";

Output :

 Base 10 Logarithm
--------------------
 2.3010299956639812
(1 row)

Example 2: PostgreSQL LOG() function

SELECT LOG(2.0,16) AS "Base 2 Logarithm";

Output :

  Base 2 Logarithm
--------------------
 4.0000000000000000
(1 row)