Pregunta de entrevista de Experian

A question about SQL query and was asked to solve it without using SQL Server