Listing 2: Query to Check for Matching Table Values SELECT COUNT(*) FROM t2 WHERE EXISTS (SELECT * FROM t1 WHERE t1.col1 = t2.col1)