Antra interview question

oops concepts, sql joins and coding