1、删除特定的数据记录
DELETE FROM tb_student
WHERE studentName = '黄涛';
删除前:
删除后:
2、带子查询的删除
DELETE FROM tb_student
WHERE studentNo = (SELECT studentNo FROM tb_student_copy WHERE studentName = '孙新');
删除前:
删除后:
3、删除所有数据记录
完成前两步后的表格:
删除:
DELETE FROM tb_student;
结果:
另一种语句:
TRUNCATE tb_student;
这个语句只能删除整张表,不能添加where语句。