位置:首頁 > 數據庫 > MySQL教學 > MySQL log()函數

MySQL log()函數

LOG(X)

LOG(B,X)

該函數的單個參數版本將返回X的自然對數,如果調用兩個參數,它返回X的對數的任意基數B.請看下麵的例子:

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

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