|
Ascending and descending sorting |
Scroll |
Sorting in ascending order occurs differently depending on the data type in the column.
In columns with a numeric data type, items are sorted by comparing their values. As a result of sorting, the numbers are arranged in ascending order.
Example of numerical values list sorted in ascending order:
25
125
250
In columns with "string" data type items are sorted in ascending order by comparing symbols in the corresponding positions of the lines (starting from the first position). As a result of the sorting, the first string will be a string with the first non–similar symbol closer to the beginning of the alphabet. Digits precede characters, and Latin characters precede Cyrillic characters. An example of sorting by ascending is the arrangement of articles in most dictionaries and encyclopedias.
Example of designations list sorted in ascending order:
A125GP
A25MP
D250MP
D25GP
In this case, the first symbols of the strings were compared first. Strings beginning with A precede the lines beginning with D. Inside the first group of strings (A25MP and A125GP) symbols in the second position were compared – 1 and 2. The first string is the string that contains 1 in the second position. Further comparison of strings starting with D revealed that their 2–nd and 3–rd symbols were the same. As a result of comparing the 4–th symbols (digits 0 and characters G) the string with the character went to the last place.
Sorting in descending order also occurs differently depending on the data type in the column. The descending sorting rules are the opposite of the ascending sorting rules.
The lists sorted in the previous example in ascending order, after sorting in descending order will look like this:
250
125
25
and
D25GP
D250MP
A25MP
A125GP