Q.To remove the leading and trailing space from data values in a column of MySql Table, we use (A) Left ( ) (B) Right ( ) (C) Trim ( ) (D) Ltrim ( )
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Removing both leading and trailing spaces requires a function that works on both ends of the string; TRIM() does exactly that, while LTRIM() and RTRIM() handle only one side each.
Why TRIM() is the answer
When you store text data in a MySQL table, extra spaces can creep in—sometimes users accidentally type a space before or after their input, or data imports include padding. These invisible characters cause problems: searches fail, comparisons break, and your data looks messy.
MySQL gives you three functions to clean up whitespace:
- LTRIM() removes spaces from the left (leading) side only
- RTRIM() removes spaces from the right (trailing) side only
- TRIM() removes spaces from both ends
The question asks for a function that handles both leading and trailing spaces. That immediately tells us we need something that works on both ends simultaneously.
LEFT() and RIGHT() are completely different—they extract a specified number of characters from the left or right side of a string. They don't remove anything; they're substring functions. So options (A) and (B) are out.
LTRIM() only handles the left side. If your data is " hello ", LTRIM() gives you "hello " with the trailing spaces still there. Option (D) is incomplete. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.