Lesson 2 / 37 · How a query runs
An alias exists only after SELECT
joined is created by SELECT, step 02. ORDER BY runs after SELECT, so it can use the alias in every database. WHERE runs before SELECT, so PostgreSQL, MySQL and SQL Server reject WHERE joined > …; DuckDB quietly swaps the alias back to signup_date for you.
The query
SELECT name, signup_date AS joined
FROM customers
ORDER BY joined
Try WHERE joined > DATE '2023-04-01': DuckDB runs it, and 4 customers remain.