G. 子查询
一,基本含义
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002858943-844726161.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002859115-1607302595.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002859334-653719902.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002859521-7922234.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002859756-1076678743.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002859943-1974857962.jpg)
二,子查询的分类
①按子查询结果分:
②按子查询的位置(场合)分:
三,常用子查询①比较运算符中的子查询
②使用in的子查询
③使用any的子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916756-1312314989.jpg)
④使用all的子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917381-1619429405.jpg)
⑤使用some的子查询
⑥使用exists的查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002906834-1413232177.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002906928-525485407.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002907021-918883363.jpg)
②按子查询的位置(场合)分:
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002907225-254702594.jpg)
三,常用子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002907396-1882110018.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002908021-502493643.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002908115-934854470.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002908225-2005655909.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002910146-1087592767.jpg)
③使用any的子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002915928-2099954664.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916381-1148545703.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916662-890014402.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916756-1312314989.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916865-1521945472.jpg)
④使用all的子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917381-1619429405.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917553-1315350683.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917678-1912176278.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002916990-582160848.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917084-598245934.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917193-1971476495.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917381-1619429405.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917553-1315350683.jpg)
⑤使用some的子查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002917678-1912176278.jpg)
⑥使用exists的查询
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918068-2028134878.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918178-1648654833.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918303-1332008004.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918521-320700824.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918662-443852823.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918850-680139177.jpg)
![](https://images2017.cnblogs.com/blog/1065651/201712/1065651-20171225002918943-1628462061.jpg)