Mysql LOG
From w3cyberlearnings
Contents |
MySQL LOG Function
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
- X is a number
- B (optional) is the base
LOG(X); // One parameter LOG(X,B); // two parameters
Example 1
mysql> SELECT LOG(8); +------------------+ | LOG(8) | +------------------+ | 2.07944154167984 | +------------------+ 1 row in set (0.00 sec)
Example 2
mysql> SELECT LOG(8,64); +-----------+ | LOG(8,64) | +-----------+ | 2 | +-----------+ 1 row in set (0.00 sec)
Example 3
mysql> SELECT LOG(1,64); +-----------+ | LOG(1,64) | +-----------+ | NULL | +-----------+ 1 row in set (0.00 sec)