Skip to main content
Engineering LibreTexts

4.3: Projection Query

  • Page ID
    15512
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Next we build a query that displays a subset of the columns of a table. Suppose we need to produce a listing of call numbers and titles. Proceed as in the previous example so that the Book table is shown in the Relationships area. Now, double-click the callNo and title fields:

    Query showing specific fields.
    Figure \(\PageIndex{1}\): Query showing specific fields.

    The definition of the query is now complete. The grid area indicates the fields involved, and both fields will be displayed because each has a check mark on the Show line. Only fields checked on the Show line are displayed in the results. Running this query yields:

    Table \(\PageIndex{1}\): Query results.

    callNo

    Title

    CB 351 M293 1983

    Atlas of medieval Europe

    HQ 1143 P68 1975

    Medieval women

    PC 14 V48 1965

    Medieval miscellany

    QA 76.73 S67C435 2004

    Joe Celko's Trees and hierarchies in SQL for smarties

    QA 76.73 S67C46 1997

    Joe Celko's SQL puzzles & answers

    QA 76.76 A65P76 2011

    Programming Android

    QA 76.9 D26H355 2008

    Information modeling and relational databases

    QA 76.9 D26H39 1996

    Data model patterns : conventions of thought

    QA 76.9 D35C45 1999

    Joe Celko's data & databases : concepts in practice

    R 141 E45 2006

    Medieval medicine and the plague

    R 487 T35 1967

    Medicine in medieval England.

    Save the query. A projection query, because it displays a subset of the fields in the table, is said to produce a vertical slice of the table.


    This page titled 4.3: Projection Query is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Ron McFadyen.

    • Was this article helpful?