qintangtao

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::


====================
内连接
====================
内链接实际上就是利用where子句对两张表形成的笛卡儿积 进行筛选

====================
外连接
====================

===============================
左外连接 left join .. on ..
===============================
左侧的表完全显示
select stu.name,stu.id,exam.grade from stu [left join] exam [on] stu.id=exam.id;
或者
select stu.name,stu.id,exam.grade from stu, exam stu.id=exam.id(+);

===============================
右外连接 right join .. on ..
===============================
右侧的表完全显示
select stu.name,stu.id,exam.grade from stu [right join] exam [on] stu.id=exam.id;
或者
select stu.name,stu.id,exam.grade from stu, exam stu.id(+)=exam.id;

===============================
完全外连接 full outer join ..on..
===============================
完全显示两个表,没有匹配的记录置为空
select stu.name,stu.id,exam.grade from stu [full outer join] exam [on] stu.id=exam.id;

posted on 2012-10-30 17:02  qintangtao  阅读(227)  评论(0编辑  收藏  举报