2013-11-02 28 views
1

我是新来的sql,什么是查询加入或不加入?

select vehicle.plates, make, model 
from vehicle 
    join registration on registration.plates = vehicle.plates 
where country = 'Japan'; 

而且

select vehicle.plates, make, model 
from registration, vehicle 
where registration.plates = vehicle.plates and country=’Japan’; 
+2

这两个查询都有一个“连接”。第二个使用旧式隐式连接。 –

回答

0

第一个查询的区别是ANSI标准,另一种是没有。

尽管如此,查询应该返回相同的结果。

+0

第二个也是ANSI兼容 - 实际上这是1992年之前的ANSI标准 –

+0

@a_horse_with_no_name - 甚至没有知道这一点。我的印象是这是一个不赞成的语法。我知道它仍然有效,但现在JOIN语法是首选语法。学到了新的东西:) – SchmitzIT