CTEs are low-key one of the best features of SQL. Great for debugging big queries, such as:
with source as (
select * from wherever
),
transformed as (
...
),
joined as (
...
),
final as (
...
)
select * from final
You can switch `final` to `transformed` to see what the query is doing internally. Almost like having good control flow. Almost.