Made Query methods to database more generic

queryDatabase