Reddit analysts want to compare the typical post performance across active communities. Write a PostgreSQL query that calculates the median post score for each qualifying community during January 2025.
2025-01-01 through 2025-01-31, inclusive, and ignore posts with a NULL score.Use PostgreSQL's percentile_cont(0.5) WITHIN GROUP (ORDER BY ...) to calculate the median. The median should be computed separately for each community, not across all Reddit posts.
| Column | Type | Description |
|---|---|---|
| community_idPK | INT | Unique Reddit community identifier |
| community_name | VARCHAR(100) | Reddit community name |
| is_active | BOOLEAN | Whether the community is active |
| Column | Type | Description |
|---|---|---|
| post_idPK | INT | Unique Reddit post identifier |
| community_id | INT | Referenced Reddit community |
| created_at | DATE | Date the post was created |
| score | INT | Net Reddit post score |
| title | TEXT | Post title |