select*from A,B where A.id=B.id
select*from A innerjoin B on A.id=B.id
-- 在现代数据库系统中,隐式连接和显式连接的性能是基本相同的。显式连接的主要优点在于可读性和维护性,而不是性能提升。
2、左外连接查询
select*from A left[outer]join B
on A.id = B.id
3、右外连接查询
select*from A right[outer]join B
on A.id=B.id
4、全外连接
全外连接full outer join (mysql不支持)
union 可以连接两个查询语句并去重
select * from A left outer join B on
A.id = B.id
union
select * from A right outer join B on
A.id = B.id
5、左外连接结果去掉交集
select * from A left [outer] join B on
A.id=B.id where B.id is null
6、右外连接去掉交集
select* form A rightjoin B
on A.id = B.id where A.id isnull
7、AB全集去掉AB交集
select*from A leftouterjoin B on A.id = B.id
where B.id isnullunionselect*from A rightouterjoin B on A.id = B.id
wherer A.id isnull