關於資料庫的問題 - 考試
By Poppy
at 2013-04-23T16:09
at 2013-04-23T16:09
Table of Contents
Employee(E#,E_name,E_address,E_salary)
Works_On(E#,P#,hours)
project(P#,P_name)
問:列出所有做了三個(含)以上的計劃的員工,他們的名字和薪水
唐箏的解法: Select E_name,E_salary
From Employee
Whrer E# In
(Select E#
From works_on
Group By E#
Having count(*)>=3
);
函授課程中,他自己說這個解法,在子查詢中少了where條件,要學生自己寫
還說不會寫的考不上....我就是那個不會寫的XDD
有人知道where條件缺什麼嗎?
是不是少了 Where Employee.E# = works_on.E# ??
如果是少了這個,覺得滿疑惑的
我自己是覺得
子查詢已經可以靠 Group By E# 和 Having count(*) 查詢出誰做了三個以上的計畫
並且 Select E# 會顯示出這些人的 E# 給上一層的 where
如此為什麼還要再子查詢裡面加where條件?
----------------------------------------------------------------------------
或者他的意思是最上層 where 少了條件??
請高手解惑
謝謝
--
Works_On(E#,P#,hours)
project(P#,P_name)
問:列出所有做了三個(含)以上的計劃的員工,他們的名字和薪水
唐箏的解法: Select E_name,E_salary
From Employee
Whrer E# In
(Select E#
From works_on
Group By E#
Having count(*)>=3
);
函授課程中,他自己說這個解法,在子查詢中少了where條件,要學生自己寫
還說不會寫的考不上....我就是那個不會寫的XDD
有人知道where條件缺什麼嗎?
是不是少了 Where Employee.E# = works_on.E# ??
如果是少了這個,覺得滿疑惑的
我自己是覺得
子查詢已經可以靠 Group By E# 和 Having count(*) 查詢出誰做了三個以上的計畫
並且 Select E# 會顯示出這些人的 E# 給上一層的 where
如此為什麼還要再子查詢裡面加where條件?
----------------------------------------------------------------------------
或者他的意思是最上層 where 少了條件??
請高手解惑
謝謝
--
Tags:
考試
All Comments
By Candice
at 2013-04-27T03:12
at 2013-04-27T03:12
By Tristan Cohan
at 2013-04-28T18:03
at 2013-04-28T18:03
By Edith
at 2013-05-01T22:10
at 2013-05-01T22:10
By Todd Johnson
at 2013-05-03T19:25
at 2013-05-03T19:25
By Selena
at 2013-05-04T06:45
at 2013-05-04T06:45
By Rachel
at 2013-05-08T01:37
at 2013-05-08T01:37
By Anonymous
at 2013-05-11T00:05
at 2013-05-11T00:05
By Edwina
at 2013-05-11T09:09
at 2013-05-11T09:09
By Aaliyah
at 2013-05-14T06:25
at 2013-05-14T06:25
By Tom
at 2013-05-16T01:58
at 2013-05-16T01:58
By Thomas
at 2013-05-16T05:02
at 2013-05-16T05:02
By Valerie
at 2013-05-18T22:31
at 2013-05-18T22:31
By Barb Cronin
at 2013-05-19T10:06
at 2013-05-19T10:06
By Steve
at 2013-05-19T16:21
at 2013-05-19T16:21
Related Posts
運輸學問題(阿摩線上題庫)
By Ula
at 2013-04-23T15:45
at 2013-04-23T15:45
國文測驗題如何增進
By Zanna
at 2013-04-23T14:54
at 2013-04-23T14:54
臺銀綜合保險經紀人股份有限公司102甄試
By Jack
at 2013-04-23T14:34
at 2013-04-23T14:34
電子-差動放大器
By Edward Lewis
at 2013-04-23T11:34
at 2013-04-23T11:34
研究所與考後醫的抉擇
By Kama
at 2013-04-23T11:27
at 2013-04-23T11:27