MySQL:Update Data in Table
在MySQL中,用SQL更新数据表中的数据的语法和Oracle是有区别的,具体如下:
update [table_name]set [col_name]=[new_data] where [col_identified]=[search_string,Used for identified.];
Eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
mysql> select * from wp_options where option_name='siteurl'; +-----------+-------------+------------------------+----------+ | option_id | option_name | option_value | autoload | +-----------+-------------+------------------------+----------+ | 1 | siteurl | http://d-prototype.com | yes | +-----------+-------------+------------------------+----------+ 1 row in set (0.00 sec) mysql> update wp_options set option_value='http://168.0.1.190/dprototype' where option_name='siteurl'; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from wp_options where option_name='siteurl'; +-----------+-------------+-------------------------------+----------+ | option_id | option_name | option_value | autoload | +-----------+-------------+-------------------------------+----------+ | 1 | siteurl | http://168.0.1.190/dprototype | yes | +-----------+-------------+-------------------------------+----------+ 1 row in set (0.00 sec) mysql> |
——————————————————————————————————————
Done。