w3resource

MySQL LOG10() function

LOG10() function

MySQL LOG10() returns the natural logarithm of a number to the base 10. The equivalent expression of LOG10(N) is LOG(10,N).

This function is useful in -

  • This is useful in scenarios where the data naturally aligns with the decimal system, such as in financial calculations, measurements, and scientific experiments.
  • The LOG10() function is essential in chemistry for calculating the pH of a solution, which is a measure of its acidity or basicity. The pH scale is logarithmic in base 10.
  • LOG10() is used in acoustics to calculate the decibel level, a logarithmic scale used to quantify the intensity of sound.
  • Base-10 logarithms are used to compare the relative sizes or magnitudes of numbers.
  • In engineering fields like electrical engineering, civil engineering, and mechanical engineering, base-10 logarithms are frequently used in calculations involving quantities like voltage, power, and structural properties.
  • The LOG10() function is used to convert numbers from scientific notation (exponential form) to standard decimal notation.

Syntax:

LOG10(N);

Where N is a number

Syntax Diagram:

MySQL LOG10() Function - Syntax Diagram

MySQL Version: 8.0


Pictorial presentation of MySQL LOG10() function

pictorial presentation of MySQL LOG10() function

Example of MySQL LOG10() function

Code:

SELECT LOG10(1000);

Explanation:

The above MySQL statement returns the natural logarithm of 1000 as specified in the argument to the base 10.

Output:

mysql> SELECT LOG10(1000);
+-------------+
| LOG10(1000) |
+-------------+
|           3 | 
+-------------+
1 row in set (0.00 sec)

All Mathematical Functions

Previous: LOG2()
Next: MOD()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/mysql/mathematical-functions/mysql-log10-function.php