17,090
社区成员
发帖
与我相关
我的任务
分享
-- 1楼说的这种情况应该不存在:
scott@TBWORA> delete emp where not exists (select 1 from dept where dept.dname='LUOYOUMOU' and dept.deptno=emp.deptno);
已删除5行。
scott@TBWORA> rollback;
回退已完成。
scott@TBWORA> delete from emp where not exists (select 1 from dept where dept.dname='LUOYOUMOU' and dept.deptno=emp.deptno);
已删除5行。
scott@TBWORA> rollback;
回退已完成。
scott@TBWORA> delete emp where not exists (select 1 from dept where dept.dname='RESEARCH' and dept.deptno=emp.deptno);
已删除0行。
scott@TBWORA> delete from emp where not exists (select 1 from dept where dept.dname='RESEARCH' and dept.deptno=emp.deptno);
已删除0行。
-- 一般习惯用 delete from ,这样写更让人容易理解!
-- 当然:没有区别!
sys@TBWORA> conn scott/bee56915
已连接。
scott@TBWORA> delete emp;
已删除5行。
scott@TBWORA> delete from emp;
已删除0行。
scott@TBWORA> delete emp2;
已删除0行。
scott@TBWORA> delete from emp2;
已删除0行。
scott@TBWORA> delete emp2 where deptno=30;
已删除0行。