With one argument, LOG(X) returns the natural logarithm of X. With two arguments, LOG(B,X) returns the logarithm of X to base B.
SELECT ROUND(LOG(2), 2); -- Output: 0.69
SELECT ROUND(LOG(-2), 2); -- Output: NULL
SELECT ROUND(LOG(6, 3), 2); -- Output: 0.61
For LOG(B,X), X must be greater than 0 and the base B must be greater than 1.
SELECT LOG(6, -0.1); -- Output: NULL
SELECT LOG(-6, 2); -- Output: NULL
SELECT LOG(6, 0.1); -- Output: -1.28509720893847
SELECT LOG(X);SELECT LOG(B, X);
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.