Example
Return the absolute value of a number:
SELECT ABS(-243.5);
Definition and Usage
The ABS() function returns the absolute (positive) value of a number.
Syntax
ABS(number)
Return the absolute value of a number:
SELECT ABS(-243.5);
The ABS() function returns the absolute (positive) 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: This function is equal to the UCASE() function. Continue reading MySQL UPPER Function
Convert the text to upper-case:
SELECT UCASE("SQL Tutorial is FUN!");
The UCASE() function converts a string to upper-case.
Note: This function is equal to the UPPER() function. Continue reading MySQL UCASE Function
Remove leading and trailing spaces from a string:
SELECT TRIM(' SQL Tutorial ') AS TrimmedString;
The TRIM() function removes leading and trailing spaces from a string. Continue reading MySQL TRIM Function
Return a substring of a string before a specified number of delimiter occurs:
SELECT SUBSTRING_INDEX("www.iampsp.com", ".", 1);
The SUBSTRING_INDEX() function returns a substring of a string before a specified number of delimiter occurs. Continue reading MySQL SUBSTRING_INDEX Function
Extract a substring from a string (start at position 1, extract 3 characters):
SELECT SUBSTRING("SQL Tutorial", 1, 3) AS ExtractString;
The SUBSTRING() function extracts a substring from a string (starting at any position). Continue reading MySQL SUBSTRING Function
Extract a substring from a string (start at position 5, extract 3 characters):
SELECT SUBSTR("SQL Tutorial", 5, 3) AS ExtractString;
The SUBSTR() function extracts a substring from a string (starting at any position). Continue reading MySQL SUBSTR Function
Compare two strings:
SELECT STRCMP("SQL Tutorial", "SQL Tutorial");
The STRCMP() function compares two strings. Continue reading MySQL STRCMP Function
Return a string with 10 space characters:
SELECT SPACE(10);
The SPACE() function returns a string of the specified number of space characters. Continue reading MySQL SPACE Function
Remove trailing spaces from a string:
SELECT RTRIM("SQL Tutorial ") AS RightTrimmedString;
The RTRIM() function removes trailing spaces from a string. Continue reading MySQL RTRIM Function