 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we eradicate leading and trailing space characters from a string in MySQL?
MySQL LTRIM() and RTRIM() functions can be used to eradicate leading and trailing spaces from a string.
MySQL LTRIM() function is used to remove the leading space characters from a string. Its syntax can be as follows −
Syntax
LTRIM(String)
Here, String, is the string, passed as an argument, whose leading space characters are to be removed.
Example
mysql> Select LTRIM(' Hello'); +--------------------+ | LTRIM(' Hello')    | +--------------------+ | Hello              | +--------------------+ 1 row in set (0.00 sec) MySQL RTRIM() function is used to remove the trailing space characters from a string. Its syntax can be as follows −
Syntax
RTRIM(String)
Here, String, is the string, passed as an argument, whose trailing space characters are to be removed.
Example
mysql> Select RTRIM('Hello '); +----------------------+ | RTRIM('Hello ')      | +----------------------+ | Hello                | +----------------------+ 1 row in set (0.05 sec)Advertisements
 