Theoretically there are three large divisions within Starfleet - Command (which includes helmsmen), Sciences (includes medical) and Operations (engineering and security). Departments are supposed to be orthogonal to ranks, yet in practice there seems to be a glass ceiling.
Michael Eddington comments in The Adversary that you don't get to be a captain wearing a gold uniform. (Obviously this is in the TNG era when operations wore gold and command wore red, as opposed to the TOS-era inverse.)
We know that even cadets can be in the command division (see Wesley Crusher and Nicholas Locarno, as well as some in Red Squad), but at the other end there are not many examples of officers above the rank of Lieutenant Commander outside the command division. I think we saw a yellow-uniformed flag officer at some point in DS9 or TNG (I can't find the picture now.) and Beverly Crusher became an Admiral as Head of Starfleet Medical in PIC. Montgomery Scott also appears to reach the rank of Captain by the end of the TNG films while switching between Engineering and Command colours on an inconsistent basis. Are there any other examples?
Michael Eddington comments in The Adversary that you don't get to be a captain wearing a gold uniform. (Obviously this is in the TNG era when operations wore gold and command wore red, as opposed to the TOS-era inverse.)
We know that even cadets can be in the command division (see Wesley Crusher and Nicholas Locarno, as well as some in Red Squad), but at the other end there are not many examples of officers above the rank of Lieutenant Commander outside the command division. I think we saw a yellow-uniformed flag officer at some point in DS9 or TNG (I can't find the picture now.) and Beverly Crusher became an Admiral as Head of Starfleet Medical in PIC. Montgomery Scott also appears to reach the rank of Captain by the end of the TNG films while switching between Engineering and Command colours on an inconsistent basis. Are there any other examples?

