The Valeyard wrote:
At that time, Data had not taken the test to become a full Commander. So, Deanna outranked him.
Data was obviously already qualified as a bridge command officer in the first episode, he was the second officer of the ship. LaForge, while still a lieutenant, was a qualified bridge command officer as well. It's not clear when Worf obtained this rating, certainly prior to his taking command of the Defiant for the first time.
I think Data remained a lieutenant commander for as long as he did because of his actions in Pen Pal.
I suspect that Troi's taking of the test and her subsequent promotion aren't directly related.
Maybe not, Deanna may have hit a barrier in terms of her career advancement. She couldn't climb above lieutenant commander while being "only" a councilor. If she want to make commander she would need to add to her skill set. Taking the bridge command officer's test may have been a means to an end.
Deanna wouldn't necessarily have had a particular interest in commanding a starship, but she needed to do something to advance. Her conversation with Beverly on the bridge could have been Deanna exploring her options.