in reply to arrays in database

Arrays are typically represented in relational databases using a table like this:
SEQUENCE INT VALUE TEXT
Then you can use the SEQUENCE column in an ORDER BY clause.