inner join和cross join的使用

inner join和cross join的使用和逗號是同樣的效果,其中的區別就是,inner join產生的是交叉鏈接,而cross join是產生內鏈接而已。ci

例:it

select countryname,statename from country,state 等價於select countryname,statename from country cross join state; select

select countryname,statename from country,state where state.cid = country.id 等價於 elect countryname,statename from country inner join state where state.cid = country.id;co

 

並且,這兩個關鍵字和逗號均可以儘量多的鏈接不少的表:join

select * from country cross join state cross join city;oss

相關文章
相關標籤/搜索