Whenever you're ready, walk me through how you'd approach this.
Write a SQL query to find the top N records per group.
Explain how you would define each group, rank records within groups, handle ties, and guarantee deterministic results when values are equal. Discuss the main ranking options and their trade-offs.