原来的mytable表如下:
mysql> select * from mytable;
+----+--------+------+--------------+---------+
| id | name | sex | info | address |
+----+--------+------+--------------+---------+
| 1 | 张三 | 男 | NULL | NULL |
| 2 | 李四 | 女 | NULL | NULL |
| 3 | 赵六 | 男 | 乐于助人 | NULL |
+----+--------+------+--------------+---------+
3 rows in set (0.00 sec)
现在要把id= 1的address 值改为 学府花园,代码如下:
mysql> update mytable set address = '丰镇市学府花园' where id =1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> select * from mytable;
+----+--------+------+--------------+-----------------------+
| id | name | sex | info | address |
+----+--------+------+--------------+-----------------------+
| 1 | 张三 | 男 | NULL | 丰镇市学府花园 |
| 2 | 李四 | 女 | NULL | NULL |
| 3 | 赵六 | 男 | 乐于助人 | NULL |
+----+--------+------+--------------+-----------------------+
3 rows in set (0.00 sec)