Find the Subquery Mistake
Find the Mistake Medium
Question
This query has an error. Find and fix it:
Code
SELECT * FROM orders
WHERE total > SELECT AVG(total) FROM orders;
Hint
Subqueries in WHERE need to be wrapped in parentheses.
Explanation
The subquery is not wrapped in parentheses. In a WHERE clause, subqueries must be enclosed in (). Fix: WHERE total > (SELECT AVG(total) FROM orders).
Related Resources
Related Lessons
- Subqueries
Learn subquery syntax.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.