SQL Fundamentals

String Functions & Operations: Real-World

A customer database stores names like " John Doe " (extra spaces), emails in mixed case "John.Doe@Gmail.Com", and phone numbers "555-123-4567". You need to: nor

A customer database stores names like " John Doe " (extra spaces), emails in mixed case "John.Doe@Gmail.Com", and phone numbers "555-123-4567". You need to: normalize names, search by email domain, extract area codes, and clean messy user input without breaking database performance.

Canonical customer contact data

A customer platform needs comparable email values and a readable display name without corrupting the original source fields.

Consistent normalization reduces duplicates while presentation formatting remains explicit.

Normalize comparison and format presentation

SELECT customer_id, LOWER(TRIM(email)) AS normalized_email, CONCAT(first_name, ' ', last_name) AS display_name FROM customers;

All