LOG(): to get natural logarithm with different base values

Using ROUND() with LOG()

SELECT ROUND(LOG(2),2);// Output is 0.69
SELECT ROUND(LOG(-2),2); // Output is NULL
SELECT ROUND(LOG(6,3),2); // Output is 0.61
If Base is less than or equal to 1 then NULL is returned, similarly if X is less than or equal to 0 then NULL is returned.
SELECT LOG( 6, -0.1 ); Output is NULL
SELECT LOG( -6, 2 ); // Output is NULL
SELECT LOG( 6, 0.1 ) // Output is -1.28509720893847
Syntax
SELECT LOG( X )
Returns natural logarithm of X. We cap add one more argument to specify Base.
SELECT LOG( B,X )
X is the number and B is the base. The output is log value of X with base B.
SQL Math References LOG10() to get Log value with base 10 Average value Query
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer