连接查询
1.交叉连接:select * from 表1 cross join 表2;
2. 内连接:
select查询字段 from 表1 (inner)join 表2 on 表1.关系字段=表2.关系字段
3. 外连接(左外连接 、右外连接);
Select所查询字段 from 表一 left\right (outer) join 表2 on
表1.关系字段=表2.关系字段 where 条件;
子查询
1.带in关键字的子查询:
select * from 表1 where didin (select did from 表2 where 条件);
2.带exists关键词的子查询:
select * from 表1 where exists(select did from 表2 where 条件);
3.带any关键字的子查询:
select * from 表1 where did> any (select did from 表2);
4.带all关键字的子查询:
select * from 表1 where did> all (select did from 表2);
5.带比较运算符的字查询:
select * from 表1 wheredid=(select did from 表2 where ‘条件’);