HackerRank Interview Question

Writing a SQL query for some problem that I don't remember