mysql更新,修改语句汇总--update set,alter
update set 语句是mysql最常用的修改和更新语句。
A update set 与where搭配使用,变更某些记录: update +表名 +set+ 变更后的信息 +where子句; 例如:
注意:如果变更信息后面没有加where子句指定其变更的内容,那么update set语句就会把同字段中的所有信息全部更新,修改。 |
例如:
mysql> select * from c1score;
+———-+———+
| score | s |
+———-+———+
| 56 | 1 |
| 79 | 2 |
| 91 | 3 |
| 46 | 5 |
| 35 | 6 |
+———-+———+
5 rows in set (0.08 sec)
mysql> update c1score set score=score+8;
Query OK
还没有评论,来说两句吧...