Home  >  Article  >  Database  >  What is the command to update records in sql

What is the command to update records in sql

王林
王林Original
2020-07-14 11:13:379447browse

The sql command to update records is UPDATE. The UPDATE command is used to modify or update data in mysql. This command can update one or more fields at the same time, and can also specify any conditions in the WHERE clause.

What is the command to update records in sql

#sql command to update records is UPDATE.

(Recommended learning: mysql tutorial)

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.

Example:

mysql> UPDATE tbl SET title='学习 C++' WHERE id=3;
Query OK, 1 rows affected (0.01 sec)

The above is the detailed content of What is the command to update records in sql. 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