Allow flexible conditioning when querying database

No longer have a hard-coded "WHERE %s" in order to allow more flexible
querying such as retrieving all rows using "ORDER BY %s".