CTEs
1 / 13
EasyOutput prediction

Basic CTE with WITH

Given this table (orders):

idcustomeramount
1Alice100
2Bob200
3Alice300

What does this query return?

WITH totals AS (
  SELECT customer, SUM(amount) AS total
  FROM orders
  GROUP BY customer
)
SELECT customer FROM totals WHERE total > 200;

← → arrow keys to navigate

Sign in to save your progress.