天天看點

OCP-1Z0-051 第55題 in和or的性能比較

一、原題

Evaluate the following two queries:

SQL> SELECT cust_last_name, cust_city

FROM customers

WHERE cust_credit_limit IN (1000, 2000, 3000);

SQL> SELECT cust_last_name, cust_city

FROM customers

WHERE cust_credit_limit = 1000 OR cust_credit_limit = 2000 OR

cust_credit_limit = 3000;

Which statement is true regarding the above two queries?

A. Performance would improve in query 2.

B. Performance would degrade in query 2.

C. There would be no change in performance.

D. Performance would improve in query 2 only if there are null values in the CUST_CREDIT_LIMIT column.

答案:C

二、題目翻譯

評估下面的兩個查詢:

關于上面的兩條語句哪一個是正确的?

A. 查詢2的性能比較高。

B. 查詢2的性能比較低。

C. 性能沒有變化。

D. 隻要CUST_CREDIT_LIMIT列中有空值,則查詢2的性能比較高。

三、題目解析

語句1的這種in條件,在oracle執行的時候,也會轉成or的形式來執行,是以性能上沒什麼不同,是一樣的。

繼續閱讀