Subquery Result
Predict Output Medium
Question
What does this SQL produce?
Code
-- products: (1,"A",100), (2,"B",200), (3,"C",150)
SELECT name FROM products
WHERE price = (SELECT MAX(price) FROM products);
Hint
Subquery finds max price (200), outer query finds product B.
Explanation
The subquery SELECT MAX(price) returns 200. The outer query finds products where price = 200, which is product B. Result: B.
Related Resources
Related Lessons
- Subqueries
Learn subqueries.
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.