SQL 2023 · Joins and combining queries

Name a subquery with a CTE

Break a query into readable steps.

WITH recent AS (
  SELECT * FROM orders WHERE created_at > CURRENT_DATE - 30
)
SELECT user_id, COUNT(*) FROM recent GROUP BY user_id;

Official SQL 2023 documentation

More joins and combining queries commands

All joins and combining queries commands · SQL 2023 cheatsheet

Was this page helpful?