An EXISTS clause is considered "satisfied" if the subquery returns at least one row.
EXISTS condition syntax:
SELECT columns FROM WHERE EXISTS tables (subquery);
Please note that “Select Null from mytable” will return the number of rows in mytable, but all of them will contain only one column with a zero value in the cell, since the requirement of an external query is to check if any row is in the given condition for example, in your case it is "TableB.Col1 = TableA.Col1"
you can change the null value to 1, 0 or any column name available in the table. 1/0 may not be a good idea :)
source share