A string function accepts a string value as an input and returns a string value regardless of the data type. They’re used to convert an existing string value to a different format, change the letter cases, retrieve a portion of it, or determine the length of it. They are utilized in reports, logic implementation, and data analysis on a daily basis.
This will be a series of postings since we will go over each one in detail with one or more examples for simple comprehension. So continue reading.
For previous article, click here.
REPLACE:
The REPLACE() function replaces all occurrences of a substring within a string, with a new substring.
Syntax:
REPLACE (string_expression)
Example:
SELECT REPLACE(‘MySQL is a free software’, ‘MySQL’, ‘Oracle MySQL’) As Txt;
Result:
Oracle MySQL is a free software
REVERSE:
The REVERSE function takes a character expression as an argument and produces a string of the same length, but with each logical character’s ordinal position reversed. This, however, only applies to STRING.
Example:
SELECT REVERSE(‘slipknot’);
Result:
tonkpils
RIGHT:
The RIGHT() function extracts a number of characters from a string (starting from right).
Syntax:
RIGHT( string_expression)
Example:
SELECT RIGHT(‘BigDataNSQL’, 3);
Result:
SQL
RTRIM:
Returns a character expression after converting uppercase character data to lowercase.
Syntax:
SELECT RTRIM(‘Big Data N SQL ‘)
Result:
Big Data N SQL
Please continue to read the articles on String functions that will be published in the near future.
4 comments