further implementation of SQLDatabase with tests