UPDATESQL

Unit 5, lesson 5 · NULLIF

Blank is not missing: NULLIF

Missing and blank company names

Empty text, written '', is a value: it is not NULL, so IS NULL and COALESCE both pass it by. In results here, empty text shows as '' and NULL shows as NULL. NULLIF(a, b) gives NULL when a equals b, and a otherwise, so NULLIF(company, '') turns empty text into NULL. NULLIF('', '') is NULL, while NULLIF('Owens Freight', '') is just 'Owens Freight'. Wrap it in COALESCE and one default covers both kinds of gap.

Example
SELECT full_name, company,
       NULLIF(company, '') AS company_or_null
FROM signups
WHERE signed_up >= '2026-09-12';

Your task

The sign-up form added a company field on September 12. Earlier sign-ups have no value (NULL), and people who skipped it sent blank text. For every sign-up, return the full_name and company_name: the company with spaces trimmed, or 'not given' when it is missing or blank.

Tables you will use: signups

Try it in your browserFree, no sign-up. Your query is checked as you go.