Home  >  Article  >  Database  >  How to modify content in mysql

How to modify content in mysql

WBOY
WBOYOriginal
2022-01-20 14:44:2417373browse

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”.

How to modify content in mysql

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:

How to modify content in mysql

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn