query the friends database