« MySQL Pop Quiz #25 | Main | MySQL Pop Quiz #26 »
LOG() :: MySQL Function of the Day
By Carsten | April 23, 2008
Function name: LOG()
Aliases: (LN, LOG2, LOG10)
Function type: Numerical function
Purpose: Return the logarithm of a number
Description: LOG(x) returns the natural logarithm of x. LOG(y, x) returns the logarithm of x for base y. So LOG(8) returns 2.079, and LOG(2, 8 ) returns 3. Both arguments may be any integer, decimal or floating-point number greater than 0, and not quite as arbitrary as the MySQL manual suggests (unless they’ve corrected it by the time you read this
).
LN(x) = LOG(x) = LOG(e, x), with e being some internally-defined approximation of Euler’s number. LOG2(x) = LOG(2, x), and, unsurprisingly, LOG10(x) = LOG(10, x).
MySQL Function of the Day is a small series of concise information regarding most of the functions and operators available in MySQL. Inspired by PHPs funcaday, it’s meant to provide a daily dose of something in-between “Aha!” and “Ho-hum, I knew that already”, depending on your level of experience with MySQL. You can access the entire series with your browser here or pick up the RSS feed here.
Topics: MySQL Function of the day |
April 24th, 2008 at 9:13 am
[...] LOG() :: MySQL Function of the Day | [...]