query for adding check with between operator

cleaned up the mess (i hope) , query is rewritten as per your suggestion