Relative Clauses 

Relative clauses are subordinate clauses which describe a person or an object in a more detailed way. The relative clause always follows the main clause, directly (or as close as possible) after the word it refers to.
Main clause Main clause
In dem alten Haus wohnt ein Mann. Er hat einen schwarzen Sportwagen.
Main clause Relative clause
In dem alten Haus wohnt ein Mann, der einen schwarzen Sportwagen hat.

Relative clauses are introduced with a relative pronoun.

Gender and number (masculine, feminine, neutral, Plural) of the word the relative
clause refers to in the main clause and the function of the relative pronoun in the
relative clause decide on the relative pronoun.

The word the relative clause refers to decides on:
Singular
masculine
Singular
neuter
Singular
feminine
Plural
The function of the
relative pronoun
decides on:
Nominative der das die die
Accusative den das die die
Dative dem dem der denen
Genitive dessen dessen deren deren

If there is a verb with a preposition in the relative clause, the preposition
is placed before the relative pronoun.

Main clause Relative clause
In Ulm fand der erste Deutschkurs statt, an dem ich teilgenommen habe.