current position:Home>In the Oracle subquery, the from is not a table but a condition. Why

In the Oracle subquery, the from is not a table but a condition. Why

2022-02-03 01:37:57 CSDN Q & A

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 = ' Xiaohong ‘)) c
where not exists(select * from sc s2 where s2.sno = s1.sno and s2.cno = c.cno));

Just started practicing Oracle, Found a set of questions , There is this sentence in it from The sub query followed by is a cno Field , Not a watch It has an alias behind it c, This last c It can only be used c.cno, Cannot use other fields .




Refer to the answer 1:
(select_ cno_ from course where tno = (select tno from teacher where tname = ' Xiaohong ‘)) c



Refer to the answer 2:



Refer to the answer 3:

Because there is only one field in the sub query cno, So you need to call the results in the sub query , There must be only one cno It's ready to use .
If you want to use other fields , Just find it out .
such as :cno、name etc. .

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



Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030137558680.html

Random recommended