Mysql Log10 Function

MySQL: LOG10 Function

This tutorial explains how to use the MySQL LOG10 function with syntax and examples.

Description

The MySQL LOG10 function returns the base-10 logarithm of a number.

Syntax

The syntax for the LOG10 function in MySQL is:

LOG10( number )

Parameters or Arguments

number

The number to take the base-10 logarithm of. Must be greater than 0.

Note

  • The LOG10 function will return NULL, if number is less than or equal to 0.
  • See also the LOG function.

Applies To

The LOG10 function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0.3

Example

Let's look at some MySQL LOG10 function examples and explore how to use the LOG10 function in MySQL.

For example:

mysql> SELECT LOG10(1);
Output: 0

mysql> SELECT LOG10(2);
Output: 0.3010299956639812

mysql> SELECT LOG10(3.1);
Output: 0.4913616938342727

mysql> SELECT LOG10(0);
Output: NULL