1.in和exist选哪个好呢?
SELECT * FROM A WHERE cc IN (SELECT cc FROM B)
SELECT * FROM A WHERE EXIST (SELECT cc FROM B WHERE B.cc=A.cc)
此时需要判断A表和B表的大小了。如果在都有索引的前提下,A表比B表大的话,那么IN子查询的效率远高于EXIST子查询的效率;
2.
1.in和exist选哪个好呢?
SELECT * FROM A WHERE cc IN (SELECT cc FROM B)
SELECT * FROM A WHERE EXIST (SELECT cc FROM B WHERE B.cc=A.cc)
此时需要判断A表和B表的大小了。如果在都有索引的前提下,A表比B表大的话,那么IN子查询的效率远高于EXIST子查询的效率;
2.