Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs
    • SQL FAQ’s

MySQL LN Function

by suresh

How to use LN function find logarithmic values in MySQL using Command Prompt and Workbench with example?. MySQL LN function is one of the Mathematical Functions, which is useful to return the natural logarithmic value of a given number with base E.

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 returns the NULL value as output.

MySQL LN Function Example 1

The LN function returns the natural logarithmic value of any numeric value. The next query shows multiple ways to use the 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

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

MySQL LN Function 0

In this MySQL example, we are going to find the logarithmic values for all the records present in the 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

Placed Under: MySQL

  • How to Download MySQL
  • Install MySQL on Windows
  • MySQL Create Database
  • MySQL Delete Database
  • MySQL Create Table
  • MySQL Drop Table
  • MySQL SELECT Statement
  • MySQL ALIAS Column
  • MySQL Distinct
  • MySQL Insert Statement
  • MySQL Delete
  • MySQL Truncate Table
  • MySQL WHERE Clause
  • MySQL Order By
  • MySQL Group By
  • MySQL Having Clause
  • MySQL LIMIT
  • MySQL Arithmetic Operators
  • MySQL COALESCE Function
  • MySQL AND Operator
  • MySQL NOT Operator
  • MySQL OR Operator
  • MySQL XOR Operator
  • MySQL BETWEEN Operator
  • MySQL Not Between Operator
  • MySQL GREATEST Function
  • MYSQL LEAST Function
  • MySQL LIKE Operator
  • MySQL NOT LIKE Operator
  • MySQL IFNULL Operator
  • MySQL NULLIF Operator
  • MySQL INTERVAL Operator
  • MySQL IS Operator
  • MySQL IN Operator
  • MySQL NOT IN Operator
  • MySQL IS NOT NULL
  • MySQL IS NULL
  • MySQL Inner Join
  • MySQL Cross Join
  • MySQL Right Join
  • MySQL Left Join
  • MySQL Aggregate Functions
  • MySQL Date Functions
  • MySQL Date Function
  • MySQL String Functions
  • MySQL Numeric Functions
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

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

Home | About Us | Contact Us | Privacy Policy