Chubb interview question

Mostly on Advanced SQL topics