Pergunta de entrevista da empresa RBHU Analytics

How would write a function in sql?