Here are some examples of compound sentences.
Examples of Compound Sentence: I have a toy car and it is red.
Independent Clause: I have a toy car.
Independent Clause: It is red.
Compound Sentence with Comma and Conjunction: I have a toy car, and it is red.
Compound Sentence with Comma: I have a toy car, it is red.
Compound Sentence with Semicolon: I have a toy car; it is red.
Josh stayed at the party, but I went home.
Independent Clause: Josh stayed at the party.
Independent Clause: I went home.
Compound Sentence with Comma and Conjunction: Josh stayed at the party, but I went home.
Compound Sentence with Comma: Josh stayed at the party, I went home.
Compound Sentence with Semicolon: Josh stayed at the party; I went home.
Example of NOT a Compound Sentence.
She went there to buy coffee and study algebra.
Independent Clause: She went there to buy coffee.
Dependent Clause: study algebra
*Note: This is NOT a Compound Sentence because there is only one subject "She" in the only Independent Clause and because the conjunction "and" combines an Independent Clause with a Dependent Clause ("study algebra" has no subject—who is studying algebra?—and cannot be understood all alone).