Example
Return the arc tangent of two values:
SELECT ATN2(0.50, 1);
Definition and Usage
The ATN2() function returns the arc tangent of two numbers.
Syntax
ATN2(a, b)
Return the arc tangent of two values:
SELECT ATN2(0.50, 1);
The ATN2() function returns the arc tangent of two numbers.
ATN2(a, b)
Return the arc tangent of a number:
SELECT ATAN(2.5);
The ATAN() function returns the arc tangent of a number.
ATAN(number)
Return the arc sine of a number:
SELECT ASIN(0.25);
The ASIN() function returns the arc sine of a number.
The specified number must be between -1 to 1, otherwise this function returns NULL.
ASIN(number)
Return the arc cosine of a number:
SELECT ACOS(0.25);
The ACOS() function returns the arc cosine of a number.
The specified number must be between -1 to 1, otherwise this function returns NULL.
ACOS(number)
Return the absolute value of a number:
SELECT Abs(-243.5) AS AbsNum;
The ABS() function returns the absolute value of a number.
ABS(number)
Convert the text to upper-case:
SELECT UPPER('SQL Tutorial is FUN!');
The UPPER() function converts a string to upper-case.
Note: Also look at the LOWER() function.
UPPER(text)
Return an integer value (the Unicode value), for the first character of the input expression:
SELECT UNICODE('Atlanta');
The UNICODE() function returns an integer value (the Unicode value), for the first character of the input expression.
UNICODE(character_expression)
Remove leading and trailing spaces from a string:
SELECT TRIM(' SQL Tutorial! ') AS TrimmedString;
The TRIM() function removes the space character OR other specified characters from the start or end of a string.
By default, the TRIM() function removes leading and trailing spaces from a string.
Note: Also look at the LTRIM() and RTRIM() functions.
TRIM([characters FROM ]string)
Return the string from the first argument AFTER the characters specified in the second argument are translated into the characters specified in the third argument:
SELECT TRANSLATE('Monday', 'Monday', 'Sunday'); // Results in Sunday
The TRANSLATE() function returns the string from the first argument after the characters specified in the second argument are translated into the characters specified in the third argument.
Note: The TRANSLATE() function will return an error if characters and translations have different lengths.
TRANSLATE(string, characters, translations)
Extract 3 characters from a string, starting in position 1:
SELECT SUBSTRING('SQL Tutorial', 1, 3) AS ExtractString;
The SUBSTRING() function extracts some characters from a string.
SUBSTRING(string, start, length)