Oracle 子查询中 from后不是表 而是一个条件 这是为什么啊

select s1.sno, s1.sname
from student s1
where not exists(select *
from (select_ cno_ from course where tno = (select tno from teacher where tname = '小红‘)) c
where not exists(select * from sc s2 where s2.sno = s1.sno and s2.cno = c.cno));

刚开始练习Oracle,搜到一套题,里面有这个语句 from后跟着的子查询出来的是一个cno字段,而不是表 后面起了别名c,最后这个c也只能用c.cno,不能用其他字段。


(select_ cno_ from course where tno = (select tno from teacher where tname = '小红‘)) c

因为子查询中只查了一个字段cno,所以你要调用子查询里面的结果,那肯定也是只有一个cno 可以使用了。
如果你要用其他字段,要查询出来就可以了。
比如:cno、name等。

(select  cno,name from course where tno = (select tno from teacher where tname = '小红‘)) c