mysql 笔记 子查询

当子查询语句结果只有一个值时,肯定在where后面作为条件

select 字段  from 表 where 字段=(子查询语句)

当子查询语句结果是一列值时,一般用来in里面

MySQL(七)|MySQL中In与Exists的区别(1) - 腾讯云开发者社区-腾讯云

select * from user where user_id in (select id from B);

当子查询语句结果是多行多列,我们就可以当作表使用

select * from (select * from student where sex=“男”) as nan where nan.age > 18;

posted @ 2022-07-12 23:24  在线电影制作人  阅读(4)  评论(0)    收藏  举报  来源