Arhu stared at the empty space between the two statues, and shivered. From a world defended by dragons to one where humans are enslaved by subhuman monstrosities, the only limit to science fiction is that it must be capable of existing in this Universe, more or less. Within that single condition, anything goes. My bookshelves include a wide variety of science fiction, from many different authors, using a multitude of different settings for their stories. Hard-science SF is science fiction in which the emphasis is on the science .
Space opera is a type that's hard to describe except by example.
Science fantasy is SF that borders on fantasy, because it presses the limits of what is scientifically possible. Military stories have been a staple of fiction as long as fiction's been around. Military SF consists of military fiction set against an SF background. SF exists in visual media too, and sometimes those spawn written tie-ins. Star Trek really started this phenomenon back in the late 70s, but others have joined in, resulting in a flood of such tie-in novels.