bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL LOG2() Function

Concept visual

MySQL LOG2() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Formula

Return the base - 2 logarithm of 6:
SELECT LOG2(6);

Definition and Usage

Formula

The LOG2() function returns the natural logarithm of a number to base - 2.

Note:

See also the LOG() function.

Syntax

Log2(

number )

Parameter Values

Parameter

Description number

A number. Must be greater than 0

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Formula

Return the base - 2 logarithm of 64:
SELECT LOG2(64);

Previous

❮ MySQL Functions

Next

Previous

MySQL LOG10() Function

Next

MySQL MAX() Function