improved queries
added select_test in unit-tests