sql queries test debugging