^The fact that Beverly took command training while serving on the Enterprise in TNG is evidence that it can be undertaken at any point in an officer's career. This is supported by non-canon offscreen sources. The FASA RPG had command school as a floating option that could be taken at any point in an officer's post-graduation career.
It's not canon, but it's a viable theory that isn't disproven onscreen.
FWIW, I don't think thats the same as command school, merely a way for non Line officers to become line officers. My guess would be that Beverly took the exam while she spent a year at Starfleet medical since she returns as a full commander and Deanna gains that rank upon completing the exam ( which always struck me as a little odd tbf) Clearly though that exam hardly requires intensive training since it seems to take Deanna a couple of weeks at most.