Log10 Function In Sql in SQL
LOG10 Function in SQL
The LOG10 function returns the base-10 logarithm of a given number.
? Syntax:
LOG10(number)number: A positive numeric value.
? Example:
SELECT LOG10(1000) AS base10_log;Result:
| base10_log |
|---|
| 3 |
Because 10³ = 1000
? Notes:
Input must be greater than 0.
Returns
NULLor an error for 0 or negative inputs.Supported in most databases:
? MySQL
? SQL Server
? PostgreSQL
? Oracle
Let me know if you want LOG with custom base or LN (natural log) explained too!