MySQL LOG10 Function

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


LOG10 Function Example 1

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

SELECT LOG10(100);

SELECT LOG10(1230);

SELECT LOG10(78930), LOG10(-20);
MySQL LOG10 Function 1

MySQL LOG10 Example 2

The MySQL LOG10 Function also allows you to find and return the base 10 logarithmic value of a column data. In this Mathematical Function 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, 
      LOG10( StandardCost) AS Log10StdCost,
      LOG10( SalesAmount) AS Log10SalesAmount,
     LOG10( TaxAmt) AS Log10TaxAmt
 FROM `MySQL Tutorial`.`mathemetical functions`;
MySQL LOG10 Function 2