trying to figure out how to query database