当前位置:网站首页>用”软删除“来删除数据库中的数据
用”软删除“来删除数据库中的数据
2020-11-10 11:27:00 【osc_ct0tt1cu】
一.软删除(逻辑删除):(Soft Deleting),即在删除数据表中的数据时,并不直接将其从数据表中删除,而是将其标志为删除,即在每张表中设置一个删除字段(如:IsDeleted)等,默认情况下其值为0,及未删除状态;当需要将数据删除时,则将此字段更新为1。
在现实中,我们所说的删除并不是真正的做删除,往往我们在数据库中删除掉一些数据后,想要恢复就会很难,这样的话用到软删除再次查看就会方便很多。
例如:
- 公司“解雇”了一名员工,而不是删除了员工;
- 公司“取消”了订单,而不是删除了订单;
- 公司“停用”了一台设备,而不是删除了一台设备;
在这里我们就会用解雇,取消,停用来代替“删除”;
当想要再次查看数据状态时,只要将IsDeleted的值改为0即可。
二.硬删除(物理删除):在数据库中真的删除数据,数据消失。
版权声明
本文为[osc_ct0tt1cu]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4413947/blog/4710868
边栏推荐
- 抖音Api:视频评论列表
- What can I do if I can't register didi? How to deal with it?
- PAT_甲级_1032 Sharing
- Production practice | Flink + live broadcast (1) | requirements and architecture
- What should be paid attention to when designing API to get data through post
- Android网络性能监控方案
- iOS14新特性-WidgetKit开发与实践
- 自定义注解!绝对是程序员装逼的利器!!
- python math类
- 一不小心画了 24 张图剖析计网应用层协议!
猜你喜欢
如何看待阿里云成立新零售事业部?
Notes on Python cookbook 3rd (2.4): string matching and searching
[technical course] peerconnection in webrtc self built by visual studio 2017_ The client program reported an external symbol error that LNK2019 could not resolve
How does hystrix solve ThreadLocal information loss
Swoole 如何使用 Xdebug 进行单步调试
世界上最伟大的10个公式,其中一个人尽皆知
leetcode1-两数之和
双十一秒杀系统这你抢得过吗?
[Senior Test Engineer] three sets of 18K automated test interviews (Netease, byte jump, meituan)
中央重点布局:未来 5 年,科技自立自强为先,这些行业被点名
随机推荐
刷题到底有什么用?你这么刷题还真没用
ASP.NET Core框架揭秘[博文汇总
如何看待阿里云成立新零售事业部?
Key layout of the Central Government: in the next five years, self-reliance and self-improvement of science and technology will be the priority, and these industries will be named
Summary of basic concepts and common operations of elasticsearch cluster (recommended Collection)
微服务授权应该怎么做?
奸商加价销售mate40,小米可望在高端手机市场夺取更多市场
从大专生到蚂蚁金服CTO,他写下“支付宝”第一行代码:逆风的方向,更适合飞翔!...
C++ STL容器篇
python pip命令的使用
Do not understand the code, can type can build a station? 1111 yuan gift bag to help you with one stop!
C language uses random number to generate matrix to realize fast transposition of triples.
类加载过程
One task is not enough, but another valuetask. I'm really confused!
jsliang 求职系列 - 09 - 手写浅拷贝和深拷贝
What does the mremote variable in servicemanagerproxy refer to?
Book City Project: phase 1
Bartender2021 realizes secure remote label printing, new year-end release
PAT_甲级_1032 Sharing
Leetcode 5561. Get the maximum value in the generated array