使用“内部联接”从Oracle SQL表中删除
所以我到处搜索,尝试在这个论坛上使用的其他技巧都没有用 因此,尝试在Oracle SQL Developer v3.2.20.09中使用内部联接删除 我希望从表1中删除的表,列名Column1,其中数据与“表2”中的列“Column2”匹配 我知道Oracle/Microsoft SQL之间存在一些差异,尝试了以下多种查询,使用开/闭括号、内部联接、存在的位置和选择的位置略有不同。 尝试: 我编写的代码有哪些问题?现有版本如下所示:使用“内部联接”从Oracle SQL表中删除,sql,oracle,join,Sql,Oracle,Join,所以我到处搜索,尝试在这个论坛上使用的其他技巧都没有用 因此,尝试在Oracle SQL Developer v3.2.20.09中使用内部联接删除 我希望从表1中删除的表,列名Column1,其中数据与“表2”中的列“Column2”匹配 我知道Oracle/Microsoft SQL之间存在一些差异,尝试了以下多种查询,使用开/闭括号、内部联接、存在的位置和选择的位置略有不同。 尝试: 我编写的代码有哪些问题?现有版本如下所示: delete from table2 where exists
delete from table2
where exists (select *
from table1
where table1.column1 = table2.column2);
或者,您可以使用IN子句
现有版本如下所示:
delete from table2
where exists (select *
from table1
where table1.column1 = table2.column2);
或者,您可以使用IN子句
如果要从表1中删除,则必须在delete子句中使用表名,而不是表2
如果要从表1中删除,则必须在delete子句中使用表名,而不是表2 考虑使用A。它包含一个可以使用的删除子句。它包含一个可以使用的DELETE子句。
delete from table2
where column2 in (select column1
from table1);
delete table1 t1
where exists (select null
from table2 t2
where t2.column2 = t1.column1)