File tree 1 file changed +0
-39
lines changed
1 file changed +0
-39
lines changed Original file line number Diff line number Diff line change 1
- -- 1050. Actors and Directors Who Cooperated At Least Three Times
2
- --
3
- -- Table: ActorDirector
4
- --
5
- -- +-------------+---------+
6
- -- | Column Name | Type |
7
- -- +-------------+---------+
8
- -- | actor_id | int |
9
- -- | director_id | int |
10
- -- | timestamp | int |
11
- -- +-------------+---------+
12
- -- timestamp is the primary key column for this table.
13
- --
14
- --
15
- -- Write a SQL query for a report that provides the pairs (actor_id, director_id) where the actor have cooperated with the director at least 3 times.
16
- --
17
- -- Example:
18
- --
19
- -- ActorDirector table:
20
- -- +-------------+-------------+-------------+
21
- -- | actor_id | director_id | timestamp |
22
- -- +-------------+-------------+-------------+
23
- -- | 1 | 1 | 0 |
24
- -- | 1 | 1 | 1 |
25
- -- | 1 | 1 | 2 |
26
- -- | 1 | 2 | 3 |
27
- -- | 1 | 2 | 4 |
28
- -- | 2 | 1 | 5 |
29
- -- | 2 | 1 | 6 |
30
- -- +-------------+-------------+-------------+
31
- --
32
- -- Result table:
33
- -- +-------------+-------------+
34
- -- | actor_id | director_id |
35
- -- +-------------+-------------+
36
- -- | 1 | 1 |
37
- -- +-------------+-------------+
38
- -- The only pair is (1, 1) where they cooperated exactly 3 times.
39
-
40
1
-- # Write your MySQL query statement below
41
2
select actor_id, director_id from ActorDirector
42
3
group by actor_id, director_id
You can’t perform that action at this time.
0 commit comments