CREATE PROCEDURE movieDirectors() BEGIN SELECT director FROM (SELECT director, SUM(oscars) AS n_oscars FROM moviesInfo WHERE year > 2000 AND oscars > 0 GROUP BY director) x WHERE x.n_oscars > 2; END