开发者

Question about joining tables

开发者 https://www.devze.com 2023-03-07 08:11 出处:网络
What kind of join i开发者_如何学运维s actually for the following sql statement? select * from table1 tbl1, table2 tbl2

What kind of join i开发者_如何学运维s actually for the following sql statement?

select * 
from table1 tbl1, table2 tbl2 
where tbl1.id = tbl2.id

Does it only return result if both id matches?


This is an inner join.

Yes, only records that have matching IDs will be returned.

This is the same as:

select * 
from table1 tbl1 
 inner join table2 tbl2 
    on tbl1.id = tbl2.id

Personally, I prefer the explicit notation of INNER JOIN.


Yes, that is ANSI-89 syntax for an inner join. ANSI-92 defines the [INNER,LEFT, etc...] JOIN keywords.

0

精彩评论

暂无评论...
验证码 换一张
取 消