SQL window function example

Rank rows within groups using the SQL RANK window function.

Unlike GROUP BY, a window function retains every detail row while calculating a rank independently inside each department.

Write a query, load data, or pick a learning example.

Run with Cmd/Ctrl+Enter