HackerRank interview question

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