select s from t_sc where c=(select c from t_c where cn='jsp')
select s from t_sc,t_c where t_c.c=t_sc.c and cn='jsp'
select s from t_sc join t_c on (t_sc.c=t_c.c) where cn='jsp'
这三种sql语句的区别在那 ?
求高手解释一下
select s from t_sc where c=(select c from t_c where cn='jsp')
select s from t_sc,t_c where t_c.c=t_sc.c and cn='jsp'
select s from t_sc join t_c on (t_sc.c=t_c.c) where cn='jsp'
这三种sql语句的区别在那 ?
求高手解释一下
一是使用子查询,会创建临时表
二和三区别不是特别大
三里默认的join是inner join
二里where查询时,优化器可能会自动把where查询变成inner join,两者效率区别不大,上面例子的二和三应该是等价的吧