REVERSE
REVERSE(str)
Section titled “REVERSE(str)”- str: The string value for which reverse operation is to be conducted. The REVERSE() function in MySQL uses this parameter to reverse the sequence of characters in a provided string.
Example
Section titled “Example”SELECT REVERSE('SQL');Output
Section titled “Output”LQSExplanation
Section titled “Explanation”The REVERSE function in MySQL is used to reverse a string. In the given example, it takes ‘SQL’ as an input and returns ‘LQS’.
REVERSE( string_expression )
Section titled “REVERSE( string_expression )”- string_expression: This parameter indicates the string that will be reversed by the function. It should be of a data type that is explicitly convertible to the varchar data type. The entire expression string is reversed including words and characters.
Example
Section titled “Example”SELECT REVERSE('Hello World') as ReversedString;Output
Section titled “Output”dliroW olleHExplanation
Section titled “Explanation”The REVERSE function in SQL Server flips the order of the characters in the input string. In the above example, ‘Hello World’ is reversed as ‘dliroW olleH’.
REVERSE(char)
Section titled “REVERSE(char)”- char: This parameter specifies the string that you wish to reverse in Oracle. It refers to the character string which can be any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The provided string is then processed by the REVERSE function to provide an output string that is a reversal of the input. This is read back from end to start. It is to be noted that the function returns a value that matches the datatype of the input string. If the input is NULL, the result is NULL.
Example
Section titled “Example”SELECT REVERSE('Oracle') FROM dual;Output
Section titled “Output”elcarOExplanation
Section titled “Explanation”The REVERSE function in Oracle SQL returns the input string reversed. In the given example, the string ‘Oracle’ is reversed to ‘elcarO’.