0
0
PostgreSQLquery~10 mins

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

PostgreSQL
SELECT [1]('  hello  ') AS trimmed;
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.
2fill in blank
medium

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

PostgreSQL
SELECT [1]('  world  ') AS left_trimmed;
Drag options to blanks, or click blank then click option'
ARTRIM
BREMOVE
CLTRIM
DTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using TRIM removes spaces from both sides.
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 '.

PostgreSQL
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 the character 'x' only from the left side of the string 'xxexamplexx'.

PostgreSQL
SELECT [1](LEADING [2] FROM 'xxexamplexx') AS left_trimmed_x;
Drag options to blanks, or click blank then click option'
ATRIM
B'x'
C' '
DRTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using RTRIM instead of TRIM for leading characters.
Using space character instead of 'x'.
5fill in blank
hard

Fill all three blanks to remove 'y' characters from the right side of 'testyyy' and then trim spaces from both ends.

PostgreSQL
SELECT TRIM([1] FROM [2]('testyyy', [3])) AS cleaned;
Drag options to blanks, or click blank then click option'
A' '
BRTRIM
C'y'
DLTRIM
Attempts:
3 left
💡 Hint
Common Mistakes
Using LTRIM instead of RTRIM for right side removal.
Not nesting functions correctly.