SQL中cross join,left join,right join ,full join,inner join 的区别
生活随笔
收集整理的這篇文章主要介紹了
SQL中cross join,left join,right join ,full join,inner join 的区别
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
http://blog.csdn.net/sgivee/article/details/5081350 SQL中cross join,left join,right join ,full join,inner join 的區(qū)別 ? cross join 是笛卡兒乘積 就是一張表的行數(shù)乘以另一張表的行數(shù)
left join 第一張表的連接列在第二張表中沒有匹配是,第二張表中的值返回null
right join 第二張表的連接列在第一張表中沒有匹配是,第一張表中的值返回null
full join 返回兩張表中的行 left join+right join
inner join 只返回兩張表連接列的匹配項 ? http://wuaner.iteye.com/blog/559014insert?into?t_sales_forecast ?? select?SALES_FORECAST_SEQUENCE.nextval?as?id,basic.*?from? ?? ( ?? select?school_id,district_id,year_table.year,month_table.month?,500?as?or_forcast,1000?as?re_forcast,sysdate?as?update_date,'1'?as?user_id,sysdate?as?insert_date ?? from?v_school_district ?? cross?join? ?? ( ?? select?level?as?year?from?dual??where?level>2006?connect?by?level<2012 ?? )?year_table ?? cross?join? ?? ( ?? select?lpad(level,2,0)?month?from?dual?connect?by?level?<13? ?? )?month_table ?? order?by?school_id,district_id,year_table.year,month_table.month? ?? )?basic??
left join 第一張表的連接列在第二張表中沒有匹配是,第二張表中的值返回null
right join 第二張表的連接列在第一張表中沒有匹配是,第一張表中的值返回null
full join 返回兩張表中的行 left join+right join
inner join 只返回兩張表連接列的匹配項 ? http://wuaner.iteye.com/blog/559014
總結(jié)
以上是生活随笔為你收集整理的SQL中cross join,left join,right join ,full join,inner join 的区别的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle 循环语句总结(breakc
- 下一篇: Oracle中start with...