您的位置:首页 > 博客中心 > 数据库 >

SQL Left、Right Join等操作符总结

时间:2022-03-14 00:26

1、在tableA与tableB中查询tableA中全部数据和tableB中在tableA中的数据
select * from tableA A left join tableB B on A.key=B.key
2、在tableA中查询排除tableB中数据,剩余的tableA中的数据
select * from tableA A left join tableB B on A.key=B.key where B.key is null
3、查询tableA与tableB中所有的数据
select * from tableA A full outer join tableB B on A.key=B.key
4、查询tableA与tableB两表之外的数据
select * from tableA A full outer join tableB B on A.key=B.key where A.key is null or B.key is null
5、查询tableA与tableB中共同的数据
select * from tableA A inner join tableB B on A.key=B.key

热门排行

今日推荐

热门手游