I'm using Google Apps Script
to update a MySQL table from Google Cloud SQL
and I don't want to insert duplicate values, for example:
If I have the following table with a record
+----+--------+-----------+-------+
| id | name | address | phone |
+----+--------+-----------+-------+
| 1 | John | Somewhere | 022 |
+----+--------+-----------+-------+
| 2 | Snow | North | 023 |
+----+--------+-----------+-------+
Then I should not be able to execute a query that inserts a new record where
name=John,
address=Somewhere,
phone=022
or
name=Snow,
address=North,
phone=023
This is my current code that inserts new records to the database:
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();