RIGHT() extracts a specified number of characters from the end of a string. If the specified length exceeds the string's length, the entire string is returned. This function is useful for extracting portions of strings from the right side, such as file extensions, suffixes, or end portions of text.
RIGHT(string, length)
RIGHT() returns a character string
// Extracting from the end
RIGHT("APPLES AND ORANGES", 7) = "ORANGES"
RIGHT("APPLES AND ORANGES", 11) = "AND ORANGES"
// Length exceeds string length
RIGHT("APPLES AND ORANGES", 20) = "APPLES AND ORANGES"
// Edge cases
RIGHT("HELLO", 0) = "" // Zero length
RIGHT("HELLO", 5) = "HELLO" // Exact length
RIGHT("", 5) = "" // Empty string