Home > Database > Mysql Tutorial > SQL中leftjoin和innerjoin配合使用

SQL中leftjoin和innerjoin配合使用

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:22:04
Original
3426 people have browsed it

left join on 是左外联接,数据以左边的表为基准,右边的表数据哪怕为null也会查询出来, 而inner join on则是左右两边的表的数据必须相互对应,如果有null则会去掉该条数据,如果 右边或者左边表的数据都为null,则查询出来是没有结果集的。两个联接配合起

   left join on 是左外联接,数据以左边的表为基准,,右边的表数据哪怕为null也会查询出来,

  而inner join on则是左右两边的表的数据必须相互对应,如果有null则会去掉该条数据,如果

  右边或者左边表的数据都为null,则查询出来是没有结果集的。两个联接配合起来使用效果极好。

  因为有些需求需要我们配合这两个联接查询。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template