1. เรียนรู้
  2. /
  3. Courses
  4. /
  5. Data Pipeline Automation in Snowflake

Connected

Exercises

RANK vs DENSE_RANK

Harbr's operations team wants to rank AMER shipments by delivery speed. You'll compare RANK() and DENSE_RANK() on logistics.shipments, which has columns shipment_id, region, and delivery_days. Because several AMER shipments share the same delivery time, the two functions produce noticeably different results.

คำแนะนำ 1 / 3

undefined XP
  • 1
    • Rank AMER shipments by delivery_days (fastest first) using RANK().
  • 2
    • Replace RANK() with DENSE_RANK() and observe the difference in ranking gaps.
  • 3
    • Add PARTITION BY region so the ranking restarts independently for each region.