子查詢
子查詢是一種常用計算機語言SELECT-SQL語言中嵌套查詢下層的程式模塊,當一個查詢是另一個查詢的條件時,稱之為子查詢,
# 子查詢的用法
# 在欄位
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) ;
表就不發出來了,將就著看叭,主要是表我找不到了是哪一個了,
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/103142.html
標籤:MySQL
下一篇:MySQL資料庫:group分組
