format queries