当前位置:网站首页>用”软删除“来删除数据库中的数据
用”软删除“来删除数据库中的数据
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
边栏推荐
- Notes on Python cookbook 3rd (2.3): matching strings with shell wildcards
- nodejs 个人学习笔记(imook)pm2
- idea提交SVN忽略文件设置
- 一个 Task 不够,又来一个 ValueTask ,真的学懵了!
- Book City Project: phase 1
- 低至 2 折的云数据库,你见过?
- [C.NET] 11: the most basic thread knowledge
- 不用懂代码,会打字就可以建站?1111 元礼包帮你一站配齐!
- Do not understand the code, can type can build a station? 1111 yuan gift bag to help you with one stop!
- 带劲!饿了么软件测试python自动化岗位核心面试题出炉,你全程下来会几个?
猜你喜欢
STATISTICS STATS 380
ASP.NET Core framework revealed
I have a crossed translation tool in my hand!
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
MFC界面开发帮助文档——BCG如何在工具栏上放置控件
Mcp4725 driver based on FPGA
How to better understand middleware and onion model
The high pass snapdragon 875 has won the title of Android processor, but the external 5g baseband has become its disadvantage
How to use Xdebug for single step debugging
Centos7 Rsync + crontab scheduled backup
随机推荐
Mcp4725 driver based on FPGA
[operation tutorial] introduction and opening steps of easygbs subscription function of national standard gb28181 protocol security video platform
【CCPC】2020CCPC长春 F - Strange Memory | 树上启发式合并(dsu on a tree)、主席树
C + + STL container
STATISTICS STATS 380
《Python Cookbook 3rd》笔记(2.4):字符串匹配和搜索
[CCPC] 2020ccpc Changchun F - band memory | tree heuristic merge (DSU on a tree), chairman tree
抖音Api:视频评论列表
gnu汇编-基本数学方程-乘法
C语言使用随机数生成矩阵,实现三元组的快速转置。
Exploration and practice of Tencent cloud tbase in the field of distributed HTAP
C language uses random number to generate matrix to realize fast transposition of triples.
Production practice | Flink + live broadcast (1) | requirements and architecture
腾讯云TBase在分布式HTAP领域的探索与实践
子线程调用invalidate()产生“Only the original thread that created a view hierarchy can touch its views.”原因分析
One of the 10 Greatest formulas in the world is well known
ASP.NET Core框架揭秘[博文汇总
Farfetch、阿里巴巴集团和历峰集团结成全球合作伙伴关系,将加速奢侈品行业数字化进程
Centos7 rsync+crontab 定时备份
【iOS】苹果登录Sign in with Apple