1. 程式人生 > >OCP-1Z0-051 第15題 別名的用法

OCP-1Z0-051 第15題 別名的用法

一、原題
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 in 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 MIDPOINT should be enclosed with in double quotation marks for the
CUST_CREDIT_LIMIT/2 expression.

答案:A

二、題目翻譯
檢視CUSTOMERS表的資料,看下面的查詢語句:

SQL> SELECT cust_name AS "NAME", cust_credit_limit/2 AS MIDPOINT,MIDPOINT+100 AS "MAX LOWER LIMIT"
     FROM customers;
上面的語句在執行時會產生一個錯誤。
錯誤原因是什麼?
A. 別名不能用在表示式裡
B. 別名不應該附在雙引號裡
C. MIDPOINT+100表示式給出一個錯誤,因為CUST_CREDIT_LIMIT包含空值。
D. 關於CUST_CREDIT_LIMIT/2表示式,別名MIDPOINT應該放在雙引號裡。