base sql methods and tests