Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
mysql中关于删除语句大全总结(下)_创想鸟

mysql中关于删除语句大全总结(下)

4.update set 语句mysql最常用的修改和更新语句,它更新信息时也会覆盖(删除)旧的信息。

A  update set 与where搭配使用,变更某些记录:

update +表名 +set+ 变更后的信息 +where子句;

例如:

update stu set birth=1988,department='中文系' where id=9    and name='张三';

注意:如果变更信息后面没有加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, 5 rows affected (0.13 sec)Rows matched: 5  Changed: 5  Warnings: 0mysql> select * from c1score;+-------+------+| score | s    |+-------+------+|    64 |    1 ||    87 |    2 ||    99 |    3 ||    54 |    5 ||    43 |    6 |+-------+------+                                                                                                    5 rows in set (0.00 sec)

   

BibiGPT-哔哔终结者 BibiGPT-哔哔终结者

B站视频总结器-一键总结 音视频内容

BibiGPT-哔哔终结者 28 查看详情 BibiGPT-哔哔终结者

5用alter语句来删除字段:

A   alter table 表名 drop 字段名;

mysql> alter table c1score drop s;Query OK, 0 rows affected (1.80 sec)Records: 0  Duplicates: 0  Warnings: 0mysql> select * from c1score;+-------+| score |+-------+|    64 ||    87 ||    99 ||    54 ||    43 |+-------+5 rows in set (0.00 sec)

B   用alter来删除索引:

mysql> drop index idx_4a on 4a;    Query OK, 0 rows affected (0.41 sec)    Records: 0  Duplicates: 0  Warnings: 0

C  用alter来删除主键:

mysql> alter table sc3 drop primary key;Query OK, 17 rows affected (1.00 sec)Records: 17  Duplicates: 0  Warnings: 0

D 用alter来删除,更新表名:

mysql> alter table sc3 rename to gyssc;Query OK, 0 rows affected (0.30 sec)mysql> select * from sc3;ERROR 1146 (42S02): Table 'trains.sc3' doesn't exist

以上就是mysql中关于删除语句大全总结(下)的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/392612.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
辽宁省融创御潮府×TCL家庭中央空调,打造绿色节能品质生活圈
上一篇 2025年11月6日 16:20:11
oppo手机彩屏怎么回事 oppo手机屏幕异常解决方法
下一篇 2025年11月6日 16:20:25

相关推荐

发表回复

登录后才能评论
关注微信