When to use that and when to use which?
That introduces a restrictive clause, which is critical to understanding the sentence because the clause defines its antecedent. E.g. The brown house that has a rooftop is my favourite.
Which introduces nonrestrictive clause, which include information relevant but not critical to an understanding of the sentence. E.g. The brown house, which has a rooftop, is my favourite.
Some links on the use of that _and _which: