The Question : While dealing with string data type in MySQL, its observed that sometimes unnecessary space character comes in between which hampers the successful execution of a string manipulation module. Name the suitable MySQL function (s) to remove leading, trailing and both type of space characters from a string. Also give MySQL queries to depict the same.
Solution for the question :
i. To remove leading space characters: ltrim() ii. To remove trailing space characters: rtrim() iii. To remove both type of space characters: trim() MySQL Queries: Select ltrim(‘ Hello ’); Select rtrim(‘ Hello ’); Select trim(‘ Hello ’);Output: Hello
The correct answer to the question is researched by our moderators and shared with you. You can give feedback by commenting for the answers you think are wrong.