select * from a left join b on a.abid = b.baid left join c on c.cbid = b.bcid
顺序是先a,b组合成一个虚拟表,然后虚拟表再和C表关联
a表先和b表left join 生成虚拟表(假设为T1),是T1直接和C left join
测试数据:
SELECT * FROM STUDENT;
SELECT * FROM SCORE;
左联接:
SELECT T1.* ,T2.* FROM STUDENT T1 LEFT JOIN SCORE T2 ON T1.ID = T2.STUDENT_ID;
右连接:
SELECT T1.* ,T2.* FROM STUDENT T1 RIGHT JOIN SCORE T2 ON T1.ID = T2.STUDENT_ID;
内连接:
SELECT T1.* ,T2.* FROM STUDENT T1 inner JOIN SCORE T2 ON T1.ID = T2.STUDENT_ID;