SQL update statements modify the database field

1, for example, modify the data in Table t_email email field yahoo.cn modify 163.com

Query execution as follows:

UPDATE `t_email` t

SET t.`email` = REPLACE(t.`email`, 'yahoo.cn', '163.com');

2, to update runoob_id 3 runoob_title field value of "C ++" is replaced with "Python":

UPDATE runoob_tbl SET runoob_title = REPLACE(runoob_title, 'C++', 'Python') where runoob_id = 3;

 

 3, the data path field to modify database tables sample_hvr2_5M_ping hvr the "/ home2 / HVR / hvr2_5M '" value to' / home1 / hvr2 / hvr_v2_6_5M '

UPDATE sample_hvr2_5M_ping

SET path = REPLACE(path, '/home2/HVR/hvr2_5M', '/home1/hvr2/hvr_v2_6_5M');

 

4, the WHERE clause in SQL UPDATE command to update runoob_tbl data specified in the table:

The following examples will update the data table runoob_id runoob_title field value is 3:

mysql> UPDATE runoob_tbl SET runoob_title='学习 C++' WHERE runoob_id=3;

1, for example, modify the data in Table t_email email field yahoo.cn modify 163.com

Query execution as follows:

UPDATE `t_email` t

SET t.`email` = REPLACE(t.`email`, 'yahoo.cn', '163.com');

2, to update runoob_id 3 runoob_title field value of "C ++" is replaced with "Python":

UPDATE runoob_tbl SET runoob_title = REPLACE(runoob_title, 'C++', 'Python') where runoob_id = 3;

 

 3, the data path field to modify database tables sample_hvr2_5M_ping hvr the "/ home2 / HVR / hvr2_5M '" value to' / home1 / hvr2 / hvr_v2_6_5M '

UPDATE sample_hvr2_5M_ping

SET path = REPLACE(path, '/home2/HVR/hvr2_5M', '/home1/hvr2/hvr_v2_6_5M');

 

4, the WHERE clause in SQL UPDATE command to update runoob_tbl data specified in the table:

The following examples will update the data table runoob_id runoob_title field value is 3:

mysql> UPDATE runoob_tbl SET runoob_title='学习 C++' WHERE runoob_id=3;

Guess you like

Origin www.cnblogs.com/carey9420/p/11983504.html