LOG10() finds the power to which 10 must be raised to obtain the supplied positive number.
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 |
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
SELECT ROUND(LOG10(2), 2); -- Output: 0.30
SELECT ROUND(LOG10(-5), 2); -- Output: NULL
SELECT ROUND(LOG10(9), 2); -- Output: 0.95
SELECT LOG10(X);
Inputs must be positive. For natural logarithms use LOG(); for binary logarithms use LOG2().
What does LOG10(0) return?
It returns NULL because zero is outside the logarithm domain.
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.