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 :


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
(1 row)

Example 2: PostgreSQL LOG() function

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

Output :

  Base 2 Logarithm
(1 row)