MySQL LOG10 Function

MySQL LOG10 function is one of the Mathematical functions which is useful to return the base 10 logarithmic value of a given number. Let us see how to find base 10 logarithmic values using Command Prompt and Workbench with examples. The basic syntax of the LOG10 is as shown below:

SELECT LOG10(x) FROM Source

MySQL LOG10 Function Example

The LOG10 function returns the base 10 logarithmic value of any numeric value. The following query shows you multiple ways to use this.

SELECT LOG10(100);

SELECT LOG10(1230);

SELECT LOG10(78930), LOG10(-20);
Example 1

This method also allows you to find and return the base 10 logarithmic value of column data. In this Mathematical method example, we are going to find the base 10 logarithmic values for all the MySQL records present in Sales Amount, Standard Cost, and Tax Amount columns.

SELECT EnglishProductName, 
       Color,
       StandardCost,
       LOG10( StandardCost) AS Log10StdCost,
       SalesAmount,
       LOG10( SalesAmount) AS Log10SalesAmount,
       TaxAmt,
       LOG10( TaxAmt) AS Log10TaxAmt
  FROM `mathemetical functions`;
LOG10 Function 2