Reputation: 22964
What happens if I write the following query:
SELECT *
FROM table
WHERE name IN (select name from someotherTable where id = 3)
and the inner query (inside the IN statement) returns no result set
will the outer where automatically evaluate to True or to False?
Upvotes: 0
Views: 363
Reputation: 181077
Let's test it;
CREATE TABLE TableA ( id INT );
INSERT INTO TableA VALUES (1);
CREATE TABLE TableB ( id INT );
SELECT * FROM TableA
WHERE id IN (SELECT * FROM TableB);
(empty set)
Upvotes: 1