2021
01-08
01-08
详解sql中exists和in的语法与区别
exists和in的区别很小,几乎可以等价,但是sql优化中往往会注重效率问题,今天咱们就来说说exists和in的区别。exists语法:select…fromtablewhereexists(子查询)将主查询的结果,放到子查询结果中进行校验,如子查询有数据,则校验成功,那么符合校验,保留数据。createtableteacher(tidint(3),tnamevarchar(20),tcidint(3));insertintoteachervalues(1,'tz',1);insertintoteachervalues(2,'tw',2);insertinto...
继续阅读 >