You're working as a data analyst for a car dealership chain, and you need to analyze their daily sales performance across different car brands and locations.
You have a DailySales table that tracks every sale made:
| Column Name | Type |
|---|---|
| date_id | date |
| make_name | varchar |
| lead_id | int |
| partner_id | int |
Note: This table has no primary key and may contain duplicate rows. Each row represents a sale transaction with the date, car brand (make_name), the lead who brought the customer (lead_id), and the dealership partner who closed the sale (partner_id).
Your Task: For each unique combination of date_id and make_name, calculate:
- The number of distinct leads who brought customers
- The number of distinct partners who made sales
This analysis will help the company understand which brands are performing well and how many unique salespeople are involved in each brand's daily sales.
Example: If on 2020-12-08, Toyota had sales involving leads [1,1,2] and partners [3,4,4], the result should show 2 unique leads and 2 unique partners for Toyota on that date.
Input & Output
Constraints
- 1 โค Number of rows โค 104
- date_id is in format YYYY-MM-DD
- make_name consists of lowercase English letters only
- The table may contain duplicate rows
- lead_id and partner_id are positive integers