For the 42 seasons that “Saturday Night Live” has been on the air, critiquing the show has not only been the preoccupation of comedy nerds but also every American’s national duty. No viewer, however, has seen his criticism of the show scrutinized — or had the show get under his skin — quite like President Trump.

Mr. Trump is the first president of the United States to take umbrage publicly at his portrayal on “S.N.L.” and fight back in real time (a phenomenon that began this past fall, when Alec Baldwin began impersonating him). That fraught dynamic is even more remarkable given that Mr. Trump has been lampooned on the program regularly for almost 30 years — he is as much of an “S.N.L.” character as Stefon, the Church Lady or Debbie Downer — and for a time he seemed to enjoy a friendly relationship with the show. So where did it all go awry?

With Mr. Baldwin about to host “Saturday Night Live” this weekend and the world waiting to see how (if at all) Mr. Trump reacts, here’s a look back at the complicated relationship between the chief executive and the comedy series he loves to hate.