1.This is the boy who works hard. 2.This is the boy who/whom all praise. Why in first sentence who is in nominative case and in other accusative case?
In the first sentence the relative clause is derived from He (nominative) works hard. In the second sentence you have All praise him (accusative).
The structure of the two relative clauses is different. In the first one you have no subject after "who", so "who" is the subject of the relative clause. In the second one you have the subject "all" after "who". So "who/whom" can't be a nominative. By the way, "whom" is the accusative form of "who". Nowadays mostly replaced by who, as this does not lead to ambiguity.