Achievers Interview Question

Implement this SQL query.