This tutorial explains how to use the MySQL RIGHT function with syntax and examples.
The MySQL RIGHT function allows you to extract a substring from a string, starting from the right-most character.
The syntax for the RIGHT function in MySQL is:
RIGHT( string, number_of_characters )
The string that you wish to extract from.
The number of characters that you wish to extract from string starting from the right-most character.
The RIGHT function can be used in the following versions of MySQL:
Let's look at some MySQL RIGHT function examples and explore how to use the RIGHT function in MySQL.
For example:
mysql> SELECT RIGHT('Tech on the net', 1);
Output: 't'
mysql> SELECT RIGHT('AODBA.com', 4);
Output: '.com'
mysql> SELECT RIGHT('AODBA.com', 12);
Output: 'onthenet.com'
mysql> SELECT RIGHT('AODBA.com', 100);
Output: 'AODBA.com'