Genpact interview question

Asked to write sql for some scenarios