queries against sql working