added functional methods for sql