BrightCart wants to measure how efficiently each acquisition channel converts users across customer segments. Write a PostgreSQL query to calculate conversion rate by channel and segment for users who signed up in January 2024.
A user is considered converted if they have at least one row in conversions with is_conversion = true within 30 days of their signup date.
Requirements
- Return one row per
channel and segment.
- Count total signed-up users and converted users.
- Compute conversion rate as
converted_users / total_users, rounded to 4 decimal places.
- Exclude users whose segment is
NULL.
- Order results by conversion rate descending, then by channel and segment ascending.