![]() | Chapter 15: Tables | ![]() ![]() |
15.11. Sorting |
The three ways to sort a table exactly correspond to the three different orders in which tables can be repeated through. First:
sort (table name) in random order
This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, in a uniformly random order, and any blank rows at the bottom. Example:
sort the Table of Recent Monarchs in random order;
|
Secondly:
sort (table name) in (table column) order
This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, so that the given column has ascending order, and any blank rows at the bottom. Example:
sort the Table of Recent Monarchs in accession order;
Ascending order means 1 up to 10, say, or A up to Z, with blank values coming last.
|
sort (table name) in reverse (table column) order
This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, so that the given column has descending order, and any blank rows at the bottom. Example:
sort the Table of Recent Monarchs in reverse name order;
Descending order means 10 down to 1, say, or Z down to A, with blank values coming last.
|
Note that blank values will always be placed below non-blank ones, and entirely blank rows last of all. This is true even if we use "reverse".
The method of sorting is "stable", that is, if two rows have the same value then they will stay the same way round in the sorted table, rather than being swapped over.
| ![]() ![]() A deck of cards which can be shuffled and dealt from. |
|
Previous | Contents | Next |