Recall & Review
beginner
What does the TRIM function do in PostgreSQL?
TRIM removes specified leading and trailing characters (spaces by default) from a string.
Click to reveal answer
beginner
How does LTRIM differ from TRIM?
LTRIM removes specified characters only from the start (left side) of a string.
Click to reveal answer
beginner
What is the purpose of RTRIM in PostgreSQL?
RTRIM removes specified characters only from the end (right side) of a string.
Click to reveal answer
intermediate
How do you remove only the character 'x' from both ends of a string using TRIM?
Use TRIM(BOTH 'x' FROM your_string) to remove 'x' characters from both ends.
Click to reveal answer
intermediate
Can TRIM remove characters other than spaces? How?
Yes, by specifying the characters to remove, e.g., TRIM(BOTH 'abc' FROM string) removes any 'a', 'b', or 'c' from both ends.
Click to reveal answer
Which function removes spaces only from the start of a string in PostgreSQL?
✗ Incorrect
LTRIM removes characters (spaces by default) from the left (start) side of the string.
What does RTRIM(' hello ') return by default?
✗ Incorrect
RTRIM removes trailing spaces from the right side, so leading spaces remain.
How to remove all 'x' characters from both ends of 'xxhelloxx'?
✗ Incorrect
TRIM with BOTH removes specified characters from both ends.
Which function removes characters only from the right side of a string?
✗ Incorrect
RTRIM removes characters from the right (end) side only.
What is the default character removed by TRIM, LTRIM, and RTRIM if none specified?
✗ Incorrect
By default, these functions remove spaces if no character is specified.
Explain how TRIM, LTRIM, and RTRIM differ in their behavior and usage.
Think about which side of the string each function affects.
You got /5 concepts.
Describe how to remove specific characters, like 'x', from the start and end of a string in PostgreSQL.
Focus on the syntax of TRIM with custom characters.
You got /4 concepts.