Majorities in USA favor prayers in public schools yet the Supreme Court has ruled that it is a violation of the Constitution . Is the USA undemocratic?
Democracy is not simply a system of "majority rules." Instead, it is a system where everyone (including majorities) must obey the law. The Supreme Court has the right, under our Constitution, to say what the Constitution means. Since the Supreme Court says that the Establishment Clause bans prayer in school, then prayer in school is illegal, regardless of what a majority says.
If majorities are allowed to do whatever they want, there is no true democracy. When majorities of the people approved of slavery, the US was not truly democratic. When majorities of the people approved of denying black people their right to vote, the US was not truly democratic. A democratic country obeys its fundamental laws and protects the rights of minorities, no matter what the majority says.
Finally, if a sufficient majority does not agree with the Supreme Court, it can get the Constitution amended. Until then, prayer in school is illegal and the US is acting as a democratic country by banning it.