Loading…
Loading…
Twenty-four questions on scalar, IN, ANY and ALL subqueries, correlated subqueries and name resolution, derived tables, LATERAL joins, common table expressions and their materialization, and recursive CTEs with cycles, with explanations.
Review quiz for Part 5 (Subqueries and CTEs) of the SQL course:
The questions use the shop database from Part 3:
products (7 rows): Ridge 2 tent 249.99, Summit 4 tent 489.00, Glow head torch 34.50, Basecamp lantern 27.00, Trail 30 backpack 89.95, Day 18 backpack 54.00 and Merino socks 16.00. The lantern's brand and weight_g are NULL. The average price is 137.21.customers (6 rows): Asha (1), Ben (2), Chen (3), Dana (4), Eli (5) and Farah (6). Asha referred Ben and Chen, Ben referred Dana, and Chen referred Farah (referred_by). Asha and Eli have no referrer.orders (6 rows): 101 and 103 by Asha, 102 by Ben, 104 by Chen, 105 by Dana, and 106, a guest order with a NULL customer_id.order_items (9 rows). The lantern has never been ordered.Every question with a query was run on PostgreSQL 17 to confirm its answer. Aim for at least 17 out of 24 before starting Part 6.
Quiz path: step 4. Take the quizzes in this order, after reading each article.
Previous quiz: Aggregation Review (SQL Part 4)
Next quiz: Window Functions Review (SQL Part 6)
24 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.