Trimming Whitespace

SQL

Using TRIM

Cleaning Whitespace with TRIM

The Problem

Real-world data often has extra spaces:

  • " John " instead of "John"
  • " Sales" instead of "Sales"

    The Solution

    TRIM(column) removes leading and trailing spaces:

SELECT TRIM('  hello  ') -- Returns 'hello'

Your Task

Clean the leads table data:

  • Show: id, cleaned first_name (trimmed), cleaned last_name (trimmed)
  • Order by id
  • Limit to 10 results

    The original data has inconsistent spacing that needs cleaning.

Query Editor
Loading SQL engine...
Loading...
Loading SQL engine...

Run your query to see results