From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 24,200 courses taught by industry experts.

Logarithms

Logarithms

- [Bill] Hi, I'm Bill Weinman. MySQL provides some basic logarithm functions. A simple version, I say SELECT LN of 2, say. This gives us a simple logarithm function, the natural logarithm of the argument. And we can see we get that result. There's a more complete logarithm function called LOG. And if I just give it one argument, it gives us the natural logarithm of the argument, and we get the same result. If I give it a second argument, it returns the logarithm of the second argument to the base of the first argument. So if I say 65535. Put in a comma here. Now I get the logarithm of 65535 to base 2. So it's the base 2 logarithm of the argument. And we get that result. Or we can say something like 10, 100, we get the base 10 logarithm of 100, which is 2. There's also a LOG2 function, which gives us the base 2 logarithm of the argument. And there's a LOG10 function. And again, if I give that 100, we get the familiar result of 2. There's a function EXP, which is the inverse of LOG. It…

Contents