How to use the substr function of mysql Database
This article is about how to use the substr function in mysql database. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
The substr function usage of the database: 1. [SUBSTR (str,pos,len)] intercepts len characters from the position of pos; 2, the position of [SUBSTR (str,pos)] pos is intercepted until the end.
Usage of the substr function of the database:
1. SUBSTR (str,pos,len): intercepts len characters from the position starting from pos
Substr (string, 1Pol 3): take a 3-word string from the first position on the left of the string.
So the result is: str
Substr (string,-1Pol 3): take a 3-word string from the first position on the right of the string. Obviously, the first position on the right is less than three words long from the right.
The result can only be: G
Substr (string,-3 string 3): take a string of 3 words long from the third position on the right of the string.
The result is: ing
2. SUBSTR (str,pos): the position where the pos starts and is intercepted until the end.
Substr (string, 4): intercepted from the 4th position on the right to the last
The result is: ing
Thank you for reading! On the use of mysql database substr function to share here, I hope that the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.