# 4.5: Sorting the Result

$$\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}}$$

$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$

$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$

$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vectorC}[1]{\textbf{#1}}$$

$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$

$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$

$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

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.

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.