Slack's workspace analytics team wants to review activity in active channels during February 2025. Return the channel ID, channel name, and number of messages posted in each active channel during February 2025. Include active channels with no messages during that month with a message count of zero. Exclude archived channels. Sort by message count descending, then channel ID descending. ### Table Schema | Table | Column | Type | |---|---|---| | channels | channel_id | integer | | channels | channel_name | varchar(100) | | channels | is_archived | boolean | | messages | message_id | integer | | messages | channel_id | integer | | messages | posted_at | timestamp | | messages | message_text | varchar(500) | ### Example Input: channels | channel_id | channel_name | is_archived | |---:|---|---| | 1 | engineering | false | | 2 | marketing | false | | 3 | old-project | true | | 4 | announcements | false | ### Example Input: messages | message_id | channel_id | posted_at | message_text | |---:|---:|---|---| | 101 | 1 | 2025-02-03 09:00:00 | Deploy completed | | 102 | 1 | 2025-02-10 10:00:00 | Reviewing the release | | 103 | 2 | 2025-01-31 16:00:00 | January update | | 104 | 3 | 2025-02-05 11:00:00 | Archived project note | ### Example Output Explanation The `engineering` channel has two messages during February, while `marketing` and `announcements` have none. The archived `old-project` channel is excluded even though it has a February message.
DROP TABLE IF EXISTS messages; DROP TABLE IF EXISTS channels; CREATE TABLE channels ( channel_id INT, channel_name VARCHAR(100), is_archived BOOLEAN ); CREATE TABLE messages ( message_id INT, channel_id INT, posted_at TIMESTAMP, message_text VARCHAR(500) ); INSERT INTO channels VALUES (1, 'engineering', FALSE), (2, 'marketing', FALSE), (3, 'old-project', TRUE), (4, 'announcements', FALSE); INSERT INTO messages VALUES (101, 1, '2025-02-03 09:00:00', 'Deploy completed'), (102, 1, '2025-02-10 10:00:00', 'Reviewing the release'), (103, 2, '2025-01-31 16:00:00', 'January update'), (104, 3, '2025-02-05 11:00:00', 'Archived project note');