EPAM Systems interview question

SQL question medium level was asked