+-------------+---------+
|Column Name |Type|+-------------+---------+
| actor_id | int || director_id | int ||timestamp| int |+-------------+---------+
timestampis the primarykeycolumnfor this table.
Write a SQL query for a report that provides the pairs (actor_id, director_id) where the actor has cooperated with the director at least three times.
WITH WorkRank AS (
SELECT actor_id,director_id
,ROW_NUMBER()OVER(PARTITION BY actor_id,director_id ORDERBYtimestamp) AS RN
FROM ActorDirector
)
SELECTDISTINCT actor_id,director_id
FROM WorkRank WHERE RN >=3