我使用Google Apps Script
从Google Cloud SQL
更新MySQL表格,我不想插入重复值,例如:
如果我有下表和记录
+----+--------+-----------+-------+
| id | name | address | phone |
+----+--------+-----------+-------+
| 1 | John | Somewhere | 022 |
+----+--------+-----------+-------+
| 2 | Snow | North | 023 |
+----+--------+-----------+-------+
然后我不能执行插入新记录
的查询name=John,
address=Somewhere,
phone=022
或
name=Snow,
address=North,
phone=023
这是我当前的代码,它将新记录插入数据库:
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();