Skip to content

Commit 15541c7

Browse files
committed
task: #1693
1 parent 502e44b commit 15541c7

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Have a good contributing!
5050
- [1068. Product Sales Analysis I](./leetcode/easy/1068.%20Product%20Sales%20Analysis%20I.sql)
5151
- [1407. Top Travellers](./leetcode/easy/1407.%20Top%20Travellers.sql)
5252
- [1484. Group Sold Products By The Date](./leetcode/easy/1484.%20Group%20Sold%20Products%20By%20The%20Date.sql)
53+
- [1693. Daily Leads and Partners](./leetcode/easy/1693.%20Daily%20Leads%20and%20Partners.sql)
5354
- [1729. Find Followers Count](./leetcode/easy/1729.%20Find%20Followers%20Count.sql)
5455
- [1741. Find Total Time Spent by Each Employee](./leetcode/easy/1741.%20Find%20Total%20Time%20Spent%20by%20Each%20Employee.sql)
5556
2. [Medium](./leetcode/medium/)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Question 1693. Daily Leads and Partners
3+
Link: https://leetcode.com/problems/daily-leads-and-partners/description/
4+
5+
Table: DailySales
6+
7+
+-------------+---------+
8+
| Column Name | Type |
9+
+-------------+---------+
10+
| date_id | date |
11+
| make_name | varchar |
12+
| lead_id | int |
13+
| partner_id | int |
14+
+-------------+---------+
15+
There is no primary key (column with unique values) for this table. It may contain duplicates.
16+
This table contains the date and the name of the product sold and the IDs of the lead and partner it was sold to.
17+
The name consists of only lowercase English letters.
18+
19+
20+
For each date_id and make_name, find the number of distinct lead_id's and distinct partner_id's.
21+
22+
Return the result table in any order.
23+
*/
24+
25+
SELECT
26+
date_id,
27+
make_name,
28+
COUNT(DISTINCT lead_id) AS unique_leads,
29+
COUNT(DISTINCT partner_id) AS unique_partners
30+
FROM DailySales
31+
GROUP BY date_id, make_name

0 commit comments

Comments
 (0)