Fantastic! You can now get a substring (part of a string) from a larger string. But what if you need a substring located at the beginning or end of the string? Of course you may use the combination of the
LENGTH() functions but there are two other functions that let you do this easier:
As you might guess,
LEFT() takes the substring starting at the leftmost (leading) character, and
RIGHT() starts from the final character and works backwards. All you need to specify is the string and how many characters you want to return:
SELECT RIGHT(name, 3)
In this case,
RIGHT() returns the last three letters of an item's name.