删除数据
语法
delete from 表名 where 条件
删除所有数据
delete from tb_user;
根据条件删除
例:
删除学号为1的学生数据
delete from tb_user where id =1;
truncate删除
truncate table tb_user;
truncate与delete删除的区别
delete:一行一行的把数据删除
truncate:先删除表(drop),重新创建(create)表
2023-02-15 08:15:27
语法
delete from 表名 where 条件
delete from tb_user;
例:
删除学号为1的学生数据
delete from tb_user where id =1;
truncate table tb_user;
delete:一行一行的把数据删除
truncate:先删除表(drop),重新创建(create)表