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.sql
Loading SQL engine...
Downloading SQL engine… (one-time)

Downloading SQL engine… (one-time)

This runs entirely in your browser and is cached for next time.