In the following sample query, the retrieved rows are first ordered by supplier number, and then by descending part number order -- within the same supplier number grouping.
SELECT sno, pno, qty FROM partsupp ORDER BY sno, pno DESC
The query results are as follows:
| sno | pno | qty |
|---|---|---|
| S1 | P6 | 100 |
| S1 | P5 | 100 |
| S1 | P4 | 200 |
| S1 | P3 | 400 |
| S1 | P2 | 200 |
| S1 | P1 | 300 |
| S2 | P2 | 400 |
| S2 | P1 | 300 |
| S3 | P2 | 200 |
| S4 | P5 | 400 |
| S4 | P4 | 300 |
| S4 | P2 | 200 |