Meta needs to rank users based on their engagement scores. If two users have the same score, they should both receive the same rank. However, the next rank in the sequence must be skipped to account for the tie (e.g., 1, 2, 2, 4).
| user_id(INTEGER) | score(DECIMAL) |
|---|---|
| 1 | 4.5 |
| 2 | 4.5 |
| 3 | 3.85 |
| 4 | 4 |
| 5 | 5 |
| user_id(INTEGER) | username(VARCHAR) |
|---|---|
| 1 | meta_dev |
| 5 | zuck |
| log_id(INTEGER) | user_id(INTEGER) | last_login(TIMESTAMP) |
|---|---|---|
| 1001 | 1 | 2026-02-09 12:00:00 |
| user_id(INTEGER) | score(DECIMAL) | rank(INTEGER) |
|---|---|---|
| 5 | 5 | 1 |
| 1 | 4.5 | 2 |
| 2 | 4.5 | 2 |
| 4 | 4 | 4 |
| 3 | 3.85 | 5 |