select * from ContactInformation c where exists (select * from Department d where d.Id = c.DepartmentId ) select * from ContactInformation c inner join Department d on c.DepartmentId = d.Id
两个查询都给出相同的输出,这在性能明智的连接或与exists子句的相关子查询中是好的,哪一个更好.
编辑: – 有连接的alternet方式,以提高性能: –
在上面的2个查询中,我想要来自dept以及contactinformation表的信息