created an implemented DatabaseUtil.countWithSql method to improve efficiency of some queries