1. Another idea:
identify the new varchar column (orderCode) in the list table. This column stores the order for each element in char format, as shown below:
'1','2','3','4','5','6', '7', '8', '9', '91', '92',....
Now, if you want to insert an element between 1 and 2, the orederCode value will be "11". And the order of the list will be:
'1','11','2','3','4','5','6', '7', '8', '9', '91', '92',....
Now suppose you insert between 11 and 2, you insert the value orderCode = '12':
'1','11','12','2','3','4','5','6', '7', '8', '9', '91', '92',....
Finally, if you want to insert an item from "11" and "12", the order value will be: "111":
'1','11','111','12','2','3','4','5','6', '7', '8', '9', '91', '92',....'99','991,...
you can run a query from time to time to commit values ββof the order of one char.
2. The best solution:
use floating point data type instead of varchar. So this list:
'1', '11', '111', '12', '2', '3', '4', '5', '6', '7', '8', '9', '91', '92',....
will look like this:
0.1, 0.11, 0.111, 0,12, 0.3, 0.4, 0.5, 0.6, ......,0.9,0.91,....
defiantly, floating point sorting is faster than varchar sorting.