Database Queries for the dbquery plugin