Common Table Expressions (CTEs)
This query uses a Common Table Expression (CTE), which is a temporary named result set that can be referenced within a single query.
WITH product_customers AS ( SELECT name, age FROM customer_data WHERE product = 'widget' ) SELECT AVG(age) AS avg_age FROM product_customers;