Database Tutorial

Course Tutorial Site

Site Admin

Scalar Subqueries

with 4 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

October 8th, 2009 at 8:39 pm

Posted in

4 Responses to 'Scalar Subqueries'

Subscribe to comments with RSS or TrackBack to 'Scalar Subqueries'.

  1. The inverted tree example is really confusing to a lot of us. Perhaps an image is necessary for it to be understood.


    19 Jul 10 at 12:00 am

  2. Is this a typo or…?

    “Scalar subqueries uses a SQL statement to look something up in the database based on business rules because business rules.”

    Chris Staber

    30 Sep 10 at 10:46 am

  3. I found similar problems in three areas. I believe they’re fixed, if not let me know.


    3 Oct 10 at 12:30 pm

  4. Kara, An illustration of the relationship and examples of output are found in the Hierarchical Queries web page.


    22 Oct 14 at 2:12 am

Leave a Reply