0
0
MySQLquery~10 mins

TRIM, LTRIM, RTRIM in MySQL - 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 '.

MySQL
SELECT [1]('  hello  ') AS trimmed;
Drag options to blanks, or click blank then click option'
ALTRIM
BRTRIM
CTRIM
DSUBSTR
Attempts:
3 left
💡 Hint
Common Mistakes
Using LTRIM or RTRIM removes spaces only from one side.
Using SUBSTR does not remove spaces.
2fill in blank
medium

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

MySQL
SELECT [1]('  world  ') AS left_trimmed;
Drag options to blanks, or click blank then click option'
ATRIM
BREPLACE
CRTRIM
DLTRIM
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 ' test '.

MySQL
SELECT [1]('  test  ') AS right_trimmed;
Drag options to blanks, or click blank then click option'
ARTRIM
BTRIM
CLTRIM
DLEFT
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 ' data ' using nested functions.

MySQL
SELECT [1]([2]('  data  ')) AS trimmed;
Drag options to blanks, or click blank then click option'
ALTRIM
BTRIM
CRTRIM
DREPLACE
Attempts:
3 left
💡 Hint
Common Mistakes
Using TRIM inside LTRIM is redundant.
Using REPLACE does not remove spaces properly.
5fill in blank
hard

Fill all three blanks to remove a specific character '#' from both ends of the string '#example#' using TRIM syntax.

MySQL
SELECT TRIM([1] [2] [3] '#example#') AS cleaned;
Drag options to blanks, or click blank then click option'
A'#'
BBOTH
CFROM
DLTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using LTRIM instead of TRIM for both sides.
Wrong order of keywords in TRIM syntax.