title: How to insert only distinct values to a MySQL table?
body: <p>I'm using <code>Google Apps Script</code> to update a MySQL table from <code>Google Cloud SQL</code> and I don't want to insert duplicate values, for example:</p>
  
  <p>If I have the following table with a record </p>
  
  <pre><code>+----+--------+-----------+-------+
  | id | name   | address   | phone |
  +----+--------+-----------+-------+
  |  1 | John   | Somewhere | 022   |
  +----+--------+-----------+-------+
  |  2 | Snow   | North     | 023   |
  +----+--------+-----------+-------+
  </code></pre>
  
  <p>Then I should not be able to execute a query that inserts a new record where </p>
  
  <pre><code>name=John, 
  address=Somewhere,
  phone=022
  </code></pre>
  
  <p>or </p>
  
  <pre><code>name=Snow,
  address=North,
  phone=023
  </code></pre>
  
  <p>This is my current code that inserts new records to the database:</p>
  
  <pre><code>  var stmt = conn.prepareStatement('INSERT INTO entries '
        + '(name, address, phone) values (?, ?, ?)');
  
    stmt.setString(1, "John");
    stmt.setString(2, "Snow");
    stmt.setString(3, 022);
    stmt.execute();
  </code></pre>