Tutorial Gateway

  • C Language
  • Java
  • R
  • SQL
  • MySQL
  • Python
  • BI Tools
    • Informatica
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • QlikView
  • Js

MySQL LN Function

by suresh

MySQL LN function is one of the Mathematical Function which is used to return the natural logarithmic value of a given number with base E. In this article we will show you, How to find logarithmic values in MySQL using Command Prompt, and Workbench with example.

MySQL LN Syntax

The basic syntax of the LN in MySQL is as shown below:

SELECT LN (x)
FROM Source

If x is less than or equal to 0.0E0 then the function will return NULL value as output.

MySQL LN Function Example 1

The MySQL LN Function is used to return the natural logarithmic value of any numeric value. The following query will show multiple ways to use LN function.

-- MySQL LN Function Example

SELECT LN(2);

SELECT LN(0);

SELECT LN(-5);

SELECT LN(10);

OUTPUT

MySQL LN Function 1

MySQL LN Example 2

In MySQL, LN Function also allows you to find the logarithmic value of a column data. To demonstrate this LN function, we are going to use the below shown data

MySQL LN Function 0

In this example, we are going to find the logarithmic values for all the records present in ServiceGrade column.

-- MySQL LN Example
SELECT Product, 
		Color, 
        StandardCost, 
        Sales, TaxAmt, 
        ServiceGrade,
        LN(ServiceGrade) AS GradeLog
FROM mysqltutorial.`numeric functions`;

OUTPUT
MySQL LN Function 2

Thank You for Visiting Our Blog

Placed Under: MySQL

Trending Posts

Javascript Date Now Function

SQL RADIANS Function

MySQL NOT LIKE Operator

Python Program to Put Positive and Negative Numbers in Separate List

isalpha in C Programming

Java Arithmetic Operators

SSIS Slowly Changing Dimension Type 2

Java Program to Swap Two Arrays without temp

Functions in Python

Format Table Report in SSRS

  • C Programs
  • Java Programs
  • SQL FAQ’s
  • Python Programs
  • SSIS
  • Tableau
  • JavaScript

Copyright © 2019 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy