In actual development, you will always encounter this situation
or in this situation.
If you're still using the Select fields from table where you like '/% ' is definitely a thankless practice, then it's definitely a priority to study MySQL's own functions carefully. My first time is to think that the PHP function in the trim is also possible to use in MySQL, the answer is yes. You can find from the MySQL manual, of course, you can Baidu, I said below the same as predecessors.
SELECT *,trim (Leading '/' from ' path ') as paths from ' ts_back_pic ' limit 10
A grand Introduction to the first, leading, you can delete the characters specified on the left and the string
SELECT *,trim (trailing '/' from ' path ') as paths from ' ts_back_pic ' limit 10
Second, you can delete the specified character on the right and the string
SELECT *,trim (BOTH '/' from ' path ') as paths from ' ts_back_pic ' limit 10
Third, you can delete the specified characters on both sides and the string
The most important, and the PHP function is the difference is that trim in the PHP function is to delete more than one character, and in MySQL, but the deletion of the string
Let's have a simple one.
SELECT *,trim (' path ') as paths from ' ts_back_pic ' limit 10;
Remove both sides of a space
It's a complex, complicated type.
SELECT *, trim (BOTH ' \ r \ n ' from trim (' path ')] as paths from ' ts_back_pic ' limit 10;
Environment: A space after a return to a bit, to remove the space + carriage