位置:首页 > 数据库 > SQL在线教程 > SQL LOG()函数

SQL LOG()函数

LOG(X)

LOG(B,X)

该函数的一个参数的版本将返回X的自然对数,如果用两个参数调用,它返回X的对数的任意基数B.请看下面的例子:

SQL>SELECT LOG(45);
+---------------------------------------------------------+
| LOG(45)                                                 |
+---------------------------------------------------------+
| 3.806662                                                |
+---------------------------------------------------------+
1 row in set (0.00 sec)

SQL>SELECT LOG(2,65536);
+---------------------------------------------------------+
| LOG(2,65536)                                            |
+---------------------------------------------------------+
| 16.000000                                               |
+---------------------------------------------------------+
1 row in set (0.00 sec)