partial implementation of select query