1、select a.*,b.* from tableA a left join tableB b on a.key = b.key;

2、select a.*,b.* from tableA a right join tableB b on a.key = b.key;

3、select a.*,b.* from tableA a inner join tableB b on a.key = b.key;

4、select a.*,b.* from tableA a left join tableB b on a.key = b.key where b.key is null;

5、select a.*,b.* from tableA a left join tableB b on a.key = b.key where a.key is null;

6、select a.*,b.* from tableA a full outer join tableB b on a.key = b.key;

7、select a.*,b.* from tableA a full outer join tableB b on a.key = b.key where a.key is null or b.key is null;

本文详细解析了SQL中七种不同的联表查询方法,包括左连接、右连接、内连接、全外连接等,每种方法都通过实例进行了说明,帮助读者深入理解并掌握SQL联表查询技巧。
4976





