Easy solution with HAVING COUNT(a =b)
SELECT actor_id, director_id\nFROM ActorDirector\nGROUP BY actor_id, director_id\nHAVING COUNT(actor_id = director_id) >= 3;
SELECT actor_id, director_id\nFROM ActorDirector\nGROUP BY actor_id, director_id\nHAVING COUNT(actor_id = director_id) >= 3;
[]