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.
Size: 1.76 MB
Language: en
Added: Mar 31, 2019
Slides: 77 pages
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)