When you want to use commas and semicolons in sentences, or when you are concerned about whether a sentence is or is not a fragment, a good way to start is by being able to recognize dependent and independent clauses.

Independent clause: A group of words that contains a subject, a verb, and expresses a complete thought.  An independent clause can often stand as a sentence by itself.

Example: Jim studied in the Sweet Shop for his chemistry quiz.

There are two types of words that can be used as connector at the beginning of an independent clause:
Coordinating conjunctions: The seven coordinating conjunctions used as connecting words at the beginning of an independent clause are for, and, nor, but, or, yet, and so (You can remember these with the acronym "FANBOYS").  When the second independent clause in a sentence begins with a coordinating conjunction, a comma is needed before the coordinating conjunction.

For example: Jim studied in the Sweet Shop for his chemistry quiz, but it was hard to concentrate because of the noise.

Independent marker word: A connecting word used at the beginning of an independent clause, like also, consequently, furthermore, however, moreover, nevertheless, and therefore. When the second independent clause in a sentence has an independent marker word, a semicolon is needed before the independent marker word.

For example: Jim studied in the Sweet Shop for his chemistry quiz; however, it was hard to concentrate because of the noise.

Dependent clause: A group of words that contains a subject and verb but does not express a complete thought.  A dependent clause cannot be a sentence.

For example: When Jim studied in the Sweet Shop for his chemistry quiz…

Dependent marker words: Words added to the beginning of an independent clause that make it a dependent clause such as after, although, as, as if, because, before, even if, even though, in order to, since, though, unless, until, whatever, when, whenever, whether, and while.

For example: When Jim studied in the Sweet Shop for his chemistry quiz…

(Without the word When, this would be a complete sentence and an independent clause; with When, it becomes a dependent clause.  A reader would ask, "When what?")