联合查询分为内连接和外连接两个
一: 外连接又分为:左连接、右连接、完全外连接。
1. 左连接 left join或 left outer join
SQL语句:
select * from student left join course student .ID=course.ID
语句解说:左外连接包含left join左表所有行,如果左表中某行在右表没有匹配,则结果中对应行右表的部分全部为空(NULL)
2. 右连接 right join或 right outer join
SQL语句:
select * from student right join course student .ID=course.ID
语句解说:右外连接包含right join右表所有行,如果左表中某行在右表没有匹配,则结果中对应左表的部分全部为空(NULL)