Sort sequence and row selection
Sort sequences affect selection of data.
SELECT * FROM STAFF WHERE JOB='MGR'The first table shows how row selection is done with a *HEX sort sequence. The rows that match the row selection criteria for the column JOB are selected exactly as specified in the select statement. Only the uppercase 'MGR' is selected.
| ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
|---|---|---|---|---|---|---|
| 30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
Table 2 shows how row selection is done with a unique-weight sort sequence. The lowercase and uppercase letters are treated as unique. The lowercase 'mgr' is not treated the same as uppercase 'MGR'. Therefore, the lowercase 'mgr' is not selected.
| ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
|---|---|---|---|---|---|---|
| 30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
The following table shows how row selection is done with a shared-weight sort sequence. The rows that match the row selection criteria for the column 'JOB' are selected by treating uppercase letters the same as lowercase letters. Notice that all the values 'mgr', 'Mgr' and 'MGR' are selected.
| ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
|---|---|---|---|---|---|---|
| 10 | Sanders | 20 | Mgr | 7 | 18357.50 | 0 |
| 30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
| 50 | Hanes | 15 | Mgr | 10 | 20659.80 | 0 |
| 100 | Plotz | 42 | mgr | 6 | 18352.80 | 0 |