ZeMoSo interview question

I was asked few java problems and then I was asked to write the same logic in SQL