added SQL Query tests + bug fixes
added SQL Query tests + bug fixes