MySQL Basic Learning_Lesson 014_Modify and Update the Data in the Table

Modify the data in the update table

Syntax format:

UPDATE 表名 SET 字段名1 = 值1, 字段名2 = 值2, ... WHERE条件;

Note: If there is no where condition is restricted, the entire table data will be updated

Example 1: Change the name of Zhang San in the following t_testtable_002 table to week eight, and the classno of clsss001 to class 1.

update t_testtable_002 set name = '周八',classno = '1班' where name = '张三' and classno ='class001';

Example 2: Remove the where restriction in Example 1

Without the where condition, the corresponding data of the entire table is all updated

update t_testtable_002 set name = '周八',classno = '1班' ;

Guess you like

Origin blog.csdn.net/weixin_43184774/article/details/115176684