Show TOC

Scalar SubqueriesLocate this document in the navigation structure

A scalar subquery is a subquery that return exactly one row with exactly one column.

<scalar subquery> ::= '('<query specification>')'.
         

Example

UPDATE employees 
               SET salary = salary * 1.1 
               WHERE 2 * salary < 
                            ( SELECT MAX( salary ) FROM employees ) )

            

Comparison Predicate and Scalar Subquery. The salary of all employees that earn less than half as much as the best paid employee is raised by 10%.