In mysql, you can use the UPDATE command to modify the content. This command is used to modify or update data in MySQL. You can use this command to modify one or more contents at the same time. The syntax is "UPDATE table name SET field1= new-value1,field2=new-value2”.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to modify the content of mysql
If we need to modify or update the data in MySQL, we can use the SQL UPDATE command to operate.
Syntax
The following is the general SQL syntax for the UPDATE command to modify MySQL data table data:
UPDATE table_name SET field1=new-value1, field2=new-value2 [WHERE Clause]
You can update one or more fields at the same time.
You can specify any condition in the WHERE clause.
You can update data simultaneously in a single table.
The WHERE clause is very useful when you need to update data in a specified row in a data table.
Update data through the command prompt
Below we will use the WHERE clause in the SQL UPDATE command to update the data specified in the runoob_tbl table:
Example
The following example will update the runoob_title field value with runoob_id 3 in the data table:
From the results, the runoob_title with runoob_id 3 has been modified.
Recommended learning: mysql video tutorial
The above is the detailed content of How to modify content in mysql. For more information, please follow other related articles on the PHP Chinese website!