Let me just chip in with a suggestion to try out sqlite3 -- it's a very handy, very simple implementation of an SQL engine that you can easily play around with to your heart's content. I'm currently using it to fiddle around with a schema I'm developing for an application of my own.
It is a bit of a challenge to get familiar with SQL -- that join feature can be tricky to sort out, but once you do, you'll find that the database can do all of the messy work. :)
Alex / talexb / Toronto
Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.