Exists can be said to be a more common use of Oracle database development, with exists can improve the efficiency of SQL, can replace in.
exists is to determine whether the SQL statement after exits is true, if the whole SQL sentence is true, otherwise there is no record. Example:
Select 1 from dual where exists (select 1 from dual where 2=1);
There must be no record of the above.
Select 1 from dual where exists (select 1 from dual where 1=1);
The above situation is returned by a record.
Determine if another table contains foreign key records for a table . Example:
SELECT * FROM Table_test a
where exists (select 1 from scott.carol_tmp where pps_master=a.pps_master);
This SQL is to check whether the Pps_master in the Table_test is in carol_tmp. (whether the Carol_tmp table contains foreign key records for the Table_test table)
In fact, the same effect can be achieved, but in the words less efficient, especially in some large tables. The performance of exists and in is reflected.