且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在数据库中添加值

更新时间:2023-12-01 10:01:22

这是正确的,'insert'查询将始终创建表格中的新行。如果你想保留一个特定的行,那就是'更新',但你必须在'WHERE'子句中指定要更新的行,如下所示:

That is correct, 'insert' query will always create a new row in the table. If you want to keep to a particular row, that is 'update', but you have to specify which row to update in the 'WHERE' clause like this:
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;



了解详情: sql_update [ ^ ]


你可以使用 SQL:如果存在更新其他插入 [ ^ ]。



如果日期上存在任何记录,则更新,否则插入记录。
You can use SQL: If Exists Update Else Insert[^].

If any record exists on the Date, then Update it, otherwise Insert the record.


如果你有所有字段信息,你可以尝试使用这个sql语句

You can try using this sql sentence if you have all fields information
INSERT OR REPLACE INTO [table] (field1, field2,...) VALUES (value1, value2,...);



自动sql server选择正确的句子


to automatically sql server choose the correct sentence