Add query function to run sql statement