有 DDL 语句:
CREATE TABLE t1(
c1 INT NOT NULL
);
CREATE TABLE t2(
c2 INT NOT NULL
);
我的查询:
SELECT c1 FROM t1 WHERE c1 NOT IN (SELECT c2 from t2)
解释输出:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where
子查询与外部查询无关。为什么它的类型是依赖子查询?
UPD:查询是SELECT c1 FROM t1 WHERE c1 NOT IN (SELECT c2 from t2)