Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Databases
  • SQL
  • MySQL
  • PostgreSQL
  • PL/SQL
  • MongoDB
  • SQL Cheat Sheet
  • SQL Interview Questions
  • MySQL Interview Questions
  • PL/SQL Interview Questions
  • Learn SQL and Database
Open In App
Next Article:
MONTH() Function in SQL Server
Next article icon

LOG() Function in SQL Server

Last Updated : 29 Sep, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

The LOG() function returns the logarithm of a specified number or the logarithm of the number to the specified base.

Syntax :

  LOG(number, base)  

Parameter :
LOG() function accepts two-parameters as mentioned above and described below.

  • number –
    This parameter hold a number which is greater than 0.
  • base –
    It is the optional integer argument that sets the base for the logarithm.

Returns –
It returns the logarithm of the specified number with specified base.

Example-1 :
Return the natural logarithm of 4.

  SELECT LOG(4);  

Output :

  1.3862943611198906  

Example-2 :
It will Return the natural logarithm of 3 to a specified base 6.

  SELECT LOG(3, 6);  

Output :

  0.61314719276545848  

Example-3 :
When the PI() function passing one of the arguments with specified base 5.

  SELECT LOG(PI(), 5);  

Output :

  0.71126066871266902  

Example-4 :
When the argument passing as a expressions with specified base.

  SELECT LOG(3 + 2, 5);  

Output :

  1.0  

Example-5 :
Both LOG and LOG10 having base 10.

  SELECT LOG(1000, 10) 'LOG',  LOG10(1000) 'LOG10';  

Output :

  | LOG  | LOG10   |  |-------+--------|  | 3    |  3      |  


Next Article
MONTH() Function in SQL Server
author
sanjoy_62
Improve
Article Tags :
  • SQL
  • DBMS-SQL
  • SQL-Server

Similar Reads

  • LOG10() Function in SQL Server
    This function returns the logarithm of a number to base 10. Syntax : LOG10(number) Parameter : This method accepts a single-parameter as mentioned above and described below. number - This parameter hold a number which is greater than 0. Returns - It returns the base-10 logarithm of the specified num
    1 min read
  • LOWER() function in SQL Server
    LOWER() : This function in SQL Server helps to convert all the letters of the given string to lowercase. If the given string contains characters other than alphabets, then they will remain unchanged by this function. Syntax : LOWER( str ) Parameters : str - The string which will be converted to lowe
    2 min read
  • MONTH() Function in SQL Server
    MONTH() function : This function in SQL Server is used to return the month of the year i.e, from 1 to 12 for a date stated. Features : This function is used to find the month of the year for a date specified. This function comes under Date Functions. This function accepts only one parameter i.e, dat
    2 min read
  • LTRIM() Function in SQL Server
    The LTRIM() function in SQL Server removes all the space characters found on the left-hand side of the string. It removes the leading spaces from a string, SyntaxThe LTRIM function for SQL Server syntax is: LTRIM(string, [trim_string]) Parameter: string - The string from which the leading space char
    2 min read
  • SQL Server ISNULL() Function
    The ISNULL() function in SQL Server is a powerful tool for handling NULL values in our database queries. It allows us to replace NULL values with a specified replacement value, ensuring that your queries return meaningful results even when data is missing. In this article, We will learn about the SQ
    4 min read
  • MIN() Function in SQL Server
    MIN() : This function in SQL Server is used to find the value that is minimum in the group of values stated. Features : This function is used to find the minimum value.This function comes under Numeric Functions.This function accepts only one parameter namely expression. Syntax : MIN(expression) Par
    2 min read
  • MAX() Function in SQL Server
    MAX() : This function in SQL Server is used to find the value that is maximum in the group of values stated. Features : This function is used to find the maximum value.This function comes under Numeric Functions.This function accepts only one parameter namely expression. Syntax : MAX(expression) Par
    2 min read
  • NULLIF() Function in SQL Server
    NULLIF() function in SQL Server is used to check if the two specified expressions are equal or not. If two arguments passed to a function are equal, the NULLIF() function returns Null to us. NULLIF() function operates like a Like a CASE Statement. It will return the value of the first argument if th
    3 min read
  • Scalar Function in SQL Server
    Pre-requisites: Categories of SQL Functions In SQL Server, a scalar function is a type of user-defined function that returns a single scalar value based on the input parameters passed to it. The scalar function is used to perform some calculations or operations on the input parameters and return a s
    2 min read
  • RANK() Function in SQL Server
    The RANK() function is a powerful window function in SQL Server used to assign a rank to each row within a result set. It is particularly useful when we need to assign a rank to a group of rows based on some sorting criteria and want to differentiate between rows that have the same values. Unlike ot
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences