Goldman Sachs interview question

3SQL + 1 easy coding