Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL LOG Function

LOG returns the natural logarithm of the specified value.

The base of the logarithm can be changed starting with SQL Server 2012.

Example

#

This example returns the natural logarithm of the specified value.

SELECT LOG(10) AS Ln
Result:  1 record
Ln
2.30258509299405

Syntax

Syntax of the LOG function.

LOG(value [,base])

value -- a value greater than 0.

base -- optional. Sets the base of the logarithm. Must be greater than 1.

More Examples

LOG with BASE

Returns the natural logarithm of a value with a base indicated.
SELECT LOG(8, 4) AS 'Log 8 base 4'
Result:  1 record
Log 8 base 4
1.5

You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.