在Oracle中,可以使用以下几种方式来查询两个表不同的数据:
1. 使用MINUS运算符:
```sql
SELECT column1, column2, ...
FROM table1
MINUS
SELECT column1, column2, ...
FROM table2;
```
2. 使用NOT IN子查询:
```sql
SELECT column1, column2, ...
FROM table1
WHERE (column1, column2, ...) NOT IN
(SELECT column1, column2, ...
FROM table2);
```
3. 使用NOT EXISTS子查询:
```sql
SELECT column1, column2, ...
FROM table1
WHERE NOT EXISTS
(SELECT column1, column2, ...
FROM table2
WHERE table1.column1 = table2.column1
AND table1.column2 = table2.column2
...);
```
4. 使用LEFT JOIN和IS NULL:
```sql
SELECT table1.column1, table1.column2, ...
FROM table1
LEFT JOIN table2 ON table1.column1 = table2.column1
AND table1.column2 = table2.column2
...
WHERE table2.column1 IS NULL
AND table2.column2 IS NULL
...;
```
以上方法都可以用来查询在table1中存在但在table2中不存在的数据。如果要查询在table2中存在但在table1中不存在的数据,只需要交换table1和table2的位置即可。