首页 > 其他 > 详细

19.修改表中数据

时间:2020-03-21 17:08:43      阅读:49      评论:0      收藏:0      [点我收藏+]

19.1 修改表中指定条件固定列的数据

1、命令语法:update <表名> set <字段>=<新值>,..... where <条件> (一定要注意条件)

2、修改指定的行字段内容
查看要修改的表

mysql> use oldboy;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from test where id=4; 把 id 号为 4,name=zhangxuan 的更改为 name=pengchun
+----+------+-----------+-------------+
| id | age | name | shouji |
+----+------+-----------+-------------+
| 4 | 24 | zhangxuan | 13511111111 |
+----+------+-----------+-------------+
1 row in set (0.00 sec)
mysql> update test set name=pengchun where id=4;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from test where id=4;
+----+------+----------+-------------+
| id | age | name | shouji |
+----+------+----------+-------------+
| 4 | 24 | pengchun | 13511111111 |
+----+------+----------+-------------+
1 row in set (0.00 sec)?

 

19.修改表中数据

原文:https://www.cnblogs.com/hackerlin/p/12539898.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!