Uses of comma in a complex sentence
The comma is used to separate an adverb clause from its principal clause.
After he finished his studies, he joined the army.
Before I go out, I will give you a call.
Note that when the adverb clause comes after the principal clause or when it is very short, the comma is usually omitted.
He joined the army after he finished his studies. (He joined the army, after he finished his studies.)
I will give you a call before I go out.
When there are two or more noun clauses we usually use a comma to separate them.
No one knows where he is, what he is doing or how long he will be away.
When there are two or more adjective clauses we usually use a comma to separate them.
This is the book which Shakespeare wrote, which the whole world admires and which thousands read every day.
The comma is also used to mark off a non-restrictive relative clause.
I rang up Mrs Spencer, the Manager’s secretary, who did our accounts.
James, who is a painter, comes from Chicago.
This is Jane, who does my hair.
Note that when the relative clause is restrictive or identifying we do not use the comma to separate it from the rest of the sentence.
This is the house that Jack built. (NOT This is the house, that Jack built.)