位置:首頁 > 數據庫 > 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)