mysql 之 exists子查询
来源:互联网 发布:俄罗斯女孩中国人知乎 编辑:程序博客网 时间:2024/05/16 12:46
子查询可以分为:from where 和 exists子查询
分类表:
mysql> select * from category;+----+---------+| id | c_name |+----+---------+| 1 | ios || 2 | android || 3 | sb |+----+---------+3 rows in set
mysql> select * from goods;+----+---------+--------+-------+-----+| id | name | cat_id | price | num |+----+---------+--------+-------+-----+| 1 | 苹果 | 1 | 4999 | 2 || 2 | nexus4 | 2 | 1999 | 3 || 4 | 荣耀2 | 2 | 1888 | 5 || 6 | 三星 | 2 | 3000 | 2 |+----+---------+--------+-------+-----+6 rows in se
要求:只找出分类下有商品的分类
mysql> select * from category c where exists (select * from goods where cat_id=c.id);+----+---------+| id | c_name |+----+---------+| 1 | ios || 2 | android |+----+---------+2 rows in set
- mysql 之 exists子查询
- MySQL 子查询-exists
- mysql之exists子查询和in查询的对比
- mysql子查询 -exists,not exists
- MySQL 子查询 EXISTS 和 NOT EXISTS
- mysql中exists子查询
- mysql---where子查询、form子查询、exists子查询
- mysql 子查询in与exists互换
- MySQL子查询---EXISTS优化策略辨析
- MySQL带EXISTS关键字的子查询
- 子查询(exists子查询)
- 理解exists子查询
- MSSQL EXISTS子查询
- EXISTS子查询
- MySQL子查询(一)—— EXISTS与IN
- MySQL子查询(一)—— EXISTS与IN
- MySQL自学笔记4--where、from、exists型子查询
- 43.笔记 MySQL学习——EXISTS 和 NOT EXISTS子查询
- 数论读书笔记——算数基本定理
- 串口应用编程
- 菜鸟笔记:c/c++中关于lib与dll文件的生成与使用。
- SQL Server 2008 镜像1418错误处理
- Exchange Server 2013存档技术
- mysql 之 exists子查询
- SQLServer2008镜像实施过程摘要和碰到的问题
- PMOS开关管的选择与电路图
- ASP.NET GridView 实现课程表显示(动态合并单元格)
- HDU 2616 Kill the monster
- webrtc关于锁的编程思想
- 模拟编译器对虚函数索引项的实现
- javascript解析json数据-简单演示
- 每天读一遍,不久你就会变!