数据库的外连接、内连接、左外连接,全外连接

Students表和Advisors表

一、内连接

按照Advistor_ID进行表的合并,合并后的数据只有两个表中Advistor_ID都有的值,对应的行

 二、左外连接

按照Advistor_ID进行的左外连接合并,保证表Students中Advistor_ID的每一列都在合并后的新表中,对于Advistors表中没有的数据,填null

三、全外连接:

新表中有原来两个表中的所有数据,Advistor_ID中找不到对应值的项填null

参考:

http://www.datamartist.com/sql-inner-join-left-outer-join-full-outer-join-examples-with-syntax-for-sql-server

猜你喜欢

转载自www.cnblogs.com/share-sjb/p/10003865.html