【原理】对于任何sql语句,当满足 where 条件的数据不存在时,就会返回0
1、select()
满足该 where 条件的数据不存在,结果返回0
2、update()
满足该 where 条件的数据不存在,无法修改,结果返回为0
【update操作的本质是,update ... where in (Condition),先查询后修改】
3、delete()
满足该 where 条件的数据不存在,无法删除,结果返回为0
【delete操作的本质是,delete ... where in (Conditon),先查询后删除】
4、insert()
只有使用 insert ignore 情况下,插入一条已经存在的数据,返回为0
【insert ignore的本质就是 ,insert ... where not in(Condition),先查询后插入】
5、总结:
CRUD 操作返回0的原因是查询失败,直接放弃操作,影响行数为 0