sql-关联查询

1. inner join 内连接查询
在这里插入图片描述

SELECT a.,b. FROM table_a a INNER JOIN table_b b ON a.id=b.id;

2. left join 左关联查询

在这里插入图片描述

SELECT a.,b. FROM table_a a LEFT JOIN table_b b ON a.id=b.id;

3.right join 右关联查询

在这里插入图片描述

SELECT a.,b. FROM table_a a RIGHT JOIN table_b b ON a.id=b.id;

4.左连接-内连接
在这里插入图片描述

SELECT a.,b. FROM table_a a LEFT JOIN table_b b ON a.id=b.id WHERE b.id IS NULL;

5. 右连接-内连接

在这里插入图片描述

SELECT a.,b. FROM table_a a RIGHT JOIN table_b b ON a.id=b.id WHERE a.id IS NULL
————————————————


版权声明:本文为sinat_26192119原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。