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 https://cycling74.com/tutorials/data-collection-building-databases-using-sqlite/
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!