A Commander is a commander, which outranks a SGT MAJ. However, a good officer should almost never have to give an order to a SGT MAJ. Also a good SGT MAJ will put his comander in aposition to have to be given an order. The Commander and SGT MAJ realtionship is a very close one. In public it is the most professional relationship ever displayed. Behind closed doors, the CO and the SGT MAJ should have very open and very frank discussions about anything. The SGT MAJ should take it personally when his commander fails. Usually it is a direct reflection of their profesional relationship.
No, a warrant officer regardless of rank does not outrank a commander. However, once again, a good commander should weigh the input of an experienced Warrant Officer. Not to be confused with being bullied or pushed around by the Chief. Please note, that in the Army, within the Transportation Corps, there are boat platoons. When the boats are in dock, the LT is in charge of the boats and the crews; however, once the boats are out to sea, the Warrant Officer is in command and the LT falls under that command.
Hope this helps. Remember leadership is not demonstrated in a vaccumm.