Skip to content

Commit 7c186de

Browse files
refactor 1050
1 parent 9e89551 commit 7c186de

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

database/_1050.sql

-39
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
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-
401
--# Write your MySQL query statement below
412
select actor_id, director_id from ActorDirector
423
group by actor_id, director_id

0 commit comments

Comments
 (0)