Hi, Anewcomer,
If you simply want to make a question, then the right sentences are these ones (bold):
"why doesn't our school have a canteen" and "why our school doesn't have a canteen"
"What he is trying to do" and "what is he trying to do"
"What school is the best" and "what is the best school"
The other ones are correct if it's a complex sentence such as:
I have no idea why our school doesn't have a canteen.
It is difficult to understand what he is trying to do.
I have to find out what school is the best.