将INSERT INTO转换为UPDATE [复制]

This question already has an answer here:

Imagine I have some code like this:

$sql = "INSERT INTO tablename (column1, column2, column3) VALUES 
('1','2','3')"; 

How would I convert this into an UPDATE query? I did some searching, but

UPDATE table_name 
SET column1=value1,column2=value2,... 
WHERE some_column=some_value;

doesn't make much sense to me. Thanks

</div>

INSERT and UPDATE queries look similar but they do different things.

Inserts => Inserts new nonexisting data into table

Update => Updates existing data inside of the table

That is why the UPDATE query has WHERE clause

So, you can use UPDATE to modify a row which is already inserted.

I don't know what exactly you are asking, because you are not clear in your question. But according to my thinking you want to know the difference.

Update query edit or update the data in the database. Like this

update table_name
set 'name'=something
where 'id'='some_id'

for more examples and practice go HERE

Insert insert query is just making a new data entry in the database in a table with a unique id, precisely.

HERE is the link for insert example.