Pregunta de entrevista de IBM

coding round with easy code and a sql question