sql面试题

1.左连接、右连接、内连接的区别

  select a.*,b.* from tablea a left join tableb b on a.id=b.pid;   左连接是以a表为基础,去匹配b表的数据,有则填充数据,没有填充null

  select a.*,b.* from tablea a right join tableb b on a.id=b.pid;  右连接是以b表为基础,去匹配a表的数据,有则填充数据,没有填充null

  select a.*,b.* from tablea a inner join tableb b on a.id=b.pid;  内连接是去两张表匹配两个id相等的数据

posted @ 2019-07-09 16:30  花花妹子。  阅读(386)  评论(0编辑  收藏  举报