MySQL LOG10() Function: Calculate base-10 logarithms

LOG10() finds the power to which 10 must be raised to obtain the supplied positive number.

LOG10(): Quick SQL Example

Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.

SELECT LOG10(1000) AS log_value;
log_value
3
On this page — Show page sectionsHide page sections

More SQL Examples and Explanations

LOG10(X) returns the base-10 logarithm of X. Nonpositive inputs return NULL with a warning.

SELECT LOG10(3); -- Output: 0.477121254719662
SELECT LOG10(100); -- Output: 2
SELECT LOG10(0); -- Output: NULL

Using ROUND() with LOG10()

SELECT ROUND(LOG10(2), 2); -- Output: 0.30
SELECT ROUND(LOG10(-5), 2); -- Output: NULL
SELECT ROUND(LOG10(9), 2); -- Output: 0.95

Syntax

SELECT LOG10(X);

How to Interpret the Result

Inputs must be positive. For natural logarithms use LOG(); for binary logarithms use LOG2().

Common Question

What does LOG10(0) return?
It returns NULL because zero is outside the logarithm domain.

↑ Back to top




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-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer