子查詢是一種經常使用計算機語言SELECT-SQL語言中嵌套查詢下層的程序模塊。當一個查詢是另外一個查詢的條件時,稱之爲子查詢。mysql
# 子查詢的用法 # 在字段 select (select cName from courses where cNo = cID) as '課程名稱', count(elNo) from elogs GROUP BY cID; # 在表 select * from courses where exists( select * from (select sum(cCredit) as sumValue from courses where cNo in ( select cID from elogs where sID ='20180001' and elScore >=60 ) )as A where sumValue<10) ;
表就不發出來了,將就着看叭,主要是表我找不到了是哪個了。sql