Solve two SQL questions and one Python question based on the provided data.
Use the supplied users, posts, and comments tables. The SQL answers should identify active users from January 2025 and select the highest-scoring post in each subreddit. Provide the Python answer separately using the requested input and output format.
Output
- SQL question 1: one row per qualifying user, with
username, post_count, and average_score, ordered by average_score descending and username ascending.
- SQL question 2: one row per subreddit, with
subreddit, post_id, title, score, and comment_count, ordered by subreddit ascending.
- Python: return the requested output shape for the supplied data.
Output details
- Define active users as those with at least
2 posts during January 2025.
- Round
average_score to 2 decimal places.
- Treat January 2025 as inclusive of
2025-01-01 and exclusive of 2025-02-01.
- Rank posts with
NULL scores last, and break score ties by post_id ascending.
- Count posts with no comments as having
comment_count equal to 0.