必须会的SQL语句(四) 数据删除和更新
作者:mdxy-dxy 时间:2024-01-29 02:11:51
1.删除
1)删除记录
Delete from 表名 where id ='xx'
2)删除所有数据,并回归初始化标识字段。
Truncate table 表名
3)delete与truncate区别
a. truncate是能使种子回到初始值
b. truncate不能加条件
c. truncate不能涉及触发器
d. truncate性能要比delete高得多
2.更新
1)基础的update
update 表名
set [列名]='值'
where [列名] ='值'
2)和replace一起使用
--19岁以上名字中的'星'特换成'★'。
update 表名
set name = replace(name,'星','★')
where age > 19
标签:删除,更新
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python GUI库图形界面开发之PyQt5布局控件QVBoxLayout详细使用方法与实例
2022-10-12 11:37:27
![](https://img.aspxhome.com/file/2023/5/86595_0s.png)
Golang使用Gin框架实现HTTP上传文件过程介绍
2024-04-28 09:18:12
![](https://img.aspxhome.com/file/2023/1/134001_0s.png)
Python实现设置windows桌面壁纸代码分享
2022-03-23 03:52:46
判定IE的各个版本
2010-01-19 14:01:00
css网页下拉菜单制作方法(4):定位问题
2007-02-03 11:39:00
python集合用法实例分析
2021-10-26 23:36:37
Python的log日志功能及设置方法
2022-03-28 22:13:32
php根据isbn书号查询amazon网站上的图书信息的示例
2023-11-15 03:08:53
MySQL忘记密码恢复密码的实现方法
2024-01-19 08:55:14
![](https://img.aspxhome.com/file/2023/7/76367_0s.jpg)
mysql报错:MySQL server version for the right syntax to use near type=InnoDB的解决方法
2024-01-20 19:17:17
彻底理解Python list切片原理
2023-10-19 03:34:43
Python实现我的世界小游戏源代码
2023-07-26 02:09:08
![](https://img.aspxhome.com/file/2023/4/60704_0s.jpg)
Python轻松管理与操作文件的技巧分享
2021-11-19 14:42:12
强悍的Python读取大文件的解决方案
2021-12-26 19:25:28
python实现dict版图遍历示例
2023-11-01 11:43:41
python实现通过队列完成进程间的多任务功能示例
2022-06-25 03:49:27
![](https://img.aspxhome.com/file/2023/9/95589_0s.png)
Dreamweaver处理word文档有妙招
2008-05-23 13:00:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113546322s.jpg)
js的flv视频播放器插件使用方法
2024-04-27 15:18:17
Python 平方列表中每个数字的多种操作
2023-11-14 03:53:00
![](https://img.aspxhome.com/file/2023/8/64618_0s.jpg)
MySQL中的唯一性约束与NULL详解
2024-01-13 10:24:10
![](https://img.aspxhome.com/file/2023/7/121297_0s.jpg)