DA0-002 Data Acquisition and Preparation Practice Question
In SQL, which string function would you use to remove leading and trailing spaces from a column named 'city'?
⚠ Common exam trap
The trap is that LTRIM and RTRIM sound like they handle 'trimming' generically — candidates who don't recall that TRIM handles both sides may pick one of the directional variants.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
TRIM
The SQL TRIM function removes both leading and trailing spaces (or specified characters) from a string. Applied to a column like 'city', TRIM(city) returns the value with all surrounding whitespace stripped, which is exactly what the question asks for.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
TRIM
Why this is correct
TRIM removes both leading and trailing spaces from a string, returning the cleaned value for the city column. It precisely matches the requirement to strip spaces from both ends, unlike LTRIM or RTRIM which handle only one side.
- ✗
RTRIM
Why it's wrong here
RTRIM removes only trailing spaces, so leading spaces in values such as ' Paris' survive. The stem requires both ends stripped, which TRIM performs. RTRIM is correct when only right-side padding must be removed, such as trailing whitespace from fixed-width extracts.
- ✗
LTRIM
Why it's wrong here
LTRIM strips only leading spaces, leaving trailing spaces on values such as 'Paris '. The stem requires both ends removed, which TRIM handles. LTRIM is the correct function when only left-side padding must be eliminated, for example cleaning fixed-width codes with leading fill characters.
- ✗
CLEAN
Why it's wrong here
CLEAN is not a standard SQL string function; it exists in some vendor dialects for stripping non-printable characters, not spaces. The stem requires leading and trailing space removal, which TRIM performs. CLEAN would be relevant when removing control characters from imported text.
About these practice questions
Courseiva writes every DA0-002 question from scratch — 1,004 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
This DA0-002 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-002 exam.