Paths Subjects Questions Quizzes Pricing Search
Intermediate Open Pro

Interview Round: Top-N per Group, Nth Highest, Streaks

Answer as you would at a whiteboard, stating tie-handling explicitly.

  1. Return each country's top 2 users by total paid revenue.
  2. Return the third-highest distinct order amount; return NULL if there is no such value. Show two approaches and say how they differ on ties.
  3. Find users who placed a paid order on at least 4 consecutive calendar days, with the start date of each such streak. Explain the date - row_number trick with a tiny example.

Share this question

← Back to SQL for Data Analysis practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.