RIGHT() FUNCTION
The MySQL RIGHT function is used to extract a substring from a string. It starts the extraction from the RIGHT-most character. The various versions of MySQL support the RIGHT function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.
Syntax:
RIGHT( string, number_of_characters )
Parameters:
string: It is used to specify the string to search.
number_of_characters: It is used to specify the number of characters to extract from the string.
Example:
mysql> SELECT RIGHT ( 'HELLO WORLD', 5);
Output:
'WORLD’
Explanation:
The last five characters are extracted from the RIGHT-most position of the string.