RIGHT() function in MySQL is used to extract a specified number of characters from the right side of a given string. Second argument is used to decide, how many characters it should return.
Syntax :
RIGHT( str, len )
Parameter : This function accepts two parameters as mentioned above and described below :
- str : The given string from whose right side a number of characters are to be extracted.
- len : The number of characters to extract. If this parameter is larger than the number of characters in string, this function will return the actual string.
Returns : It returns a number of characters from a string (starting from right).
Example-1 : Applying RIGHT() Function to a given string.
SELECT RIGHT("geeksforgeeks", 4) AS Right_Str;
Output :
Right_Streeks