内连接、外连接、自然连接 简单的SQL语句总结

内连接:查询出来的结果肯定会满足所有的条件

    select  columns from table1 [inner] join table2 on table1.column = table2.cloumn;

左/右外连接:查询出来的结果存在不满足条件的可能

    select columns from table1 left/right join table2 on table1.col = table2.col;

全外链接:MySQL不支持,Oracle支持

    select columns from table1 full join table2 on table1.col = table2.col;

自然连接:两张表中的名称和类型完全一致的列进行内连接

    select columns from table1 natural join table2;


猜你喜欢

转载自blog.csdn.net/zaoanmiao/article/details/79710618