Numeric functions in SQL | Oracle

VimalRaj170 598 views 77 slides Mar 31, 2019
Slide 1
Slide 1 of 77
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77

About This Presentation

Functions can be used anywhere in SQL, like AVG, COUNT, SUM, MIN, DATE and so on with select statements. Functions compile every time. Functions must return a value or result. Functions only work with input parameters.


Slide Content

Return the absolute value of a number
The ABS() function returns the absolute (positive) value of a number.
Syntax-
ABS(number)
ABS() FUNCTION

ABS() function

The My SQL ACOS function returns the arc cosine of a number.

The function returns NULL when the value of the number is not between
the range of -1 and 1.
Syntax-
ACOS( number )
ACOS() function

ACOS() function
.

ACOS() function

ASIN() Function
Returns the arc sine of a number

The specified number must be between -1 to 1, otherwise this function
returns null
Syntax-
ASIN(number)

ASIN() Function

ASIN() Function

ATAN() Function
Return the arc tangent of a number:
The ATAN2() function returns the arc tangent of one or two numbers.

Syntax-
ATAN(number)
or
ATAN2(a,b)

ATAN() Function
.

ATAN2() Function
.

AVG() Function
The AVG() function returns the average value of an expression.
NULL values are ignored.

Syntax-
AVG(expression)

AVG() Function

CEIL() Function
Returns the smallest integer value that is >= to a number.
This function is equal to the CEILING() function.

Syntax-
CEIL(number)

CEIL() Function

COS() Function
Return the cosine of a number

Syntax-
COS(number)

COS() Function

COS() Function

COT() Function
Return the cotangent of a number

Syntax-
COT(number)

COT() Function

COT() Function

COUNT() Function
The COUNT() function returns the number of records returned by a select
query.
NULL values are not counted.
 
Syntax-
COUNT(expression)

COUNT() Function

DEGREES() Function
The DEGREES() function converts a value in radians to degrees.
 
Syntax-
DEGREES(number)

DEGREES() Function

DEGREES() Function

DIV() Function
The DIV function is used for integer division (x is divided by y).
 An integer value is returned.
 
Syntax-
x DIV y

DIV() Function

EXP() Function
The EXP() function returns e raised to the power of the specified number.
The constant e (2.718281...), is the base of natural logarithms.
Syntax-
EXP(number)

EXP() Function

FLOOR() Function
The FLOOR() function returns the largest integer value that is smaller than 
or equal to a number.
Syntax-
FLOOR(number)

FLOOR() Function

GREATEST() Function
The GREATEST() function returns the greatest value of the list of 
Arguments.
Syntax-
GREATEST(arg1, arg2, arg3, ...)

GREATEST() Function

LEAST() Function
The LEAST() function returns the smallest value of the list of arguments.
Syntax-
LEAST(arg1, arg2, arg3, ...)

LEAST() Function

LN() Function
The LN() function returns the natural logarithm of a number.
Syntax-
LN(number)

LN() Function

LOG() Function
The LOG() function returns the natural logarithm of a specified number, or 
the logarithm of the number to the specified base.
Syntax-
LOG(number)
           or
        LOG(base, number)

LOG() Function

LOG() Function

LOG10() Function
The LOG10() function returns the natural logarithm of a number to base-10.
Syntax-
LOG10(number)

LOG10() Function

LOG10() Function

LOG2() Function
The LOG2() function returns the natural logarithm of a number to base-2.
Syntax-
LOG2(number)

LOG2() Function

MAX() Function
The MAX() function returns the maximum value in a set of values.
Syntax-
MAX(expression)

MAX() Function

MIN() Function
The MIN() function returns the minimum value in a set of values.
Syntax-
MIN(expression)

MIN() Function

MOD() Function
The MOD() function returns the remainder of a number divided by another 
number.
Syntax-

MOD(x, y)
Or
x MOD y

MOD() Function

MOD() Function

PI() Function
The PI() function returns the value of PI.
Syntax-
PI()

PI() Function

POW() Function
The POW() function returns the value of a number raised to the power of 
another number.
Syntax-
POW(x, y)

POW() Function

SIGN() function
The SIGN() function returns the sign of a number.
This function will return one of the following:
If number > 0, it returns 1
If number = 0, it returns 0
If number < 0, it returns -1
Syntax-  SIGN(number) 

SIGN() function
The ASCII() function returns the ASCII value for the specific character.

TRUNCATE() function
The TRUNCATE() function truncates a number to the specified number of 
decimal places.
Syntax-  TRUNCATE(number, decimals)

TRUNCATE() function

ROUND() Function
The ROUND() function rounds a number to a specified number of decimal
places.
Syntax-


ROUND (Number, decimals)

ROUND() Function

RAND() Function
The RAND() function returns a random number between 0 (inclusive) and 1
(exclusive).
Seed - Optional. If seed is specified, it returns a repeatable sequence of
random numbers. If no seed is specified, it returns a completely random
number
Syntax-

RAND(seed)

RAND() Function

TAN() Function
The TAN() function returns the tangent of a number.
Syntax-
TAN(number)

TAN() Function
The ASCII() function returns the ASCII value for the specific character.

SIN() function
Syntax-
SIN(number)
The SIN() function returns the sine of a number.

SIN() function
.

SQRT() Function
The SQRT() function returns the square root of a number.
Syntax-
SQRT(number)

SQRT() Function

SUM() Function
The SUM() function calculates the sum of a set of values.
Syntax-

SUM(expression)

SUM() Function
The ASCII() function returns the ASCII value for the specific character.

RADIANS() function
Syntax- RADIANS(number)
The RADIANS() function converts a degree value into radians.

RADIANS() function
The ASCII() function returns the ASCII value for the specific character.

POWER() Function
The POWER() function returns the value of a number raised to the power of
another number.
Syntax- POWER (x,y)

POWER() function