PBT Group interview question

Extremely difficult SQL questions(By anyone's standard)