add exception and fix select
add print table which return from query
add exception
add query tests