删除特定行

DELETE FROM table_name WHERE condition;

删除所有行

DELETE FROM table_name;

确认删除

SELECT * FROM table_name WHERE condition;

示例

  • 删除DEPARTMENT表中DEVELOPMENT部门

DELETE FROM department WHERE dname = 'DEVELOPMENT';

  • 删除EMP表中入职时间晚于1997年1月1日的员工

DELETE FROM emp WHERE hiredate > TO_DATE('01.1997', 'DD.MM.YYYY');

注意:

省略WHERE子句会删除表中所有行。