Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
math
communitycreator

What is LN() in SQL?

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Answers Code

The LN() function returns the natural logarithm of a number. To be more specific, it is the log with base e.

Figure 1 shows the mathematical representation of the LN() function.

Figure 1: Mathematical representation of LN() function

Syntax

LN(number)

Parameter

This function requires a number as a parameter. The number must be greater than zero.

Return value

LN() returns the natural logarithm of a number sent as a parameter.

If a parameter is less than or equal to zero, it returns NULL.

Example

/*example showing how to use LN(X)*/
-- positive number
select LN(10);
-- negative number
select LN(-6);
-- zero number
select LN(0);

RELATED TAGS

sql
math
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Answers Code
Keep Exploring