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

LOG2

Example

Provide the logarithm base 2 of 6.

SELECT LOG2(6); 

Definition and Usage

The LOG2() function calculates the base-2 logarithm of a number.

Note: Also refer to the LOG() function for similar functionality.

Syntax

LOG2(number)

Parameter Values

Parameter

Description

number

A numerical value that must exceed zero.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Provide the logarithm base 2 of 64.

SELECT LOG2(64);