some refactoring and add sql select Query builder