in reply to More Sorted Business with Hashes

select key, value from table order by value

From there, you want to use arrays as you have noted. A hash is fine so long as you require no particular order, it is essentially a lookup table. As soon as you are iterating across it, it becomes (generally) more sensible to use an array.