概念:不带WHERE条件子句,它将会返回被连接的两个表的笛卡尔积,返回结果的行数等于两个表行数的乘积(例如:T_student和T_class,返回4*4=16条记录),如果带where,返回或显示的是匹配的行数。
1、不带where:
select *from T_student cross join T_class //cross join 可以省略不写 等于 select *from T_student, T_class
2、有where子句,往往会先生成两个表行数乘积的数据表,然后才根据where条件从中选择。
select * from T_student s cross join T_class c where s.classId = c.classId (注:cross join后加条件只能用where,不能用on)