The relative pronoun who, which and that
The relative pronoun that is only used in identifying (restrictive) relative clauses.
The boy who stole the bicycle has been caught. OR The boy that stole the bicycle has been caught.
Here the relative clause ‘who / that stole the bicycle’ is identifying. It is used to identify the boy. (Which boy – the boy who / that stole the bicycle)
That cannot be used in non-identifying relative clauses.
John, who stole the bicycle, has been caught. (NOT John, that stole the bicycle, has been caught.)
Here the relative clause ‘who stole the bicycle’ is not necessary for the identification of the noun John. He has already been identified by his name.
The relative pronoun that is preferred after:
Adjectives in the superlative degree
He was the most eloquent speaker that I ever heard.
This is the best that we can do.
After the words all, same, any, none, nothing, only and as
All that glitters is not gold.
I am the same person that I have always been.
It was not for nothing that he studied psychology.
After the interrogative pronouns who and what.
What is it that worries you so much?
After two antecedents when one of them denotes a person and the other denotes an animal or thing.
The boy and his dog that trespassed on the club premises were whipped. (NOT The boy and his dog which trespassed…) (NOT The boy and his dog who trespassed…)