Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.4k views
in General by (34.1k points)
closed by

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.

1 Answer

+1 vote
by (34.4k points)
selected by
 
Best answer

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 

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...