🤔 문제 분석
1) Write an SQL query that will, for each user, return the number of followers.
2) Return the result table ordered by user_id in ascending order.
💡 풀이
SELECT date_id, make_name,
COUNT(DISTINCT lead_id) AS unique_leads,
COUNT(DISTINCT partner_id) AS unique_partners
FROM DailySales
GROUP BY date_id, make_name
'코딩테스트 > 리트코드 SQL' 카테고리의 다른 글
[리트코드/SQL] 24. Game Play Analysis I (511) (0) | 2022.12.18 |
---|---|
[리트코드/SQL] 23. Customer Placing the Largest Number of Orders (586) (0) | 2022.12.18 |
[리트코드/SQL] 21. Daily Leads and Partners (1693) (0) | 2022.12.18 |
[리트코드/SQL] 20. User Activity for the Past 30 Days I (1141) (0) | 2022.12.18 |
[리트코드/SQL] 19. Sales Person (607) (0) | 2022.12.18 |
댓글