Sometimes a filter depends on a value you have to calculate first, like the company's average salary. A scalar subquery returns exactly one value that you can compare against, such as salary > (SELECT AVG(salary) FROM employees). Use it when the inner query gives one row and one column. If it can return several rows, = or > fails, and you need IN instead.