0
0
SQLquery~10 mins

TRIM, LTRIM, RTRIM in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to remove spaces from both ends of the string ' hello '.

SQL
SELECT [1]('  hello  ') AS trimmed_text;
Drag options to blanks, or click blank then click option'
ALTRIM
BREMOVE
CRTRIM
DTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using LTRIM or RTRIM removes spaces only from one side.
Using a non-existent function like REMOVE causes errors.
2fill in blank
medium

Complete the code to remove spaces only from the left side of the string ' world '.

SQL
SELECT [1]('  world  ') AS left_trimmed;
Drag options to blanks, or click blank then click option'
ATRIM
BCLEAN
CLTRIM
DRTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using TRIM removes spaces from both sides, not just left.
Using RTRIM removes spaces from the right side.
3fill in blank
hard

Fix the error in the code to remove spaces only from the right side of the string ' data '.

SQL
SELECT [1]('  data  ') AS right_trimmed;
Drag options to blanks, or click blank then click option'
ARTRIM
BLTRIM
CTRIM
DREMOVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using LTRIM removes spaces from the left side.
Using TRIM removes spaces from both sides.
4fill in blank
hard

Fill both blanks to remove spaces from the left and right sides of the string ' example '.

SQL
SELECT [1]([2]('  example  ')) AS cleaned;
Drag options to blanks, or click blank then click option'
ALTRIM
BTRIM
CRTRIM
DREMOVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using TRIM inside LTRIM is redundant because TRIM alone removes both sides.
Using REMOVE causes errors.
5fill in blank
hard

Fill all three blanks to remove spaces from both ends and then convert the string ' SQL ' to uppercase.

SQL
SELECT UPPER([1]([2]([3]('  SQL  ')))) AS result;
Drag options to blanks, or click blank then click option'
ALTRIM
BRTRIM
CTRIM
DREMOVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using REMOVE causes errors.
Mixing up LTRIM and RTRIM order.