mysql怎样逻辑删除

409次阅读
没有评论

mysql怎样逻辑删除

具体方法:

(推荐教程:mysql数据库学习教程)

物理删除

delete from 表名 where 条件     ---》 delete from class where id = 1;

逻辑删除

用一个字段来表示 这条信息是否已经不能再使用了;

(1)给students表添加一个 is_delete 字段 bit 类型  默认为0 

alter table students add is_delete bit default 0;

(2)is_delete = 1  逻辑删除

update students set is_delete=1 where id=6;

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:Python教程2022-10-19发表,共计269字。
新手QQ群:570568346,欢迎进群讨论 Python51学习