Skip to content

Commit 52d4439

Browse files
committed
task: #1050
1 parent 7516dee commit 52d4439

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
120120
- [619. Biggest Single Number](./leetcode/easy/619.%20Biggest%20Single%20Number.sql)
121121
- [620. Not Boring Movies](./leetcode/easy/620.%20Not%20Boring%20Movies.sql)
122122
- [627. Swap Salary](./leetcode/easy/627.%20Swap%20Salary.sql)
123+
- [1050. Actors and Directors Who Cooperated At Least Three Times](./leetcode/easy/1050.%20Actors%20and%20Directors%20Who%20Cooperated%20At%20Least%20Three%20Times.sql)
123124
- [1068. Product Sales Analysis I](./leetcode/easy/1068.%20Product%20Sales%20Analysis%20I.sql)
124125
- [1075. Project Employees I](./leetcode/easy/1075.%20Project%20Employees%20I.sql)
125126
- [1141. User Activity for the Past 30 Days I](./leetcode/easy/1141.%20User%20Activity%20for%20the%20Past%2030%20Days%20I.sql)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Question 1050. Actors and Directors Who Cooperated At Least Three Times
3+
Link: https://leetcode.com/problems/actors-and-directors-who-cooperated-at-least-three-times/description/?envType=problem-list-v2&envId=database
4+
5+
Table: ActorDirector
6+
7+
+-------------+---------+
8+
| Column Name | Type |
9+
+-------------+---------+
10+
| actor_id | int |
11+
| director_id | int |
12+
| timestamp | int |
13+
+-------------+---------+
14+
timestamp is the primary key (column with unique values) for this table.
15+
16+
17+
Write a solution to find all the pairs (actor_id, director_id) where the actor has cooperated with the director at least three times.
18+
19+
Return the result table in any order.
20+
*/
21+
22+
SELECT
23+
actor_id,
24+
director_id
25+
FROM ActorDirector
26+
GROUP BY (actor_id, director_id)
27+
HAVING COUNT(1) >= 3

0 commit comments

Comments
 (0)