mysql update set values
The UPDATE statement in MySQL is used to modify the data in a table. The SET keyword is used to set new values for one or more columns in the table.
The syntax for updating data in MySQL using the SET keyword is as follows:
UPDATE table_name
SET column1=value1, column2=value2, ...
WHERE condition;
Here, table_name is the name of the table you want to update. The SET keyword is followed by a comma-separated list of column=value pairs, where column is the name of the column you want to update, and value is the new value you want to set.
The WHERE clause is optional, but it's recommended to use it to specify the condition that determines which rows should be updated. If you omit the WHERE clause, all rows in the table will be updated with the new values.
Here's an example that shows how to update the name and age of a person with ID 1 in a table called "people":
UPDATE people
SET name='John Doe', age=35
WHERE id=1;
This statement will update the name and age of the person with ID 1 to "John Doe" and 35, respectively. If there are multiple people in the table with the same name, the WHERE clause ensures that only the person with ID 1 is updated
原文地址: https://www.cveoy.top/t/topic/eOtG 著作权归作者所有。请勿转载和采集!