Pregunta de entrevista de Sanofi

SQL query based on window functions, joins