What is the purpose of the right function in SQL?
The RIGHT function in SQL is used to extract a specified length of characters from the right side of a string. Its basic syntax is as follows:
RIGHT(string, length)
- string is the source string from which characters are to be extracted.
- “Length is the number of characters to extract.”
The RIGHT function returns a specified number of characters from the right side of the original string. If the length of the original string is shorter than the specified number, the entire original string will be returned. This is particularly useful when you need to extract a specific number of characters from the right side of a string.