When working with MySQL databases, you might occasionally find yourself needing to select only a certain number of characters from the left or right of a string. In such cases, you can use the LEFT()
and RIGHT()
functions to do just that.
Here’s the syntax for both of these functions:
LEFT(str,len) RIGHT(str,len)
Where str
is the string that contains the substring you need to return, and len
is the number of characters from the left you want returned.