[NFR] Allow HAVING without GROUP BY in the query builder

See #1115

Bonus:
  * PHQL parser's grammar has been simplified