表联结分三步:
1.笛卡尔积 (cross join)
select * from
dbo.Student as S
cross join
dbo.Address as A
假如dbo.Student有m行,dbo.Address有n行,返回m*n行数据
2.on筛选 (inner join, inner可省略)
select * from
dbo.Student as S
(inner)join
dbo.Address as A
on S.Id = A.StudentId
Note: ANSI SQL-92的语法是以上,旧版本的ANSI SQL-89的语法是不同的
select * from dbo.Student as S , dbo.Address as A
where S.Id = A.StudentId
多表查询,如果没有 where 筛选,相当于一个cross join,笛卡尔积
3 补充外部行 (外联,left outer join, right outer join, full outer join, outer可省略)