例子1: from table2 b where a.id=b.id) 例子2: rebatepolicy表是主表,rebatepolicyitems是从表,从表有主表的主键,现在对于主表一些条件的数据的对应子表要求删除. 如下方式: delete from rebatepolicyitems rs where exists ( from rebatepolicy r where rs.rebateguid=r.rebateguid ' and r.creator='名字' ) delete f…
1.关于 cascade constraints 假设A为主表(既含有某一主键的表),B为从表(即引用了A的主键作为外键). 则当删除A表时,如不特殊说明,则 drop table A 系统会出现错误警告的讯息而不会允许执行. 此时必须用,drop table A cascade constraints: SQL> select CONSTRAINT_NAME,TABLE_NAME from dba_constraints where owner = 'SYS' and TABLE_NAME =…