Skip to content

Instantly share code, notes, and snippets.

@wmydz1
Created November 14, 2017 06:48
Show Gist options
  • Save wmydz1/dbe3d3aba9e8abac3dfb7bd6f2331644 to your computer and use it in GitHub Desktop.
Save wmydz1/dbe3d3aba9e8abac3dfb7bd6f2331644 to your computer and use it in GitHub Desktop.
#交叉连接 cross join :没有 WHERE 子句的交叉联接将产生连接所涉及的表的笛卡尔积。第一个表的行数乘以第二个表的行数等于笛卡尔积结果集的大小。
select * from student cross join course
#三张表:A (id,xxx) B(id,xxx) C(id,xxx) 要根据相同的id显示三张表,做Left Join。
select * from a inner join b on a.id=b.id inner join c on b.id=c.id
SELECT XXX
FROM ((A LEFT JOIN B ON A.id = B.id)
LEFT JOIN C ON A.id = C.id)
WHERE B.id Is Not Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment