Keep the cards unchanged and sort separate views

Sorting arranges values by a chosen comparison rule. Ascending order puts smaller keys first; descending puts larger keys first. Non-decreasing order allows equal values. Sorting requires a meaningful way to compare the key: numbers, dates and names need appropriate rules.
Physically rearranging the cards for Maths would disturb their Physics ordering. Instead, build [CardNo,mark] pairs and sort these references. Another list can sort the same students by a different field while the original records keep their order.
The key decides order; the record travels with it. Sorting [ID,Total] by Total does not mean sorting by ID. Stable identifiers preserve the connection to names and other fields after list positions change. Several ordered views can coexist.
Try it yourself
Does sorting by CardNo automatically sort Total?
Show explained answer
No. The comparison key must be the property whose order you want.
Try it yourself
Does ascending require every next value to be strictly greater?
Show explained answer
No. Equal neighbours are allowed in non-decreasing order.
Try it yourself
What stays attached to a mark when its pair moves?
Show explained answer
Its student ID. Keep the whole pair together.
