PostgreSQL LOG
From w3cyberlearnings
Contents |
Postgresql LOG
This function returns the natural logarithm of X for one parameter, and it returns X to the base B for two parameters. X is less than or equal to 0, or B is less than or equal to 1, then it returns NULL.
Syntax LOG
LOG(X); // One parameter LOG(X,B); // two parameters
Example 1
postgres=# SELECT LOG(8); log ------------------- 0.903089986991944 (1 row)
Example 2
postgres=# SELECT LOG(8,64); log -------------------- 2.0000000000000000 (1 row)
Example 3:Generate error
postgres=# SELECT LOG(1,64); ERROR: division by zero