Jakobi et al. for the first time proposed a novel and practical quantum private query (QPQ) protocol based on SARG04 (Scarani et al. in Phys Rev Lett 92:057901, 2004) quantum key distribution protocol (Jakobi et al. in Phys Rev A 83:022301, 2011). Gao et al. generalized Jakobi et al's protocol and proposed a flexible QPQ protocol (Gao et al. in Opt Exp 20(16):17411---17420, 2012). When $$\theta <\pi /4$$?<?/4, Gao et al's protocol exhibits better database security than Jakobi et al's protocol, but has a higher probability with which Bob can correctly guess the address of Alice's query. In this paper, we propose a flexible B92-based QPQ protocol. Although SARG04 protocol is a modification of B92 protocol and can be seen as a generalization of B92 protocol, our protocol shows different advantages from Gao et al's protocol. It can simultaneously obtain better database security and a lower probability with which Bob can correctly guess the address of Alice's query when $$\theta <\pi /4$$?<?/4. By introducing entanglement, the proposed QPQ protocol is robust against channel-loss attack, which also implies lower classical communication complexity. Similar to Gao et al's protocol, it is flexible, practical, and robust against quantum memory attack.