query statement checking