Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Simple text functions
How to modify Strings
19. The LEFT() and RIGHT() functions


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? Two other functions let you do this: LEFT() and RIGHT(). 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:

  Right(Name, 3) AS NameEnd
FROM Item;

In this case, RIGHT() returns the last 3 letters of an item's name.


The boss of the marketing agency would like to get the first initial of every copywriter's first name and the last letter of their last name.

Select a list of the first letter of each copywriter's first name and the last letter of their last name. If the first name or last name is empty, omit that writer from the list. Name the columns BeginFirstName and EndLastName.

Stuck? Here's a hint!

Use LEFT() for FirstName and RIGHT() for LastName. Set the length parameter to 1.