title: Replace NOT IN with LEFT JOIN in SQL statement
body: <p>I wrote two queries which are working fine, but they are really really slow: </p>
  
  <pre><code>SELECT director
  FROM movies
  WHERE id NOT IN (SELECT movie_id FROM stars_in_movies WHERER star_id = %s);
  
  SELECT first_name, last_name
  FROM stars
  WHERE id NOT IN (SELECT star_id
                   FROM stars_in_movies
                   WHERE movie_id IN(SELECT movie_id
                                     FROM stars_in_movies
                                     WHERE star_id = %s))
  </code></pre>
  
  <p>I tried to replace <code>NOT IN</code> with <code>INNER JOIN</code> and <code>LEFT JOIN</code> but nothing I have tried worked so far.</p>
  
  <p>Following is schema for the tables: </p>
  
  <p><strong>movies</strong>:</p>
  
  <pre><code> - id (primary key),
   - title (title of the movie), 
   - year (year of release)
   - director (director of the movie)
  </code></pre>
  
  <p><strong>stars</strong>:</p>
  
  <pre><code> - id (primary key)
   - first_name
   - last_name
  </code></pre>
  
  <p><strong>stars_in_movies</strong>: </p>
  
  <pre><code> - movie_id, 
   - star_id (movie_id and star_id both are foreign keys here)
  </code></pre>
  
  <p>Thank you in advance.</p>