Type the derived-table-in-FROM pattern:
Type the derived-table-in-FROM pattern:
Answer
SELECT p.name, p.price, a.avg_price FROM products p CROSS JOIN (SELECT AVG(price) AS avg_price FROM products) AS a WHERE p.price > a.avg_price;
The parenthesized SELECT in FROM is the derived table a (one row, the average); CROSS JOIN attaches it to every product so the average can be both compared and displayed.