select and where added to db including tests