Mathematical functions of SQL functions

Source: Internet
Author: User
Tags abs cos mathematical functions natural logarithm sin square root

Function: Returns the absolute value of a given number

SELECT ABS (A) absolute_value from NUMBERS;

2.CEIL and Floor:
Function: Cell returns the smallest integer equal to or greater than the given parameter
Floor returns the largest integer equal to or smaller than the given parameter

SELECT A,floor (A) floor from NUMBERS;

Function: The Cos,sin,tan function can return the trigonometric function value of a given parameter, and the default parameter is determined to be the radian system.
Function: Returns a power value that is an exponent of the given parameter and a base of E.
5.LN and LOG
function: Two logarithmic functions where LN returns the natural logarithm of a given parameter
Log requires two parameters, where the second parameter is the base
SELECT B,log (b,10) from NUMBERS;

function: modulo (remainder) operation

SELECT A,b,mod (A, b) from NUMBERS;

Function: Returns the power of one number to another
The first argument is the base when using the power function, the second is the exponent

SELECT A,ceil (b), POWER (A,ceil (b)) from NUMBERS;

8.SIGN (flag function)
Function: If the value of the parameter is negative, then sign returns-1
If the value of the parameter is positive, sign returns 1
If the argument is zero, sign also returns zero

SELECT a,sign (A) from NUMBERS;

Function: Returns the square root of a parameter

SELECT a,sqrt (A) from NUMBERS;

Mathematical functions of SQL functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.