Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

LOG

Example

Provide the logarithm base e of 2.

SELECT LOG(2); 

Definition and Usage

The LOG() function retrieves either the natural logarithm or the logarithm of a specified number with a given base.

Note: Additionally, refer to the LN() and EXP() functions.

Syntax

LOG(number)

OR:

LOG(base, number)

Parameter Values

Parameter

Description

number

Mandatory: A numerical value that must exceed zero.

base

The numerical base of the number. It must be greater than 1.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Provide the logarithm base 2 of 4.

SELECT LOG(2, 4);