SQL语句面试问答(五)

解释过明各种Joins

图表

语句

select <select_list> from table A left join table B on A.key=B.key

即使右表中没有匹配,也从左表返回所有行

select <select_list> from table A right join table B on A.key=B.key

即使左表中没有匹配,也从右表返回所有行

select <select_list> from table A inner join table B on A.key=B.key

如果表中有至少一个匹配,则返回行,与join相同

select <select_list> from table A left join table B on A.key=B.key where B.key is null

select <select_list> from table A right join table B on A.key=B.key where A.key is null

select <select_list> from table A full outer join table B on A.key=B.key

full on:只要其中一个表中存在匹配,则返回行

select <select_list> from table A full outer join table B on A.key=B.key where A.key is null or B.key is null

#sql##测试#
测试岗面经 文章被收录于专栏

整理面试过程中的测试问答,常看常新,多多学习!有些问题是从其他人那里转载而来,会在文章下面注明出处,希望大家多多支持~~

全部评论

相关推荐

07-24 16:39
已编辑
门头沟学院 测试开发
点赞 评论 收藏
分享
评论
点赞
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务