Database Tutorial

Course Tutorial Site

Site Admin

Scalar Subqueries

without comments

A scalar subquery is a SELECT statement that returns one and only one row of an atomic data type. Atomic data types are discussed in the Data Normalization page. Atomic data types can be scalar data types or composite (alternatively compound) data types because we treat these structures as whole units. A scalar data type is traditionally seen as a int, char, or other base data type that holds only one value at a time. Composite data types may contain a data structure, an object, an array, or a list, which are seen as whole units.

You use a scalar subquery to use a combination of columns to return a single column and row of data. The columns that allow you to filter the query are found in the WHERE clause. They are often the columns that make a row in that table unique, which means they’re the data describing columns that make up the natural key.

Written by michaelmclaughlin

August 13th, 2018 at 1:44 pm

Posted in