SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog

© 2026 SQL Playground. Built for developers.

PrivacyTermsAboutRSS Feed
SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog
Initializing...
Chapter 5: Subqueries
5-1
Your Progress

Scalar Subqueries

A subquery is a query nested inside another query. A scalar subquery returns a single value (one row, one column).

You can use it in a WHERE clause to compare values against a calculated result.

-- Find students with scores higher than the class average
SELECT * FROM students 
WHERE score > (SELECT AVG(score) FROM students);

Task: Find all products that are more expensive than the average price of all products.

Loading...
Run a query to see results