EPAM Systems Interview Question

SQL Excercise. Write a couple of intermediate queries