1、INNER JOIN(内连接)

select * from table A A inner join table B B on A.key = B.key //内连接
2、LEFT JOIN(左连接)

select * from table A A left join table B B on A.key = B.key //左连接
3、RIGHT JOIN(右连接)

select * from table A A right join table B B on A.key = B.key //右连接
4、OUTER JOIN(外连接)

select * from table A A full outer join table B B on A.key = B.key //外连接
5、LEFT JOIN EXCLUDING INNER JOIN(左连接-内连接)

select * from table A A left join table B B on A.key = B.key where B.key is null //左连接 - 内连接
6、RIGHT JOIN EXCLUDING INNER JOIN(右连接-内连接)

select * from table A A right join table B B on A.key = B.key where A.key is null //右连接 - 内连接
7、OUT JOIN EXCLUDING INNER JOIN(外连接-内连接)

select * from table A A full outer join table B B on A.key = B.key where A.key is null or B.key is null //外连接 - 内连接

更多推荐

SQL语句各种join用法(图文)