Show TOC

Syntax documentationScalar Subqueries Locate this document in the navigation structure

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

Syntax Syntax

  1. <scalar subquery> ::= '('<query specification>')'.
End of the code.
Example

Syntax Syntax

  1. UPDATE employees 
                   SET salary = salary * 1.1 
                   WHERE 2 * salary < 
                                ( SELECT MAX( salary ) FROM employees ) )
    
End of the code.

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%.