天天看點

OCP-1Z0-051 第8題 子查詢和多表關聯查詢和情況

一、原題

 View the Exhibit and examine the structure of the CUSTOMERS table.

Which two tasks would require subqueries or joins to be executed in a single statement? (Choose two)

OCP-1Z0-051 第8題 子查詢和多表關聯查詢和情況

A. listing of customers who do not have a credit limit and were born before 1980

B. finding the number of customers, in each city, whose marital status is 'married'

C. finding the average credit limit of male customers residing in 'Tokyo' or 'Sydney'

D. listing of those customers whose credit limit is the same as the credit limit of customers residing in the city 'Tokyo’.

E. finding the number of customers, in each city, whose credit limit is more than the average credit limit of all the customers.

答案  DE

二、題目翻譯

下面是CUSTOMERS表的結構:

以下哪兩個需求需要在一條語句中執行子查詢或表關聯查詢?(選擇兩個)

A. 列出沒有信貸限額并且1980年以前出生的客戶。

B. 找出每個城市的已婚客戶的數量。

C. 找出住在'Tokyo'或者 'Sydney'兩個城市的男性客戶的平均信貸限額。

D. 列出與住在'Tokyo'的客戶的信貸限額相等的客戶。

E. 找出每個城市信貸限額大于所有客戶的平均信貸限額的客戶數量。

三、題目解析

A選項,隻需要在where條件中判斷有沒有信貸限額和出生日期小于1980的人,兩個條件and連接配接就行了,不需要子查

              詢或多表關聯。

B選項,隻需要在where條件過濾是否結婚就可以了,也不需要使用子查詢或關聯查詢。

C選項,用where過濾兩個城市,并且性别是男的客戶,然後求平均信貸額,也不需要用子查詢或關聯查詢。

D選項,首先要用子查詢查出Tokyo這個客戶的信貸限額,然後才能求出哪個使用者與他的相等。

E選項,首先要用子查詢查出客戶的平均信貸額,然後才能求出哪些使用者的信貸額大于平均信貸額。

繼續閱讀