虽然我(目前)使用 mySQL,但我不需要任何数据库特定的 SQL。
我试图插入一条记录(如果不存在),并更新一个字段(如果存在)。我想使用 ANSI SQL。
该表看起来像这样:
create table test_table (id int, name varchar(16), weight double) ;
//test data
insert into test_table (id, name, weight) values(1,'homer', 900);
insert into test_table (id, name, weight) values(2,'marge', 85);
insert into test_table (id, name, weight) values(3,'bart', 25);
insert into test_table (id, name, weight) values(4,'lisa', 15);
If the record exists, I want to update the weight (increase by say 10)