SQL single-row functions in Oracle databases-numeric Functions

Source: Internet
Author: User
Tags acos asin mathematical functions natural logarithm

SQL single-row functions in Oracle databases-numeric Functions

1. trigonometric Functions
SIN ASIN SINH
COS ACOS COSH
TAN ATAN TANH
For the above trigonometric functions, see the name. Do a continuous exercise [SQL] select sin (2), asin (1), SINH (1) from dual;
Select cos (1), ACOS (0.5), COSH (0.5) FROM dual;
Select tan (1), atan2 (2, 1), tanh (2) from dual; the above results are as follows:

 
 
 
2. mathematical functions
ABS (x): returns the absolute value of x.
BITAND (x, y): returns the result of the "and" operation on x and y. The returned result is 0 or 1 [SQL] <span style = "color: #000000; "> select abs (-2), bitand (1, 1) from dual; </span>

CEIL (x): returns the smallest integer greater than or equal to x (negative)
FLOOR (x): returns the largest integer of small and or equal to x [SQL] <span style = "color: #000000;"> select ceil (-20.5 ), ceil (20.5), floor (-20.5), floor (20.5) from dual; </span> EXP (x): returns the x power of e.

LN (x): returns the natural logarithm of x [SQL] select exp (2), ln (10) from dual; LOG (x, y ): returns the base-x logarithm of y.

POWER (x, y): returns the POWER y of x.
SQRT (x): returns the square root of x [SQL] SELECT LOG (10,100), POWER (), SQRT (4) FROM DUAL; MOD (x, y ): returns the remainder of x divided by y.

SIGN (x): returns the x symbol. If x is 0, 0 [SQL] select mod (), sign (0), sign (-2) from dual is returned; ROUND (x [, y]): returns the result of rounded up x. Y is an optional parameter, indicating the number of decimal places.

If y is not specified, x is rounded up to 0 decimal places. If x is negative, x is rounded up to the left of the decimal point. | y |
The rounding method is used.
TRUNC (x, [y]): similar to ROUND, but it simply removes the ending number. [SQL] SELECT ROUND (1234.5678), ROUND (1234.5678, 2), ROUND (1234.5678, -2) from dual;
Select trunc (1234.5678), TRUNC (1234.5678, 2), TRUNC (1234.5678,-2) from dual;

 
There are almost so many numeric functions. Over!

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.