WebMD Health interview question

Asked to right SQL queries medium level