hCentive interview question

how to solve 8 queen problem? some database question.