Introduction
Scalar subqueries let you use a small query inside another query to get a single value. This helps you compare or calculate values easily.
When you want to find a value from another table to use in a condition.
When you need to calculate a value on the fly for each row in your main query.
When you want to compare a column to a single value returned by another query.
When you want to add a calculated column based on a query result.
When you want to filter rows based on a single value from another query.