Blog · Guide
SQL CTEs Explained: WITH Clauses You Can Read
A CTE (WITH …) names a temporary result so multi-step queries stay readable — great for “paid orders first, then …”.
Name a step, then use it
WITH paid AS ( SELECT * FROM orders WHERE status = 'paid' ) SELECT * FROM paid;
Same power as a subquery, clearer when you chain logic. Think of it as a named scratch table for one query.
Try it yourself
The fastest way to lock this in is a short drill on the same Northstar Market tables.