Name an intermediate result set.
Section: CTEs and window functions
Use a CTE to stage a subquery
sql
sql
WITH recent_posts AS (
SELECT * FROM posts WHERE created_at >= date('now', '-7 day')
)
SELECT COUNT(*) FROM recent_posts;Explanation
CTEs improve readability for multi-step transformations.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing CTEs and window functions