Skip to main content
Engineering LibreTexts

4.5: Sorting the Result

  • Page ID
    15514
  • \( \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}}\)

    Sometimes an end user wants to see data in a particular order. Let us extend the previous example so books are listed in alphabetic order by title and, since they are all paperbacks we will not display the paperback field.

    Create another query similar to the last one. Now, place the cursor in the Sort line beneath the title field: click and select ascending from the choices. Then click the Show check box for paperback to turn Show off.

    Query results can be sorted.
    Figure \(\PageIndex{1}\): Query results can be sorted.

    Save this query and run it. Notice how the results are sequenced by title.

    Exercises

    Exercise \(\PageIndex{1}\)

    List the titles of books in descending order.

    Exercise \(\PageIndex{2}\)

    List the titles of books written by Joe Celko.

    Exercise \(\PageIndex{3}\)

    List all members of the library.

    Exercise \(\PageIndex{4}\)

    List the members in sequence by last name.

    Exercise \(\PageIndex{5}\)

    List the members sequenced by last name and then by first name. (If members have the same last name they appear on consecutive lines, and those lines are in sequence by first name.)

    Exercise \(\PageIndex{6}\)

    Which of the above are a) simple queries, b) selection queries, c) projection queries, d) both selection and projection queries?


    This page titled 4.5: Sorting the Result is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Ron McFadyen.

    • Was this article helpful?