Genpact Interview Question

Asked to write sql for some scenarios