表信息
![0f3f661c04e838607e20330a8c978710.png](https://i-blog.csdnimg.cn/blog_migrate/fb01f2256ed0609864426bbe2bcae384.jpeg)
1 -- 用in操作符与子查询语句来查询所有f_id对应的f_price在10元到20元之间的水果记录(*)
select * from fruits
where f_id in (select f_id from fruits where f_price between 10 and 20);
2 -- 用all操作符与子查询语句来查询所有f_price大于20元的水果记录 (**)
select * from fruits
where f_price > all (select f_price from fruits where f_price <= 20);
3 -- 用exists操作符与子查询语句来查询是否存在f_price大于30元的水果记录 (**)
select * from fruits
where exists (select * from fruits where f_price >30);
4 -- 用any操作符与子查询语句来查询所有f_id对应的f_price 在10到20元之间的水果记录 (**)
select * from fruits where f_id = any
(select f_id from fruits where f_price between 10 and 20);
写完后发现: 呵呵呵, 子查询也并没有那么难嘛 !