2011-12-28 50 views
1

您有兩個名爲Customer和SalesOrder的表。在客戶表中,您有1000個客戶,其中900個客戶在SalesOrder表中有訂單。您執行以下查詢以列出至少有一次銷售的所有客戶。簡單的MCTS SQL選擇

SELECT * FROM Customer WHERE Customer.CustomerID IN (SELECT Customer.CustomerID 
FROM SalesOrder) 

您需要確定查詢的結果。查詢返回哪個結果?

A. No rows 
B. A warning message 
C. The 1000 rows in the Customer table 
D. The 900 rows in the Customer table with matching rows in the SalesOrder table 

的MCTS聲稱,答案是C,但我不知道爲什麼不D.

你覺得呢?

回答

1

我同意官方的回答。我是個白癡。

問題是內部SQL Select有Customer.CustomerID而不是SalesOrder.CustomerID

道歉。