select *fron table1 join table2 on table1.条件列名 = table2.条件列名
返回符合匹配条件的两表列
等价于:
select A* ,B* from table1 A ,table2 B where A.条件列名 =B.条件列名
select *form table1 cross join table2 where table1.条件列名 = table2.条件列名(注: Cross join 后面不能跟on 只能用where)
交叉连接(完全)
概念:没有用where子句的交叉连接将产生连接所涉及的笛卡尔积第一个表的行数乘以第二个表的行数等于笛卡尔积和结果集的大小
交叉连接: Cross join(不带条件where,如果带返回或显示的是匹配的行数)
SQL语法:
select *from table1 cross join table2
如果有条件(where)
select * from table1 cross join table2 where table1. 条件列名= table2.条件列名
等价于
select *from table1,table2 (不带where)
更多SQL内容来自木庄网络博客