OCP-1Z0-051 第十五題

原題:

View the Exhibit and examine the data in the CUSTOMERS table.

Evaluate the following query:

SQL> SELECT cust_name AS "NAME", cust_credit_limit/2 AS MIDPOINT, MIDPOINT + 100 AS "MAX LOWER LIMIT" FROM customers;

The above query produces an error on execution.

What is the reason for the error?

A.An alias cannot be used an expression.

B.The alias NAME should not be enclosed with in double quotation marks.

C.The MIDPOINT+100 expression gives an error because CUST_CREDIT_LIMIT contains NULL values.

D.The alias MODPOINT should be enclosed with in double quotation marks for the CUST_CREDIT_LIMIT/2 expression.

Answer:A

翻譯:

查看CUSTOMERS表的數據,對照下面的查詢語句回答下面的問題:

上面的查詢會返回一個錯誤,以下四個選項中,哪一個是返回錯誤的原因:

A.別名不能用於表達式。

B.別名NAME不能用雙引號

C.MIDPOINT + 100表達式返回一個錯誤,因為CUST_CREDIT_LIMIT 包含空值

D.別名MIDPOINT應該放在雙引號里

解析:

這道題考察的是列的別名,別名不能用於SELECT選擇的列中,不能用於WHERE條件中。可以用於ORDER BY 子句中。


推薦閱讀:

TAG:Oracle資料庫 | ocp認證 | 資料庫管理員DBA |