Slack administrators want to identify the most active channels in the workspace to better understand user engagement. Write an SQL query to rank channels by the total number of messages sent in the last 30 days.
| channel_id(INTEGER) | channel_name(VARCHAR) |
|---|---|
| 1 | general |
| 2 | engineering |
| 3 | marketing |
| message_id(INTEGER) | channel_id(INTEGER) | sent_at(TIMESTAMP) |
|---|---|---|
| 101 | 1 | 2026-02-10 10:00:00 |
| 102 | 1 | 2026-02-10 10:05:00 |
| 103 | 2 | 2026-02-09 15:00:00 |
| channel_name(VARCHAR) | message_count(INTEGER) | activity_rank(INTEGER) |
|---|---|---|
| general | 2 | 1 |
| engineering | 1 | 2 |