May I know is there any difference on using AND or EXIST for selecting on 2 tables by composite foreign key?
AND example:
SELECT comp1, comp2
FROM TABLE1
WHERE comp1 = ( SELECT comp1 FROM TABLE2 )
AND comp2 = ( SELECT comp2 FROM TABLE2 );
EXISTS example:
SELECT comp1, comp2
FROM TABLE1
WHERE EXISTS( SELECT *
FROM TABLE2
WHERE TABLE1.comp1 = TABLE2.comp1
and TABLE1.comp2 = TABLE2.comp2);
Thanks.