Examly題庫立即開始練習
國家安全情報人員考試五等考試-資訊組資料處理大意1082單選題

select c_name, city from customer inner join sales using (s_id) where sales.lname = 'Tom'; 下列那個SQL指令可和上述SQL指令得到相同的查詢結果?

Aselect c_name, city from customer inner join sales having customer.s_id =sales.s_id and sales.lname='Tom';
Bselect c_name, city from customer where customer.s_id =sales.s_id and sales.lname='Tom';
Cselect c_name, city from customer, sales where sales.lname='Tom';
Dselect c_name, city from customer, sales where customer.s_id =sales.s_id and sales.lname='Tom';正確答案
答案與詳解
D
正確答案
INNER JOIN USING(s_id) 等同於在 WHERE 子句寫 customer.s_id = sales.s_id 的隱式連接。

為什麼答案是 D

用逗號列出兩表(隱式 CROSS JOIN),再以 WHERE 指定 customer.s_id=sales.s_id 作連接條件並加上 lname='Tom',完全等價於 INNER JOIN USING(s_id)。

考點:HAVING誤用考點:FROM缺表考點:缺連接條件考點:隱式內部連接
載入中…

想練更多資料處理大意考古題?

Examly 收錄 38 萬+ 道歷屆題目,每題都有像這樣的精選詳解。免費下載,立即開練。

Download on theApp Store即將推出Google Play
黑皮