Scalar Subquery

noun

say it: “SKAY-ler SUB-kweer-ee” /ˈskeɪlər ˈsʌbkwɪəri/

A subquery that returns exactly one value, so it can be used wherever a single value fits.

What is Scalar Subquery in a relational database?

Scalar Subquery — A subquery required to return one column and no more than one row.

SELECT order_id
FROM purchase_order
WHERE total_amount > (
    SELECT AVG(total_amount)
    FROM purchase_order
);

In a sentence

  • “A scalar subquery puts the overall average price in a column beside each product.”

Level: Apprentice · More SQL terms at this level

Updated