SQLsubqueryscalartutorial

What is a scalar subquery in SQL? Single value in SELECT for beginners

A scalar subquery is a SELECT that returns exactly one value and slots into a column position or WHERE expression. Plain words: pull one field from a related table, add a summary number to each row of a report, use as a constant in a condition. With tables and common pitfalls.

1 min readSQL · subquery · scalar · tutorial

A scalar subquery is a SELECT that returns exactly one value — one row, one column. You drop it into a column position, a WHERE expression, or a SET assignment, and Postgres substitutes the result.

This article is currently in Russian. The full English translation is on the way.

Practice on real tasks

Solve tasks in the SQL trainer with instant grading and hints.

Open trainer