[SQL] Common functions collation (T-SQL Edition)

Source: Internet
Author: User
Tags abs natural logarithm numeric value square root

Common function collation (T-SQL version) one, mathematical function

1. Seek absolute value

The ABS () function is used to return the absolute value of a number.

SELECT ABS (-5.38 as Absvalue;

  

2. Finding the Index

The POWER () function is the function used to calculate the exponent. The function accepts two parameters, the first argument is the expression to be exponentiation, and the second argument is a power.

SELECT POWER (5-0.5  as powerValue1,    POWER(52  as powerValue2,     POWER (53 as PowerValue3;

3. Finding the square root

The SQRT () function is a function used to calculate the square root. The function accepts a parameter, which is the expression to be computed for the square root.

SELECT SQRT (9  as sqrtValue1,    SQRT(3 as sqrtValue2;

  

4. Ask for random numbers

SELECT RAND (9527) Randvalue;

5. Rounding to the maximum integer

SELECT CEILING (56.67) ceilingValue1,     CEILING (-56.67) ceilingValue2;

6. Rounding to the smallest integer

SELECT  Floor (56.67) floorValue1,      Floor (-56.67) floorValue2;

7. Rounding

The ROUND () function is also used for numerical rounding.

SELECT ROUND (56.670) roundValue1,     ROUND (56.671) roundValue2,     ROUND (-56.670) roundValue3;

8. Find the sine value

SELECT SIN (56.67) Sinvalue;

9. Calculate Cosine value

SELECT COS (56.67) Cosvalue;

10. To find the sine value of the inverse

SELECT 1 / 56.67 ,     ASIN (1/56.67) Asinvalue;

11. To find the inverse cosine value

SELECT 1 / 56.67 ,     ACOS (1/56.67) Acosvalue;

12. To find the tangent value

SELECT TAN (56.67) Tanvalue;

13. Calculate the inverse tangent value

SELECT ATAN (56.67) Atanvalue;

14. Ask for 2 variables of the inverse tangent

SELECT ATN2 (56.672) Atn2value;

15. Seeking Cotangent

SELECT COT (56.67) Cotvalue;

16. Find PI Value

SELECT PI ' Pi ';

17. Radian Conversion to angle system

SELECT DEGREES (56.67) Degreesvalue;

18. Angle system converted to radians

SELECT RADIANS (56.67) Radiansvalue;

19. Find Symbols

The sign () function returns a symbol for a numeric value that returns 1 if the value is greater than 0 and returns 0 if the value is equal to 0, or 0 if the value is less than 1.

SELECT  Sign (1-3) signValue1,      Sign (3-1) signValue2,      Sign (0) signValue3;

20. Asking for natural logarithm

The LOG () function is used to calculate the natural pair of values for a number.

SELECT LOG (56.67) Logvalue;

21. Find the logarithm of the base 10

SELECT LOG10 (56.67) Log10value;

Second, String function

Three, date Time function

Iv. other functions

[SQL] Common functions collation (T-SQL Edition)

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: info-contact@alibabacloud.com 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.