title: How to prevent SQL insert when certain row already exists?
body: <p>I have a database with different movies, actors, directors. </p>
  
  <p>To connect a director with a movie I'm using a table in which I have the following: </p>
  
  <p><strong>film_id</strong> and <strong>director_id</strong> - so when I add a director for the movie the necessary id's get inserted to this table. </p>
  
  <p>So I have a bunch of id's already there and it works just fine. For example: </p>
  
  <pre><code>movie_id - director_id
  10         15
  11         17 
  9          13
  </code></pre>
  
  <p>Now when I add another director with let's say an <strong>id 9</strong> to a movie with an <strong>id 13</strong> then I have two rows that are exactly the same and that's what I don't want to happen. Shown below: </p>
  
  <pre><code>movie_id - director_id
  10         15
  11         17 
  9          13
  9          13 
  </code></pre>
  
  <p>Instead it should not insert when there already is a row with the same <strong>film_id</strong> equal to the same <strong>director_id</strong>. </p>
  
  <p>How can I prevent this from happening? </p>