I got curious about this today, and didn't feel like going outside, in spite of a beautiful Saturday. Just one of those days!
This has the raw commands necessary for building up a database in sqlite that can tag items with keywords. It is based on Tim Place's example, and is very terse. However, it outlines all the stuff that is needed, and is a good foundation for starting your interface for this type of thing. Andrew Benson's example here http://cycling74.com/2008/09/05/data-collection-building-databases-using-sqlite/
To figure this out, I used a nice example I found from searching:
This patch also has a couple example of how to use the "LIKE" command in sql to search for stuff in the database.
Hope this helps someone out there!