SQL RIGHT Function: Syntax & Examples
The RIGHT function in SQL is used to return a specified number of characters from the right of a string. Its syntax is as follows:
RIGHT(string, length)
“Where string is the string from which characters are to be retrieved from the right side, and length is the number of characters to be retrieved.”
For example, to retrieve the last 5 characters from the string “Hello, World!”, you can use the following SQL statement:
SELECT RIGHT('Hello, World!', 5);
The execution result of the above statement will return “orld!”.