RBHU Analytics interview question

How would write a function in sql?