hCentive Interview Question

how to solve 8 queen problem? some database question.