New versions: Dev (3.15) | Latest (3.14) | 3.13 | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | Old versions: 3.7 | 3.6 | 3.5 | 3.4 | 3.3

LN

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The LOG() function calculates the logarithm of a numeric value, given a base.

SELECT log(8, 2);
create.select(log(8, 2)).fetch();

The result being

+-----+          
| log |
+-----+
|   3 |
+-----+

Dialect support

This example using jOOQ:

log(8, 2)

Translates to the following dialect specific expressions:

-- ACCESS, ASE
(log(8) / log(2))

-- CUBRID, FIREBIRD, H2, MARIADB, MYSQL, ORACLE, POSTGRES
log(2, 8)

-- DB2, DERBY, HSQLDB, INGRES, SYBASE
(ln(8) / ln(2))

-- SQLSERVER
log(8, 2)

-- AURORA_MYSQL, AURORA_POSTGRES, COCKROACHDB, HANA, INFORMIX, MEMSQL, REDSHIFT, SQLDATAWAREHOUSE, SQLITE, TERADATA, VERTICA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.15, see #10141)

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo