Skip to content

RIGHT

  • str: The string from which the rightmost characters will be extracted.
  • len: The number of characters to extract from the end (right side) of the string.
SELECT RIGHT('SQL Documentation', 5) AS 'Right Output';
+--------------+
| Right Output |
+--------------+
| ation |
+--------------+

In this example, the RIGHT() function is used to extract the specified number of characters from the end of the provided string. The string ‘SQL Documentation’ is provided, and the function is asked to return the last 5 characters - ‘ation’.