How to search for largest value in the server.db?

I made a XP system that saves data using PData, but I am trying to figure out how do I find what player has the largest value?

I am confused on how I would actually search through the file and get the person with the most xp.

Get the xp of all the players and put it into a table.
Then you’d sort the table using the table.sort function, here’s some examples from lua-users.org

I also stumbled upon this:

Well I know how to do stuff that way, but my issue comes from retrieving the data from the server.db file. I am trying to get every single persons xp that has every joined my server.

SELECT * FROM players ORDER BY xp DESC LIMIT 1