Add support for querying events by `certname`
Add tests for 'and' queries
Add support for 'NOT' queries

This commit adds support for (and tests for) 'NOT' queries.

There were a few minor complications due to the fact that SQL treats
NULL specially when used with boolean operations, but the solution
we arrived at seems to work fine for both Postgres and HSQL.