Problems / Trim Whitespace / Editorial
The TRIM() function removes leading and trailing whitespace from a string. Apply it to every text column that needs cleaning.
TRIM()
```sql
SELECT
contact_id,
TRIM(first_name) AS first_name,
TRIM(last_name) AS last_name,
TRIM(email) AS email,
TRIM(phone) AS phone
FROM contacts
```
DuckDB also supports LTRIM() (left only) and RTRIM() (right only) if you need to remove whitespace from just one side.
LTRIM()
RTRIM()
Solve Trim Whitespace yourself →