34/34
Part 6 of 6 · Follow-upsCheck yourself
Check yourself
5 questions
  1. 1.In Denver, listings 21 and 22 both earn 200, behind listing 20 at 270. You rank with RANK() OVER (PARTITION BY city ORDER BY revenue DESC) and keep rank <= 2. What comes back for Denver?

  2. 2.Guest 2 has booking 3 on 2026-01-04 and booking 5 on 2026-01-02. The window orders by booking_id alone. What does the days-to-second-booking query return for guest 2?

  3. 3.You add AND days IS NOT NULL to the outer WHERE of the days-to-second-booking query. What changes?

  4. 4.Austin's daily counts are 1 on January 1, 1 on January 2, 3 on January 4 and 1 on January 9. What does SUM(n) OVER (ORDER BY julianday(booked_on) ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) give for January 9?

  5. 5.The window orders by julianday(booked_on). Which frame counts January 3 through January 9 for the row dated January 9?

Now the problem this lesson builds to: 10 SQL window functions (SQLite)Practice it